ApplicationInsights-JS icon indicating copy to clipboard operation
ApplicationInsights-JS copied to clipboard

Add `context` to `addTelemetryInitializer` callback?

Open dotansimha opened this issue 6 years ago • 3 comments

In https://github.com/microsoft/ApplicationInsights-node.js , you can modify the telemetry using addTelemetryProcessor which executed with envelop and context (the context changes according to the collected data, for example: the req/res for HTTP requests).

Any chance we can do the same for this library? :)

dotansimha avatar Sep 03 '19 06:09 dotansimha

Yep, ideally this SDK should share, as much as possible, an API/feature surface with the node.js SDK. I'll add this to our backlog

markwolff avatar Sep 03 '19 22:09 markwolff

Thanks @markwolff ! I can create a PR to add it, can you maybe just point me to the code that manages that?

dotansimha avatar Sep 04 '19 12:09 dotansimha

@dotansimha It would be inside the "analytics plugin". Here is the entry point (you will also need to update the same function located in AISKU/Initialization.ts to match the interface change). https://github.com/microsoft/ApplicationInsights-JS/blob/9705984134fcc5244bc5f6838163d766a8be5744/vNext/extensions/applicationinsights-analytics-js/src/JavaScriptSDK/ApplicationInsights.ts#L455-L457

This plugin already has "context" available to it via this._properties.context, so I believe the change will just be updating the interface and passing the new argument https://github.com/microsoft/ApplicationInsights-JS/tree/master/vNext/extensions/applicationinsights-properties-js/src/Context

markwolff avatar Sep 04 '19 15:09 markwolff