Skip to content

Commit

Permalink
feat(web): add basic telemetry for key actions (#845)
Browse files Browse the repository at this point in the history
  • Loading branch information
lupino3 authored Oct 23, 2023
1 parent 383b503 commit 979a03f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/webapp/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,32 @@ appInsights.loadAppInsights();
appInsights.context.application.ver = version;
appInsights.context.application.build = version;
const telemetryInitializer = (envelope) => {
envelope.tags['ai.cloud.role'] = process.env.NODE_ENV;
envelope.tags['ai.cloud.role'] = process.env.NODE_ENV,
envelope.tags['ai.cloud.roleInstance'] = version;
};
appInsights.addTelemetryInitializer(telemetryInitializer);
appInsights.trackPageView();
console.log('Initialized AppInsights');

// Web Worker that runs the EduMIPS64 core, built from the Java codebase.
// Contains some syntactical sugar methods to make working with the
// Web Worker API a bit easier.
// Web Worker API a bit easier, and some telemetry.
let simulator = new Worker('worker.js');
simulator.reset = () => {
simulator.postMessage({ method: 'reset' });
appInsights.trackEvent({name: "reset"});
};
simulator.step = (n) => {
simulator.postMessage({ method: 'step', steps: n });
appInsights.trackEvent({name: 'step', properties: {steps: n}});
};
simulator.load = (code) => {
simulator.postMessage({ method: 'load', code });
appInsights.trackEvent({name: "load"});
};
simulator.checkSyntax = (code) => {
simulator.postMessage({ method: 'checksyntax', code });
appInsights.trackEvent({name: "checkSyntax"});
};
simulator.parseResult = (result) => {
result.registers = JSON.parse(result.registers);
Expand Down

0 comments on commit 979a03f

Please sign in to comment.