Skip to content

Instantly share code, notes, and snippets.

@MikeRatcliffe
Created August 15, 2018 16:49
Show Gist options
  • Save MikeRatcliffe/ce483e18108a5a065b9945777954b8e6 to your computer and use it in GitHub Desktop.
Save MikeRatcliffe/ce483e18108a5a065b9945777954b8e6 to your computer and use it in GitHub Desktop.
diff --git a/devtools/client/framework/toolbox.js b/devtools/client/framework/toolbox.js
--- a/devtools/client/framework/toolbox.js
+++ b/devtools/client/framework/toolbox.js
@@ -104,16 +104,18 @@ loader.lazyGetter(this, "registerHarOver
*/
function Toolbox(target, selectedTool, hostType, contentWindow, frameId,
msSinceProcessStart) {
this._target = target;
this._win = contentWindow;
this.frameId = frameId;
this.telemetry = new Telemetry();
+ console.log(`XXXXX this.telemetry.osinfo: ${this.telemetry.osinfo.toSource()}`);
+
// The session ID is used to determine which telemetry events belong to which
// toolbox session. Because we use Amplitude to analyse the telemetry data we
// must use the time since the system wide epoch as the session ID.
this.sessionId = msSinceProcessStart;
// Map of the available DevTools WebExtensions:
// Map<extensionUUID, extensionName>
this._webExtensions = new Map();
diff --git a/devtools/client/shared/telemetry.js b/devtools/client/shared/telemetry.js
--- a/devtools/client/shared/telemetry.js
+++ b/devtools/client/shared/telemetry.js
@@ -8,16 +8,17 @@
* Comprehensive documentation is in docs/frontend/telemetry.md
*/
"use strict";
const Services = require("Services");
const { TelemetryStopwatch } = require("resource://gre/modules/TelemetryStopwatch.jsm");
const { getNthPathExcluding } = require("devtools/shared/platform/stack");
+const { TelemetryEnvironment } = require("resource://gre/modules/TelemetryEnvironment.jsm");
// Object to be shared among all instances.
const PENDING_EVENTS = new Map();
const PENDING_EVENT_PROPERTIES = new Map();
class Telemetry {
constructor() {
// Bind pretty much all functions so that callers do not need to.
@@ -31,16 +32,20 @@ class Telemetry {
this.recordEvent = this.recordEvent.bind(this);
this.setEventRecordingEnabled = this.setEventRecordingEnabled.bind(this);
this.preparePendingEvent = this.preparePendingEvent.bind(this);
this.addEventProperty = this.addEventProperty.bind(this);
this.toolOpened = this.toolOpened.bind(this);
this.toolClosed = this.toolClosed.bind(this);
}
+ get osinfo() {
+ return TelemetryEnvironment.currentEnvironment.system.os;
+ }
+
/**
* Time since the system wide epoch. This is not a monotonic timer but
* can be used across process boundaries.
*/
msSystemNow() {
return Services.telemetry.msSystemNow();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment