Skip to content

Commit

Permalink
Merge branch 'master' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
hectorhdzg authored Jun 10, 2019
2 parents 5c30b00 + 96450e5 commit 04da5e7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand All @@ -281,9 +276,6 @@ export class ApplicationInsights implements IAppInsights, ITelemetryPlugin, IApp
properties,
systemProperties);

// set instrumentation key
this._setTelemetryNameAndIKey(telemetryItem);

this.core.track(telemetryItem);
}

Expand Down Expand Up @@ -384,7 +376,6 @@ export class ApplicationInsights implements IAppInsights, ITelemetryPlugin, IApp
customProperties,
systemProperties
);
this._setTelemetryNameAndIKey(telemetryItem);
this.core.track(telemetryItem);
}

Expand Down Expand Up @@ -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);
}
}

/**
Expand Down

0 comments on commit 04da5e7

Please sign in to comment.