Skip to content
Merged
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
8 changes: 5 additions & 3 deletions extensions/ql-vscode/src/common/vscode/telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { showBinaryChoiceWithUrlDialog } from "./dialog";
import type { RedactableError } from "../errors";
import type { SemVer } from "semver";
import type { AppTelemetry } from "../telemetry";
import type { EnvelopeTelemetry } from "applicationinsights/out/Declarations/Contracts";

// Key is injected at build time through the APP_INSIGHTS_KEY environment variable.
const key = "REPLACE-APP-INSIGHTS-KEY";
Expand Down Expand Up @@ -128,12 +129,13 @@ export class ExtensionTelemetryListener
);
this.push(this.reporter);

const client = (this.reporter as any).appInsightsClient as TelemetryClient;
// The appInsightsClient field is private but we want to access it anyway
const client = this.reporter["appInsightsClient"] as TelemetryClient;
if (client) {
// add a telemetry processor to delete unwanted properties
client.addTelemetryProcessor((envelope: any) => {
client.addTelemetryProcessor((envelope: EnvelopeTelemetry) => {
tagsToRemove.forEach((tag) => delete envelope.tags[tag]);
const baseDataProperties = (envelope.data as any)?.baseData?.properties;
const baseDataProperties = envelope.data.baseData?.properties;
if (baseDataProperties) {
baseDataPropertiesToRemove.forEach(
(prop) => delete baseDataProperties[prop],
Expand Down