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
I wanted to bring it up again, as I've found what I think is a quite "correct" solution, and I want to discuss whether and how to incorporate or document it in this repo. This solution differs from previous solutions in that it works with the setAutoCollectIncomingRequestAzureFunctions(true) option of application insights for node.
The first part of the solution is to provide the correct URL to Application Insights by setting a custom property on the correlation context. This can be done in a handle hook with the following code:
I think we should consider implementing this in the adapter with an opt-in configuration option. Another option would be to document it in the README.
Another small note on application insights and SWA: If you enable application insights integration for the SWA, SWA will log every request to AI before they reach your function. The two entries for each request will have the same value in the id field, so they can be correlated together. From what I've found, there is no hope of customizing the logging done by SWA. However, the logging from SWA gives GeoIP information about the user which is not available to AI in node it seems. Because of this, I think it makes most sense to use both, and have some queries which automatically correlates them.
The text was updated successfully, but these errors were encountered:
I'm open to having this in the adapter itself, if you're willing to submit a PR. Having accurate URLs in App Insights is important.
If I'm understanding correctly, we'd want to add this code to entry.js?
the CorrelationContextManager bit would run on each request
the telemetry processor would run during startup
If we do have this be opt-in config, how do we make it so the applicationinsights package is an optional dependency and only included for apps that opted-in?
My main goal for any implementation would be to minimize the need to add additional config/extensibility to any integration - ideally you could just toggle this config on to get the correct URL and do any further App Insights customization in your own app, instead of the adapter needing to expose additional config/hooks.
This has been covered before in #30 and #126.
I wanted to bring it up again, as I've found what I think is a quite "correct" solution, and I want to discuss whether and how to incorporate or document it in this repo. This solution differs from previous solutions in that it works with the
setAutoCollectIncomingRequestAzureFunctions(true)
option of application insights for node.The first part of the solution is to provide the correct URL to Application Insights by setting a custom property on the correlation context. This can be done in a handle hook with the following code:
To actually set this as the URL in application insights, we need to add a telemetry processor like this sometime during startup:
I think we should consider implementing this in the adapter with an opt-in configuration option. Another option would be to document it in the README.
Another small note on application insights and SWA: If you enable application insights integration for the SWA, SWA will log every request to AI before they reach your function. The two entries for each request will have the same value in the
id
field, so they can be correlated together. From what I've found, there is no hope of customizing the logging done by SWA. However, the logging from SWA gives GeoIP information about the user which is not available to AI in node it seems. Because of this, I think it makes most sense to use both, and have some queries which automatically correlates them.The text was updated successfully, but these errors were encountered: