Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing the unused telemetry events #83

Merged
merged 6 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
885 changes: 496 additions & 389 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@
"@kubernetes/client-node": "^0.19.0",
"@microsoft/vscode-file-downloader-api": "^1.0.1",
"@types/tmp": "^0.1.0",
"@vscode/extension-telemetry": "^0.8.2",
"@vscode/extension-telemetry": "^0.8.2",
"chokidar": "^3.5.3",
"command-exists": "^1.2.8",
"got": "^11.0.0",
Expand Down
9 changes: 0 additions & 9 deletions src/Initializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ export class Initializer {
this._outputChannel,
this._binariesUtility);

this._logger.trace(TelemetryEvent.ConnectInitializationSuccess, {
workspacesCommonId: this._workspacesCommonId.toString()
});

return connectWorkspaceFolder;
}
catch (error) {
Expand All @@ -64,11 +60,6 @@ export class Initializer {
const debugConfigurationName: string = await debugAssetsInitializer.retrieveBridgeConfigurationDebugAssetsAsync(reason, /*shouldCreateDebugAssetsIfMissing*/ !wereDebugAssetsEverCreated);
this._context.workspaceState.update(Constants.ConnectDebugAssetsCreationIdentifier, wereDebugAssetsEverCreated || debugConfigurationName != null);

this._logger.trace(TelemetryEvent.Connect_EnsureConfigurationPresentSuccess, {
checkReason: reason,
wereDebugAssetsCreated: debugConfigurationName != null
});

return debugConfigurationName;
}
catch (error) {
Expand Down
2 changes: 0 additions & 2 deletions src/StatusBarMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,6 @@ export class StatusBarMenu {
this._prerequisitesAlertCallback = (): void => {
vscode.window.showErrorMessage(`Failed to validate the prerequisites required to use ${Constants.ProductName}: ${error.message}`);
};
this._logger.error(TelemetryEvent.StatusBar_ValidatePrerequisitesError, error);
return false;
}

Expand Down Expand Up @@ -359,7 +358,6 @@ export class StatusBarMenu {

this._isMenuOpened = true;
this.refreshStatusItem();
this._logger.trace(TelemetryEvent.StatusBar_MenuOpened);
}

private async refreshCurrentKubeconfigContextAsync(promptUser: boolean = false): Promise<boolean> {
Expand Down
8 changes: 0 additions & 8 deletions src/WorkspaceFolderManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,6 @@ export class WorkspaceFolderManager {

vscode.debug.onDidStartDebugSession(async (debugSession: vscode.DebugSession) => {
if (DebugAssetsInitializer.isConnectTask(debugSession.configuration[`preLaunchTask`])) {
this._logger.trace(TelemetryEvent.Connect_DebugSessionStarted, {
launchConfigurationName: debugSession[`name`]
});

// Make sure that Connect is actually running. In rare cases, the Connect task might be skipped.
// In such case, restarting the debug session is enough to be back to a normal state.
await this._connectWorkspaceFoldersInitializationPromise;
Expand All @@ -152,10 +148,6 @@ export class WorkspaceFolderManager {
this._connectDebugSessions.delete(debugSession);

const disconnectAfterDebugging: boolean = vscode.workspace.getConfiguration(Constants.SettingsConfigurationName).get<boolean>(`disconnectAfterDebugging`, true);
this._logger.trace(TelemetryEvent.Connect_DebugSessionTerminated, {
launchConfigurationName: debugSession[`name`],
disconnectAfterDebugging: disconnectAfterDebugging
});

const connectWorkspaceFolder: ConnectWorkspaceFolder = this._connectWorkspaceFolderMap.get(debugSession.workspaceFolder);
if (connectWorkspaceFolder == null) {
Expand Down
13 changes: 0 additions & 13 deletions src/binaries/BinariesUtilityV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,6 @@ export class BinariesUtilityV2 implements IBinariesUtility {
this._binariesPromise = this.runEnsureBinariesAsync();
this._binariesPromise.then(() => {
this._binariesPromiseIsResolved = true;
this._logger.trace(TelemetryEvent.BinariesUtility_EnsureBinariesSuccess, {
isUsingLocalBinaries: (process.env.BRIDGE_BUILD_PATH != null).toString(),
isUsingLocalDotNet: (process.env.DOTNET_ROOT != null).toString()
});
}).catch(error => {
this._binariesPromise = null;
this._logger.error(TelemetryEvent.BinariesUtility_EnsureBinariesError, error, {
Expand Down Expand Up @@ -126,7 +122,6 @@ export class BinariesUtilityV2 implements IBinariesUtility {
if (this._binariesPromiseIsResolved) {
try {
const binaries = await this._binariesPromise;
this._logger.trace(TelemetryEvent.BinariesUtility_TryGetBinariesSuccess);
return binaries;
}
catch (error) {
Expand Down Expand Up @@ -240,7 +235,6 @@ export class BinariesUtilityV2 implements IBinariesUtility {
const legacyBridgeDownloadDirectoryName: string = path.dirname(bridgePath).replace(bridgeDownloadDirectoryRegExp, Constants.LegacyBridgeDownloadDirectoryName);
if (await fileSystem.existsAsync(legacyBridgeDownloadDirectoryName)) {
await fileSystem.rmdirAsync(legacyBridgeDownloadDirectoryName, { recursive: true });
this._logger.trace(TelemetryEvent.BinariesUtility_DeleteLegacyBridgeDownloadDirectorySuccess);
}
}
catch (error) {
Expand Down Expand Up @@ -319,7 +313,6 @@ export class BinariesUtilityV2 implements IBinariesUtility {
const fileDownloader: FileDownloader = await this.validateAndGetFileDownloaderApiAsync();
let unzipDirectory: vscode.Uri;
try {
this._logger.trace(TelemetryEvent.BinariesUtility_DownloadStart, downloadProperties);
unzipDirectory = await fileDownloader.downloadFile(
vscode.Uri.parse(downloadInfo.downloadUrl),
clientProvider.getDownloadDirectoryName(),
Expand All @@ -334,8 +327,6 @@ export class BinariesUtilityV2 implements IBinariesUtility {

const binaryPath = path.join(unzipDirectory.fsPath, clientProvider.getExecutableFilePath());
await fileSystem.accessAsync(binaryPath);
this._logger.trace(TelemetryEvent.BinariesUtility_DownloadSuccess, downloadProperties);

return binaryPath;
}
catch (error) {
Expand Down Expand Up @@ -430,7 +421,6 @@ export class BinariesUtilityV2 implements IBinariesUtility {
if (bridgeOrKubectlClientDownloaded || !await checkKubectlExistsWithRequiredVersionCallBack()) {
await fileSystem.mkdirAsync(path.dirname(kubectlExecutableFilePathForBridge), { recursive: true });
await fileSystem.copyFileAsync(kubectlPath, kubectlExecutableFilePathForBridge);
this._logger.trace(TelemetryEvent.BinariesUtility_CopyKubectlToBridgeFolderSuccess);
}
}
catch (error) {
Expand All @@ -448,9 +438,6 @@ export class BinariesUtilityV2 implements IBinariesUtility {
}
const oldBridgeClient = new BridgeClient(dotNetPath, bridgeExecutablePath, commandRunner, this._expectedBridgeVersion, this._logger);
await oldBridgeClient.cleanLocalConnectAsync();
this._logger.trace(TelemetryEvent.BinariesUtility_CleanUpBeforeDownloadSuccess, /*properties*/ {
clientType: ClientType.Bridge
});
}
catch (error) {
this._logger.warning(`Error occured while performing clean up before download. Error: ${error.message}`);
Expand Down
7 changes: 0 additions & 7 deletions src/clients/BinariesVersionClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export class BinariesVersionClient {
}

private async getBinariesDownloadInfoAsync(): Promise<IBinariesDownloadInfo> {
const downloadStartTime = new Date();
let downloadSucceeded = false;

try {
Expand Down Expand Up @@ -74,12 +73,6 @@ export class BinariesVersionClient {
this._logger.error(TelemetryEvent.BinariesVersionClient_GetDownloadInfoError, error);
throw error;
}
finally {
this._logger.trace(TelemetryEvent.BinariesVersionClient_GetDownloadInfoStatus, /*properties*/ {
binariesVersionsDownloadTimeInMilliseconds: new Date().getTime() - downloadStartTime.getTime(),
Vidya2606 marked this conversation as resolved.
Show resolved Hide resolved
binariesVersionsDownloadSucceeded: downloadSucceeded
});
}
}

private getDownloadInfo(client: ClientType, binariesDownloadInfo: object): IDownloadInfo {
Expand Down
7 changes: 0 additions & 7 deletions src/clients/BridgeClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ export class BridgeClient implements IClient {
// for prod, dev, staging and "0.1.0.11071149-username" or "0.1.0.11071149" for local builds.
const bridgeVersion: string = output.trim();

this._logger.trace(TelemetryEvent.BridgeClient_GetVersionSuccess);
return bridgeVersion;
};
return await RetryUtility.retryAsync<string>(getVersionAsyncFn, /*retries*/3, /*delayInMs*/100);
Expand Down Expand Up @@ -86,7 +85,6 @@ export class BridgeClient implements IClient {
this._logger.error(TelemetryEvent.BridgeClient_CheckCredentialsError, error);
throw error;
}
this._logger.trace(TelemetryEvent.BridgeClient_CheckCredentialsSuccess);
}

public async refreshCredentialsAsync(kubeconfigPath: string, namespace: string, authenticationTargetCallback: (target: IAuthenticationTarget) => any): Promise<void> {
Expand Down Expand Up @@ -170,8 +168,6 @@ export class BridgeClient implements IClient {
const trimmedOutput = output.substring(output.indexOf(`[`), output.lastIndexOf(`]`) + 1);
const requests = JSON.parse(trimmedOutput.replace(/[\r\n]/g, ``));

this._logger.trace(TelemetryEvent.BridgeClient_PrepConnectSuccess);

return requests;
}
catch (error) {
Expand Down Expand Up @@ -256,8 +252,6 @@ export class BridgeClient implements IClient {
currentWorkingDirectory,
customEnvironmentVariables
);

this._logger.trace(TelemetryEvent.BridgeClient_ConnectSuccess);
}
catch (error) {
this._logger.error(TelemetryEvent.BridgeClient_ConnectError, redactJsonObject(error));
Expand All @@ -273,7 +267,6 @@ export class BridgeClient implements IClient {
args,
null /* currentWorkingDirectory */,
this.getRequiredEnvironmentVariables());
this._logger.trace(TelemetryEvent.BridgeClient_CleanLocalConnectSuccess);
}
catch (error) {
if (error.message.includes(`Failed to load kubeconfig`)) {
Expand Down
1 change: 0 additions & 1 deletion src/clients/DotNetClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export class DotNetClient implements IClient {
const output: string = await this._commandRunner.runAsync(this._executablePath, args);
const dotNetRuntimeInfo: string = output.trim();
const dotNetVersion = this.parseVersionFromRuntimeInfo(dotNetRuntimeInfo);
this._logger.trace(TelemetryEvent.DotNetClient_GetVersionSuccess);
return dotNetVersion;
};
return await RetryUtility.retryAsync<string>(getVersionAsyncFn, /*retries*/3, /*delayInMs*/100);
Expand Down
7 changes: 0 additions & 7 deletions src/clients/KubectlClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,6 @@ export class KubectlClient implements IClient {
const versionJson: object = JSON.parse(kubectlOutput);
let version: string = versionJson[`clientVersion`][`gitVersion`]; // Example: v1.16.8
version = version.replace(/v/g, ``); // Remove the occurence of 'v' from the version
this._logger.trace(TelemetryEvent.KubectlClient_GetVersionSuccess);

return version;
};
return await RetryUtility.retryAsync<string>(getVersionAsyncFn, /*retries*/3, /*delayInMs*/100);
Expand Down Expand Up @@ -313,11 +311,6 @@ export class KubectlClient implements IClient {
/*detached*/ false,
quiet
);

this._logger.trace(TelemetryEvent.KubectlClient_CommandSuccess, {
args: args.join(` `)
});

return outputData;
}
catch (error) {
Expand Down
18 changes: 0 additions & 18 deletions src/connect/ConnectWizard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@ export class ConnectWizard {
return null;
}

this._logger.trace(TelemetryEvent.Connect_WizardStart, {
wizardReason: wizardReason,
type: targetResourceType
});

const kubectlClient = await this._binariesUtility.tryGetKubectlAsync();
const bridgeClient = await this._binariesUtility.tryGetBridgeAsync();
if (kubectlClient == null || bridgeClient == null) {
Expand Down Expand Up @@ -86,19 +81,6 @@ export class ConnectWizard {
});
vscode.window.showErrorMessage(`Failed to configure ${Constants.ProductName}: ${asError(error).message}`);
} finally {
this._logger.trace(TelemetryEvent.Connect_WizardStop, {
wizardReason: wizardReason,
type: targetResourceType,
isWizardComplete: this._isWizardComplete,
isResourceNameSet: (this._result.resourceName != null && this._result.resourceName.length > 0).toString(),
ports: this._result.ports != null ? this._result.ports.join(`,`) : undefined,
launchConfigurationName: this._result.launchConfigurationName,
isIsolateAsSet: (this._result.isolateAs != null && this._result.isolateAs.length > 0).toString(),
isTargetClusterSet: (this._result.targetCluster != null && this._result.targetCluster.length > 0).toString(),
isTargetNamespaceSet: (this._result.targetNamespace != null && this._result.targetNamespace.length > 0).toString(),
isContainerNameSet: (this._result.containerName != null && this._result.containerName.length > 0).toString(),
isCreatingNewLaunchConfiguration: this._isCreatingNewLaunchConfiguration
});
return this._isWizardComplete ? this._result as IWizardOutput : null;
}
}
Expand Down
5 changes: 0 additions & 5 deletions src/connect/ConnectWorkspaceFolder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ export class ConnectWorkspaceFolder extends WorkspaceFolderBase {
if (this._connectEnvFilePath != null && await fileSystem.existsAsync(this._connectEnvFilePath)) {
const content: string = await fileSystem.readFileAsync(this._connectEnvFilePath, `utf8`);
const env: any = JSON.parse(content);
this._logger.trace(TelemetryEvent.Connect_DebugConfigApplied);
for (const key of Object.keys(env)) {
debugConfiguration.env[key] = env[key];
}
Expand Down Expand Up @@ -416,11 +415,8 @@ export class ConnectWorkspaceFolder extends WorkspaceFolderBase {
}

this.setConnectStatus(ConnectionStatus.Disconnected);
this._logger.trace(TelemetryEvent.Connect_DisconnectSuccessful);
}
catch (error) {
this._logger.error(TelemetryEvent.Connect_DisconnectError, error);

if (previousStatus !== ConnectionStatus.Connected && error.code === `ECONNREFUSED`) {
// We weren't connected to the cluster, so we ignore the error.
this.setConnectStatus(ConnectionStatus.Disconnected);
Expand Down Expand Up @@ -521,7 +517,6 @@ export class ConnectWorkspaceFolder extends WorkspaceFolderBase {
}
await ThenableUtility.ToPromise(vscode.tasks.executeTask(connectTask));
vscode.window.showInformationMessage(`Once connected to the cluster, run your code manually to start debugging.`);
this._logger.trace(TelemetryEvent.Connect_StatusBarMenuConnectSuccess);
}
catch (error) {
this._logger.error(TelemetryEvent.Connect_StatusBarMenuConnectError, error);
Expand Down
1 change: 0 additions & 1 deletion src/debug/LocalTunnelDebuggingManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export class LocalTunnelDebuggingManager {

// Main entrypoint through the k8s.LocalTunnelDebugProvider API
private async startDebugSessionAsync(target?: any): Promise<void> {
this._logger.trace(TelemetryEvent.DebugLocalTunnel_SessionStarted);
const clusterExplorer = await k8s.extension.clusterExplorer.v1;

// Can't do `!clusterExplorer.available`, since for some reason the compiler complains about accessing the `reason` field below if we do.
Expand Down
Loading
Loading