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:
@@ -8,8 +8,12 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
|
||||
/* __GDPR__FRAGMENT__
|
||||
"IExperiments" : {
|
||||
"deployToAzureQuickLink" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
|
||||
}
|
||||
*/
|
||||
export interface IExperiments {
|
||||
deployToAzureQuickLink: boolean;
|
||||
}
|
||||
|
||||
export const IExperimentService = createDecorator<IExperimentService>('experimentService');
|
||||
@@ -25,7 +29,7 @@ export class ExperimentService implements IExperimentService {
|
||||
|
||||
_serviceBrand: any;
|
||||
|
||||
private experiments: IExperiments;
|
||||
private experiments: IExperiments = {}; // Shortcut while there are no experiments.
|
||||
|
||||
constructor(
|
||||
@IStorageService private storageService: IStorageService,
|
||||
@@ -57,12 +61,12 @@ function applyOverrides(experiments: IExperiments, configurationService: IConfig
|
||||
|
||||
function splitExperimentsRandomness(storageService: IStorageService): IExperiments {
|
||||
const random1 = getExperimentsRandomness(storageService);
|
||||
const [random2, /* showTaskDocumentation */] = splitRandom(random1);
|
||||
const [/* random3 */, deployToAzureQuickLink] = splitRandom(random2);
|
||||
const [/* random2 */, /* ripgrepQuickSearch */] = splitRandom(random1);
|
||||
// const [/* random3 */, /* deployToAzureQuickLink */] = splitRandom(random2);
|
||||
// const [random4, /* mergeQuickLinks */] = splitRandom(random3);
|
||||
// const [random5, /* enableWelcomePage */] = splitRandom(random4);
|
||||
return {
|
||||
deployToAzureQuickLink
|
||||
// ripgrepQuickSearch,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -84,6 +88,5 @@ function splitRandom(random: number): [number, boolean] {
|
||||
}
|
||||
|
||||
function getExperimentsOverrides(configurationService: IConfigurationService): IExperiments {
|
||||
const config: any = configurationService.getConfiguration('telemetry');
|
||||
return config && config.experiments || {};
|
||||
return configurationService.getConfiguration<any>('experiments') || {};
|
||||
}
|
||||
|
||||
@@ -64,7 +64,12 @@ export class TelemetryService implements ITelemetryService {
|
||||
|
||||
if (this._configurationService) {
|
||||
this._updateUserOptIn();
|
||||
this._configurationService.onDidUpdateConfiguration(this._updateUserOptIn, this, this._disposables);
|
||||
this._configurationService.onDidChangeConfiguration(this._updateUserOptIn, this, this._disposables);
|
||||
/* __GDPR__
|
||||
"optInStatus" : {
|
||||
"optIn" : { "classification": "SystemMetaData", "purpose": "BusinessInsight" }
|
||||
}
|
||||
*/
|
||||
this.publicLog('optInStatus', { optIn: this._userOptIn });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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