mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-31 01:25:38 -05:00
SQL Operations Studio Public Preview 1 (0.23) release source code
This commit is contained in:
50
src/vs/platform/telemetry/node/commonProperties.ts
Normal file
50
src/vs/platform/telemetry/node/commonProperties.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as Platform from 'vs/base/common/platform';
|
||||
import * as os from 'os';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import * as uuid from 'vs/base/common/uuid';
|
||||
|
||||
// {{SQL CARBON EDIT}}
|
||||
import product from 'vs/platform/node/product';
|
||||
|
||||
export const machineIdStorageKey = 'telemetry.machineId';
|
||||
export const machineIdIpcChannel = 'vscode:machineId';
|
||||
|
||||
export function resolveCommonProperties(commit: string, version: string): TPromise<{ [name: string]: string; }> {
|
||||
const result: { [name: string]: string; } = Object.create(null);
|
||||
|
||||
result['sessionID'] = uuid.generateUuid() + Date.now();
|
||||
result['commitHash'] = commit;
|
||||
result['version'] = version;
|
||||
result['common.osVersion'] = os.release();
|
||||
result['common.platform'] = Platform.Platform[Platform.platform];
|
||||
result['common.nodePlatform'] = process.platform;
|
||||
result['common.nodeArch'] = process.arch;
|
||||
|
||||
// {{SQL CARBON EDIT}}
|
||||
result['common.application.name'] = product.nameLong;
|
||||
|
||||
// dynamic properties which value differs on each call
|
||||
let seq = 0;
|
||||
const startTime = Date.now();
|
||||
Object.defineProperties(result, {
|
||||
'timestamp': {
|
||||
get: () => new Date(),
|
||||
enumerable: true
|
||||
},
|
||||
'common.timesincesessionstart': {
|
||||
get: () => Date.now() - startTime,
|
||||
enumerable: true
|
||||
},
|
||||
'common.sequence': {
|
||||
get: () => seq++,
|
||||
enumerable: true
|
||||
}
|
||||
});
|
||||
|
||||
return TPromise.as(result);
|
||||
}
|
||||
Reference in New Issue
Block a user