You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
API calls take some time. We have a use case where we'd like to capture some context at the beginning of the api call, and enrich the dependencies log with this context. We're finding that our current implementation is not using the public interface of app insights sdk and is pretty fragile.
Describe the solution you'd like
A way to hook into the start of the API call which app insights SDK has patch over the fetch and xhr functions. Then add some metadata to the telemetryItem object which would log as part of the "customDimensions"
Describe alternatives you've considered
Currently we do this by
patching over fetch and xhr functions in a similar way as the app insights sdk
in these patched functions we get the added "Request-Id" header that app insights adds, and use that as a key to add the context we want to enrich the log with, into a map.
so the map looks like {string: Context} where the string is the "Request-Id"
then in the telemetry initializer, we do a lookup in the map using telemetryItem.baseData.id to find the context and enrich the log
This is pretty fragile and isn't part of the interface of application insights sdk.
Additional context
Please feel free to contact me on teams (my alias is thoo) for more info
The text was updated successfully, but these errors were encountered:
Agree, I just went digging into the code to see if there would be an easier way than what you have already done and I can't find any other safer way that wouldn't get broken.
So yes, adding a callback to the config would probably be the easiest way to do this, and there are a couple of places in the code (_openHandler() and _createFetchRecord()) where it would make sense to have the callback called so the returned map could be added to the internal ajaxRecord, and them populated into the event -- which would still facilitate using a telemetryInitializer() to munge the data if required.
Is your feature request related to a problem? Please describe.
API calls take some time. We have a use case where we'd like to capture some context at the beginning of the api call, and enrich the dependencies log with this context. We're finding that our current implementation is not using the public interface of app insights sdk and is pretty fragile.
Describe the solution you'd like
A way to hook into the start of the API call which app insights SDK has patch over the fetch and xhr functions. Then add some metadata to the telemetryItem object which would log as part of the "customDimensions"
Describe alternatives you've considered
Currently we do this by
telemetryItem.baseData.id
to find the context and enrich the logThis is pretty fragile and isn't part of the interface of application insights sdk.
Additional context
Please feel free to contact me on teams (my alias is thoo) for more info
The text was updated successfully, but these errors were encountered: