Q: Possible with v2 to have “sub instances” of AI?
See original GitHub issueThis wasn’t possible in v1 and I’ve been picking through the source of v2 but can’t tell if this is / isn’t possible. Today we are achieving this using a custom proxy, but we’re missing out on a lot of the OOTB AI functionality that we don’t want to dupe…
Scenario
A hosting web app (SharePoint) that can host multiple sub components (web parts). These sub components may be built by different people and collect their own telemetry.
Ideal situation is to have AI setup globally in SharePoint, then have the ability for a specific web part to have their telemetry sent to a different AI instance.
Looking at the plugin & initializer APIs, I see the instrumentationKey?
property… not clear if I can set a plugin that’s conditional checking for specific data in a telemetry post (event/trace/page view/exception/etc) to see if a different AI intrumentation key can be set conditionally for specific submissions to AI…
Doesn’t appear so… I recall this being a request in the past with v1 and can’t tell if it was implemented in v2 or if the scenario is possible with the new plugin arch.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (3 by maintainers)
Top GitHub Comments
Yes telemetry initializers are global, so adding one to each will have it run for every telemetry item outside of its intended scope. Ideally you have just one and it looks for some flag that is unique to telemetry generated by each particular subinstance.
Yes, you can use a telemetry initializer and modify the
ikey
field of the incoming item,ITelemetryItem
. https://github.com/microsoft/ApplicationInsights-JS/blob/96a5125a40229fb5c496a9a799d7deb26aa88b56/vNext/shared/AppInsightsCore/src/JavaScriptSDK.Interfaces/ITelemetryItem.ts#L24-L27