mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Refresh master with initial release/0.24 snapshot (#332)
* Initial port of release/0.24 source code * Fix additional headers * Fix a typo in launch.json
This commit is contained in:
@@ -9,7 +9,7 @@ import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { guessMimeTypes } from 'vs/base/common/mime';
|
||||
import paths = require('vs/base/common/paths');
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { ConfigurationSource, IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
|
||||
import { IKeybindingService, KeybindingSource } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { ILifecycleService, ShutdownReason } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import { ITelemetryService, ITelemetryInfo, ITelemetryData } from 'vs/platform/telemetry/common/telemetry';
|
||||
@@ -39,42 +39,22 @@ export function combinedAppender(...appenders: ITelemetryAppender[]): ITelemetry
|
||||
|
||||
export const NullAppender: ITelemetryAppender = { log: () => null };
|
||||
|
||||
// --- util
|
||||
|
||||
export function anonymize(input: string): string {
|
||||
if (!input) {
|
||||
return input;
|
||||
/* __GDPR__FRAGMENT__
|
||||
"URIDescriptor" : {
|
||||
"mimeType" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
|
||||
"ext": { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
|
||||
"path": { "classification": "CustomerContent", "purpose": "FeatureInsight" }
|
||||
}
|
||||
|
||||
let r = '';
|
||||
for (let i = 0; i < input.length; i++) {
|
||||
let ch = input[i];
|
||||
if (ch >= '0' && ch <= '9') {
|
||||
r += '0';
|
||||
continue;
|
||||
}
|
||||
if (ch >= 'a' && ch <= 'z') {
|
||||
r += 'a';
|
||||
continue;
|
||||
}
|
||||
if (ch >= 'A' && ch <= 'Z') {
|
||||
r += 'A';
|
||||
continue;
|
||||
}
|
||||
r += ch;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
*/
|
||||
export interface URIDescriptor {
|
||||
mimeType?: string;
|
||||
ext?: string;
|
||||
path?: string;
|
||||
}
|
||||
|
||||
export function telemetryURIDescriptor(uri: URI): URIDescriptor {
|
||||
export function telemetryURIDescriptor(uri: URI, hashPath: (path: string) => string): URIDescriptor {
|
||||
const fsPath = uri && uri.fsPath;
|
||||
return fsPath ? { mimeType: guessMimeTypes(fsPath).join(', '), ext: paths.extname(fsPath), path: anonymize(fsPath) } : {};
|
||||
return fsPath ? { mimeType: guessMimeTypes(fsPath).join(', '), ext: paths.extname(fsPath), path: hashPath(fsPath) } : {};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -178,14 +158,26 @@ const configurationValueWhitelist = [
|
||||
];
|
||||
|
||||
export function configurationTelemetry(telemetryService: ITelemetryService, configurationService: IConfigurationService): IDisposable {
|
||||
return configurationService.onDidUpdateConfiguration(event => {
|
||||
if (event.source !== ConfigurationSource.Default) {
|
||||
return configurationService.onDidChangeConfiguration(event => {
|
||||
if (event.source !== ConfigurationTarget.DEFAULT) {
|
||||
/* __GDPR__
|
||||
"updateConfiguration" : {
|
||||
"configurationSource" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
|
||||
"configurationKeys": { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
|
||||
}
|
||||
*/
|
||||
telemetryService.publicLog('updateConfiguration', {
|
||||
configurationSource: ConfigurationSource[event.source],
|
||||
configurationSource: ConfigurationTarget[event.source],
|
||||
configurationKeys: flattenKeys(event.sourceConfig)
|
||||
});
|
||||
/* __GDPR__
|
||||
"updateConfigurationValues" : {
|
||||
"configurationSource" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
|
||||
"configurationValues": { "classification": "CustomerContent", "purpose": "FeatureInsight" }
|
||||
}
|
||||
*/
|
||||
telemetryService.publicLog('updateConfigurationValues', {
|
||||
configurationSource: ConfigurationSource[event.source],
|
||||
configurationSource: ConfigurationTarget[event.source],
|
||||
configurationValues: flattenValues(event.sourceConfig, configurationValueWhitelist)
|
||||
});
|
||||
}
|
||||
@@ -194,6 +186,11 @@ export function configurationTelemetry(telemetryService: ITelemetryService, conf
|
||||
|
||||
export function lifecycleTelemetry(telemetryService: ITelemetryService, lifecycleService: ILifecycleService): IDisposable {
|
||||
return lifecycleService.onShutdown(event => {
|
||||
/* __GDPR__
|
||||
"shutdown" : {
|
||||
"reason" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
|
||||
}
|
||||
*/
|
||||
telemetryService.publicLog('shutdown', { reason: ShutdownReason[event] });
|
||||
});
|
||||
}
|
||||
@@ -201,6 +198,11 @@ export function lifecycleTelemetry(telemetryService: ITelemetryService, lifecycl
|
||||
export function keybindingsTelemetry(telemetryService: ITelemetryService, keybindingService: IKeybindingService): IDisposable {
|
||||
return keybindingService.onDidUpdateKeybindings(event => {
|
||||
if (event.source === KeybindingSource.User && event.keybindings) {
|
||||
/* __GDPR__
|
||||
"updateKeybindings" : {
|
||||
"bindings": { "classification": "CustomerContent", "purpose": "FeatureInsight" }
|
||||
}
|
||||
*/
|
||||
telemetryService.publicLog('updateKeybindings', {
|
||||
bindings: event.keybindings.map(binding => ({
|
||||
key: binding.key,
|
||||
|
||||
Reference in New Issue
Block a user