Skip to content

Commit d960057

Browse files
author
Christopher Willis-Ford
committed
telemetry: add 'platform' and improve 'version'
1 parent 740872d commit d960057

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/main/ScratchDesktopTelemetry.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import {app, ipcMain} from 'electron';
22
import defaultsDeep from 'lodash.defaultsdeep';
3+
import {version} from '../../package.json';
34

45
import TelemetryClient from './telemetry/TelemetryClient';
56

67
const EVENT_TEMPLATE = {
7-
version: '3.0.0',
8+
version,
89
projectName: '',
910
language: '',
1011
metadata: {

src/main/telemetry/TelemetryClient.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import ElectronStore from 'electron-store';
22
import nets from 'nets';
3+
import * as os from 'os';
34
import uuidv1 from 'uuid/v1'; // semi-persistent client ID
45
import uuidv4 from 'uuid/v4'; // random ID
56

@@ -17,7 +18,7 @@ import uuidv4 from 'uuid/v4'; // random ID
1718
* Default telemetry service URLs
1819
*/
1920
const TelemetryServerURL = Object.freeze({
20-
staging: 'http://scratch-telemetry-s.us-east-1.elasticbeanstalk.com/',
21+
staging: 'http://scratch-telemetry-staging.us-east-1.elasticbeanstalk.com/',
2122
production: 'https://telemetry.scratch.mit.edu/'
2223
});
2324
const DefaultServerURL = (
@@ -49,6 +50,12 @@ const DefaultQueueLimit = 100;
4950
*/
5051
const DeliveryAttemptLimit = 3;
5152

53+
const platform = [
54+
`${os.platform()} ${os.release()}`, // "win32 10.0.18362", "darwin 18.7.0", etc.
55+
`Electron ${process.versions.electron}`, // "Electron 4.2.6"
56+
`Store=${process.mas || process.windowsStore || false}` // "Store=true" or "Store=false"
57+
].join(', ');
58+
5259

5360
/**
5461
* Client interface for the Scratch telemetry service.
@@ -213,6 +220,7 @@ class TelemetryClient {
213220
clientID: this.clientID,
214221
id: packetId,
215222
name: eventName,
223+
platform,
216224
timestamp: now.getTime(),
217225
userTimezone: now.getTimezoneOffset()
218226
}, additionalFields);

0 commit comments

Comments
 (0)