From 96450e5aaf6f44f713023b358b2394f4a334b115 Mon Sep 17 00:00:00 2001 From: Mark Wolff Date: Mon, 10 Jun 2019 11:27:16 -0700 Subject: [PATCH] analytics: remove ikey setter (#927) * analytics: remove unneeded setNameAndIkey * tests: ikey no longer set in analyics plugin --- .../Tests/ApplicationInsights.tests.ts | 4 ++-- .../src/JavaScriptSDK/ApplicationInsights.ts | 17 ----------------- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/vNext/extensions/applicationinsights-analytics-js/Tests/ApplicationInsights.tests.ts b/vNext/extensions/applicationinsights-analytics-js/Tests/ApplicationInsights.tests.ts index d3dcbfc73..917b12368 100644 --- a/vNext/extensions/applicationinsights-analytics-js/Tests/ApplicationInsights.tests.ts +++ b/vNext/extensions/applicationinsights-analytics-js/Tests/ApplicationInsights.tests.ts @@ -169,8 +169,8 @@ export class ApplicationInsightsTests extends TestClass { var test = (action, expectedEnvelopeType, expectedDataType, test?: () => void) => { action(); envelope = this.getFirstResult(action, trackStub); - Assert.equal(iKey, envelope.iKey, "envelope iKey"); - Assert.equal(expectedEnvelopeType.replace("{0}", iKeyNoDash), envelope.name, "envelope name"); + Assert.equal("", envelope.iKey, "envelope iKey"); + Assert.equal(expectedEnvelopeType, envelope.name, "envelope name"); Assert.equal(expectedDataType, envelope.baseType, "data type name"); if (typeof test === 'function') {test();} trackStub.reset(); diff --git a/vNext/extensions/applicationinsights-analytics-js/src/JavaScriptSDK/ApplicationInsights.ts b/vNext/extensions/applicationinsights-analytics-js/src/JavaScriptSDK/ApplicationInsights.ts index ab4dcd532..1a5c3d311 100644 --- a/vNext/extensions/applicationinsights-analytics-js/src/JavaScriptSDK/ApplicationInsights.ts +++ b/vNext/extensions/applicationinsights-analytics-js/src/JavaScriptSDK/ApplicationInsights.ts @@ -119,7 +119,6 @@ export class ApplicationInsights implements IAppInsights, ITelemetryPlugin, IApp customProperties ); - this._setTelemetryNameAndIKey(telemetryItem); this.core.track(telemetryItem); } catch (e) { this._logger.throwInternal(LoggingSeverity.WARNING, @@ -176,7 +175,6 @@ export class ApplicationInsights implements IAppInsights, ITelemetryPlugin, IApp this._logger, customProperties); - this._setTelemetryNameAndIKey(telemetryItem); this.core.track(telemetryItem); } catch (e) { this._logger.throwInternal(LoggingSeverity.WARNING, @@ -207,7 +205,6 @@ export class ApplicationInsights implements IAppInsights, ITelemetryPlugin, IApp customProperties ); - this._setTelemetryNameAndIKey(telemetryItem); this.core.track(telemetryItem); } catch (e) { this._logger.throwInternal(LoggingSeverity.CRITICAL, @@ -259,8 +256,6 @@ export class ApplicationInsights implements IAppInsights, ITelemetryPlugin, IApp properties, systemProperties); - // set instrumentation key - this._setTelemetryNameAndIKey(telemetryItem); this.core.track(telemetryItem); // reset ajaxes counter @@ -281,9 +276,6 @@ export class ApplicationInsights implements IAppInsights, ITelemetryPlugin, IApp properties, systemProperties); - // set instrumentation key - this._setTelemetryNameAndIKey(telemetryItem); - this.core.track(telemetryItem); } @@ -384,7 +376,6 @@ export class ApplicationInsights implements IAppInsights, ITelemetryPlugin, IApp customProperties, systemProperties ); - this._setTelemetryNameAndIKey(telemetryItem); this.core.track(telemetryItem); } @@ -635,14 +626,6 @@ export class ApplicationInsights implements IAppInsights, ITelemetryPlugin, IApp this.core.track(telemetryItem); } - - // Mutate telemetryItem inplace to add boilerplate iKey & name info - private _setTelemetryNameAndIKey(telemetryItem: ITelemetryItem): void { - telemetryItem.iKey = this._globalconfig.instrumentationKey; - - var iKeyNoDashes = this._globalconfig.instrumentationKey.replace(/-/g, ""); - telemetryItem.name = telemetryItem.name.replace("{0}", iKeyNoDashes); - } } /**