Merge pull request #2115 from github/robertbrignull/cleanup_new_telemetry
Cleanup config to enabling new telemetry
This commit is contained in:
@@ -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(
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
@@ -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,67 +392,38 @@ describe("telemetry reporting", () => {
|
|||||||
expect(showInformationMessageSpy).toBeCalledTimes(1);
|
expect(showInformationMessageSpy).toBeCalledTimes(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("when new telementry is not enabled", () => {
|
it("should send a ui-interaction telementry event", async () => {
|
||||||
beforeEach(async () => {
|
await telemetryListener.initialize();
|
||||||
jest.spyOn(Config, "newTelemetryEnabled").mockReturnValue(false);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should not send a ui-interaction telementry event", async () => {
|
telemetryListener.sendUIInteraction("test");
|
||||||
await telemetryListener.initialize();
|
|
||||||
|
|
||||||
telemetryListener.sendUIInteraction("test");
|
expect(sendTelemetryEventSpy).toHaveBeenCalledWith(
|
||||||
|
"ui-interaction",
|
||||||
expect(sendTelemetryEventSpy).not.toBeCalled();
|
{
|
||||||
});
|
name: "test",
|
||||||
|
isCanary,
|
||||||
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", () => {
|
it("should send an error telementry event", async () => {
|
||||||
beforeEach(async () => {
|
await telemetryListener.initialize();
|
||||||
jest.spyOn(Config, "newTelemetryEnabled").mockReturnValue(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should send a ui-interaction telementry event", async () => {
|
telemetryListener.sendError(redactableError`test`);
|
||||||
await telemetryListener.initialize();
|
|
||||||
|
|
||||||
telemetryListener.sendUIInteraction("test");
|
expect(sendTelemetryEventSpy).toHaveBeenCalledWith(
|
||||||
|
"error",
|
||||||
expect(sendTelemetryEventSpy).toHaveBeenCalledWith(
|
{
|
||||||
"ui-interaction",
|
message: "test",
|
||||||
{
|
isCanary,
|
||||||
name: "test",
|
stack: expect.any(String),
|
||||||
isCanary,
|
},
|
||||||
},
|
{},
|
||||||
{},
|
);
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should send an error telementry event", async () => {
|
|
||||||
await telemetryListener.initialize();
|
|
||||||
|
|
||||||
telemetryListener.sendError(redactableError`test`);
|
|
||||||
|
|
||||||
expect(sendTelemetryEventSpy).toHaveBeenCalledWith(
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
message: "test",
|
|
||||||
isCanary,
|
|
||||||
stack: expect.any(String),
|
|
||||||
},
|
|
||||||
{},
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
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(
|
||||||
|
|||||||
Reference in New Issue
Block a user