From 556fa8dd33aa507fd1f38f569fe0b1bd059d0feb Mon Sep 17 00:00:00 2001 From: Iku-turso Date: Thu, 2 Mar 2023 15:00:37 +0200 Subject: [PATCH] Drop support for adding telemetry by tagging This was not used, and would make development of future feature more difficult. Co-authored-by: Janne Savolainen Signed-off-by: Iku-turso --- ...metry-from-specific-function-calls.test.ts | 33 ++----------------- .../telemetry-decorator.injectable.ts | 1 - 2 files changed, 3 insertions(+), 31 deletions(-) diff --git a/packages/core/src/features/telemetry/emit-telemetry-from-specific-function-calls.test.ts b/packages/core/src/features/telemetry/emit-telemetry-from-specific-function-calls.test.ts index 961647fa29..cff5b183a8 100644 --- a/packages/core/src/features/telemetry/emit-telemetry-from-specific-function-calls.test.ts +++ b/packages/core/src/features/telemetry/emit-telemetry-from-specific-function-calls.test.ts @@ -28,18 +28,15 @@ describe("emit-telemetry-from-specific-function-calls", () => { di.override(emitEventInjectable, () => emitEventMock); }); - describe("given instances of white-listed, non-white-listed and tagged functions", () => { + describe("given instances of white-listed, non-white-listed", () => { let whiteListedFunctionMock: jest.Mock; let nonWhiteListedFunctionMock: jest.Mock; - let taggedFunctionMock: jest.Mock; let injectedWhiteListedFunction: jest.Mock; let injectedNonWhiteListedFunction: jest.Mock; - let injectedTaggedFunction: jest.Mock; beforeEach(() => { whiteListedFunctionMock = jest.fn(); nonWhiteListedFunctionMock = jest.fn(); - taggedFunctionMock = jest.fn(); const whiteListedInjectable = getInjectable({ id: "some-white-listed-function", @@ -51,28 +48,19 @@ describe("emit-telemetry-from-specific-function-calls", () => { instantiate: () => nonWhiteListedFunctionMock, }); - const taggedInjectable = getInjectable({ - id: "some-tagged-function", - instantiate: () => taggedFunctionMock, - tags: ["emit-telemetry"], - }); - runInAction(() => { - di.register(whiteListedInjectable); - di.register(nonWhiteListedInjectable); - di.register(taggedInjectable); + di.register(whiteListedInjectable, nonWhiteListedInjectable); }); injectedWhiteListedFunction = di.inject(whiteListedInjectable); injectedNonWhiteListedFunction = di.inject(nonWhiteListedInjectable); - injectedTaggedFunction = di.inject(taggedInjectable); }); it("telemetry is not emitted yet", () => { expect(emitEventMock).not.toHaveBeenCalled(); }); - describe("when the white-listed function is called", () => { + describe("when the white-listed function is called with parameters", () => { beforeEach(() => { injectedWhiteListedFunction("some-arg", "some-other-arg"); }); @@ -126,21 +114,6 @@ describe("emit-telemetry-from-specific-function-calls", () => { expect(emitEventMock).not.toHaveBeenCalled(); }); }); - - describe("when the tagged, but not white-listed function is called", () => { - beforeEach(() => { - injectedTaggedFunction("some-arg", "some-other-arg"); - }); - - it("telemetry is emitted in event bus", () => { - expect(emitEventMock).toHaveBeenCalledWith({ - destination: "auto-capture", - action: "telemetry-from-business-action", - name: "some-tagged-function", - params: { args: ["some-arg", "some-other-arg"] }, - }); - }); - }); }); }); }); diff --git a/packages/core/src/features/telemetry/renderer/telemetry-decorator.injectable.ts b/packages/core/src/features/telemetry/renderer/telemetry-decorator.injectable.ts index e1a614660c..2c7e817918 100644 --- a/packages/core/src/features/telemetry/renderer/telemetry-decorator.injectable.ts +++ b/packages/core/src/features/telemetry/renderer/telemetry-decorator.injectable.ts @@ -63,7 +63,6 @@ const telemetryDecoratorInjectable = getInjectable({ const shouldEmitTelemetryFor = (whiteList: string[]) => (injectable: Injectable) => - injectable.tags?.includes("emit-telemetry") || whiteList.includes(injectable.id); export default telemetryDecoratorInjectable;