Merge pull request #2115 from github/robertbrignull/cleanup_new_telemetry

Cleanup config to enabling new telemetry
This commit is contained in:
Robert
2023-03-03 14:13:47 +00:00
committed by GitHub
3 changed files with 23 additions and 66 deletions

View File

@@ -83,10 +83,6 @@ export const GLOBAL_ENABLE_TELEMETRY = new Setting(
GLOBAL_TELEMETRY_SETTING, GLOBAL_TELEMETRY_SETTING,
); );
export function newTelemetryEnabled(): boolean {
return true;
}
// Distribution configuration // Distribution configuration
const DISTRIBUTION_SETTING = new Setting("cli", ROOT_SETTING); const DISTRIBUTION_SETTING = new Setting("cli", ROOT_SETTING);
export const CUSTOM_CODEQL_PATH_SETTING = new Setting( export const CUSTOM_CODEQL_PATH_SETTING = new Setting(

View File

@@ -13,7 +13,6 @@ import {
LOG_TELEMETRY, LOG_TELEMETRY,
isIntegrationTestMode, isIntegrationTestMode,
isCanary, isCanary,
newTelemetryEnabled,
} from "./config"; } from "./config";
import * as appInsights from "applicationinsights"; import * as appInsights from "applicationinsights";
import { extLogger } from "./common"; import { extLogger } from "./common";
@@ -174,10 +173,6 @@ export class TelemetryListener extends ConfigListener {
return; return;
} }
if (!newTelemetryEnabled()) {
return;
}
this.reporter.sendTelemetryEvent( this.reporter.sendTelemetryEvent(
"ui-interaction", "ui-interaction",
{ {
@@ -196,10 +191,6 @@ export class TelemetryListener extends ConfigListener {
return; return;
} }
if (!newTelemetryEnabled()) {
return;
}
const properties: { [key: string]: string } = { const properties: { [key: string]: string } = {
isCanary: isCanary().toString(), isCanary: isCanary().toString(),
message: error.redactedMessage, message: error.redactedMessage,

View File

@@ -11,7 +11,6 @@ import {
} from "../../../src/telemetry"; } from "../../../src/telemetry";
import { UserCancellationException } from "../../../src/commandRunner"; import { UserCancellationException } from "../../../src/commandRunner";
import { ENABLE_TELEMETRY } from "../../../src/config"; import { ENABLE_TELEMETRY } from "../../../src/config";
import * as Config from "../../../src/config";
import { createMockExtensionContext } from "./index"; import { createMockExtensionContext } from "./index";
import { vscodeGetConfigurationMock } from "../test-config"; import { vscodeGetConfigurationMock } from "../test-config";
import { redactableError } from "../../../src/pure/errors"; import { redactableError } from "../../../src/pure/errors";
@@ -393,33 +392,6 @@ describe("telemetry reporting", () => {
expect(showInformationMessageSpy).toBeCalledTimes(1); expect(showInformationMessageSpy).toBeCalledTimes(1);
}); });
describe("when new telementry is not enabled", () => {
beforeEach(async () => {
jest.spyOn(Config, "newTelemetryEnabled").mockReturnValue(false);
});
it("should not send a ui-interaction telementry event", async () => {
await telemetryListener.initialize();
telemetryListener.sendUIInteraction("test");
expect(sendTelemetryEventSpy).not.toBeCalled();
});
it("should not send an error telementry event", async () => {
await telemetryListener.initialize();
telemetryListener.sendError(redactableError`test`);
expect(sendTelemetryEventSpy).not.toBeCalled();
});
});
describe("when new telementry is enabled", () => {
beforeEach(async () => {
jest.spyOn(Config, "newTelemetryEnabled").mockReturnValue(true);
});
it("should send a ui-interaction telementry event", async () => { it("should send a ui-interaction telementry event", async () => {
await telemetryListener.initialize(); await telemetryListener.initialize();
@@ -450,10 +422,8 @@ describe("telemetry reporting", () => {
{}, {},
); );
}); });
});
it("should redact error message contents", async () => { it("should redact error message contents", async () => {
jest.spyOn(Config, "newTelemetryEnabled").mockReturnValue(true);
await telemetryListener.initialize(); await telemetryListener.initialize();
telemetryListener.sendError( telemetryListener.sendError(