Merge pull request #67 from cwillisf/telemetry-platform

telemetry: add 'platform' and improve 'version'
This commit is contained in:
Chris Willis-Ford 2019-08-06 12:43:45 -07:00 committed by GitHub
commit 76dc35cf52
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View file

@ -1,10 +1,11 @@
import {app, ipcMain} from 'electron';
import defaultsDeep from 'lodash.defaultsdeep';
import {version} from '../../package.json';
import TelemetryClient from './telemetry/TelemetryClient';
const EVENT_TEMPLATE = {
version: '3.0.0',
version,
projectName: '',
language: '',
metadata: {

View file

@ -1,5 +1,6 @@
import ElectronStore from 'electron-store';
import nets from 'nets';
import * as os from 'os';
import uuidv1 from 'uuid/v1'; // semi-persistent client ID
import uuidv4 from 'uuid/v4'; // random ID
@ -17,7 +18,7 @@ import uuidv4 from 'uuid/v4'; // random ID
* Default telemetry service URLs
*/
const TelemetryServerURL = Object.freeze({
staging: 'http://scratch-telemetry-s.us-east-1.elasticbeanstalk.com/',
staging: 'http://scratch-telemetry-staging.us-east-1.elasticbeanstalk.com/',
production: 'https://telemetry.scratch.mit.edu/'
});
const DefaultServerURL = (
@ -49,6 +50,12 @@ const DefaultQueueLimit = 100;
*/
const DeliveryAttemptLimit = 3;
const platform = [
`${os.platform()} ${os.release()}`, // "win32 10.0.18362", "darwin 18.7.0", etc.
`Electron ${process.versions.electron}`, // "Electron 4.2.6"
`Store=${process.mas || process.windowsStore || false}` // "Store=true" or "Store=false"
].join(', ');
/**
* Client interface for the Scratch telemetry service.
@ -213,6 +220,7 @@ class TelemetryClient {
clientID: this.clientID,
id: packetId,
name: eventName,
platform,
timestamp: now.getTime(),
userTimezone: now.getTimezoneOffset()
}, additionalFields);