microsoft / ApplicationInsights-JS

Microsoft Application Insights SDK for JavaScript
MIT License
650 stars 240 forks source link

[BUG] AI (Internal): 72 tracking #2028

Closed koyar closed 8 months ago

koyar commented 1 year ago

Description/Screenshot AI (Internal): 72 is being treated as a critical error. I don't think userAgent tracking should be defined as this. There is no way to disable this from being logged without disabling all telemetry.

Steps to Reproduce https://github.com/microsoft/ApplicationInsights-JS/blob/0c76d710a0cd465f0b8b5e143250898122511874/extensions/applicationinsights-properties-js/src/PropertiesPlugin.ts#L97-#L100

Expected behavior This should only go to AI if loggingLevelTelemetry is set to 2 (track everything)

Additional context Others also having an issue

MSNev commented 1 year ago

Thanks for creating this Issue, as we had not been made aware of this being a general issue from the community.

We will review and determine a method (config) for disabling this internal message.

This message should not be incurring any charges on your account, but I understanding that it may be frustrating being present in your logs.

Some background

This was created as an internal message so that we have an insight into the browser versions that consumers of the SDK use. Which is how we have been identifying that we can now (as part of the upcoming v3 (beta)) drop ES3 support as the level of usage is low enough to leave those users on v2 while still providing more updated language usage in v3.

This specific message is also gated on when a new ai_user cookie is created which has a lifespan of 1 year, so the frequency of this message (assuming cookies are enabled) is limited to 1 request per user per year, so that it did not overload anyones data store.

This is classified as an internal message so that we have some limited access to view a percentage of this anonymous information, we don't have access to any other events flowing through the system. And all events sent to your connection string / instrumentation key are always sent and present in your events stream / tables.

koyar commented 1 year ago

@MSNev - Thank you for the update on this. Would it be possible to ensure config for any of the AI Internal messages? We are seeing examples of AI (Internal): 55 , AI (Internal): 42, AI (Internal): 67 (assume there is no charge for these)

MSNev commented 1 year ago

Well, depending on the number of ajax (XHR/fetch) requests you are making you may want to increase the config value, because if your getting this message then you are loosing Ajax events.

Another option came to mind this morning (after reading your latest comment), because all events (including these) pass the standard pipeline you could provide a telemetry initializer to intercept the event and when you detect this type of event simply return false and the event won't be sent

MSNev commented 1 year ago

ie. you could do this now without waiting for us to add config 😄

koyar commented 1 year ago

Thanks for your comment @MSNev. I will look into that

MSNev commented 1 year ago

@siyuniu-ms This is related to the internal task Task 24666531: [AI] Disable the UserAgent AI Internal by default