Closed ersah123 closed 3 months ago
Hey :wave: for now you need to use some utils provided by nitro-applicationinsights/runtime
to add a header on all your external calls to correctly track your dependencies.
I did try to use wrapWithCorrelationContext
but it didn't worked for me (returning null when creating a correlation context) even though i was using container app and app services.
I may give it a try again later. Or we could also wait for node 22 LTS (21 is not going to be an LTS I think) to get AsyncLocalStorage support so we can trace everything automatically without azure's wrapWithCorrelationContext
. I'll probably start to implement this as an experimental feature to enable (only for node >=21). Note that AsyncLocalStorage is also an experimental feature in nitro.
The issue on #19 is indeed the fact that we can't correctly correlate traces automatically between incoming request (manually done here ) .
Thanks for clarifying, i have something working for now.
nitro-applicationinsights/runtime
didnt help me so far because it requires event and context object to be passed from my services. And also i need to use it for axios (interceptors) and graphql client too, i decided to pass it myself.
i have access to appInsights in components
if (process.server) {
const { ssrContext } = this.$nuxt.context;
appInsights = ssrContext.event.$appInsights;
}
then use it as :
appInsights.client.trackDependency({ ... })
Not sure it is the best way but it is working perfectly so far.
oh yeah, i also have an axios interceptor at work. Wasn't sure if it made sense to add it or if it was too much. I guess I can probably add an axios inteceptor in the utilities :)
Environment
All, azure app services
Reproduction
azure performance dashboard
Describe the bug
When i deploy this to azure app service, i see that my server side requests are not corelated. Or is it same issue as dependency issue created here? :https://github.com/huang-julien/nitro-applicationinsights/issues/19
I see this was implemented on legacy package here: https://github.com/nuxt-community/applicationinsights-module/blob/057714010160c4463423e41365bdd683787f492c/lib/runtime/nitro.js#L13C48-L13C66
Any idea how i can make it work?
Logs
Missing server side request calls