-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Agent-based monitoring causes _a.context is not a function error #17471
Comments
@rodolfograve thanks for reaching out! If I understand correctly things are working as expected locally and in deployment until you turn on Agent based Application Insights monitoring - correct? If so, I'm not too familiar with how Agent Based monitoring works - @hectorhdzg do you know who would be a good contact to look at this from the Application Insights team? It does sound like there's some dependency mismatch when using no-code monitoring but I wouldn't know where to begin. |
Thanks @maorleger. That is correct. Let me know if more information is needed. I'm looking forward to some solution to this issue :-) |
Any updates on this? At the very least I would expect some modifications need to be made to the documentation of Agent-based monitoring. If this is not the right place to ask, do you think you can point me in the right direction? Cheers |
I can confirm that disabling Agent-based monitoring fixes the issue. |
Issue is caused by Application Insights node.js SDK version loaded in the agent, to keep getting telemetry you can turn off Azure SDK automatic instrumentation using an App Setting like this one APPLICATION_INSIGHTS_NO_PATCH_MODULES=azuresdk https://github.com/microsoft/ApplicationInsights-node.js#automatic-third-party-instrumentation, we are working on updating Agent code to use latest version of the SDK where this already fixed but we don't have an ETA yet. |
We faced the same issue.
|
Same issue for us:
The issue started on Aug 21 ( or later Aug 20), app service deployed in EastUS2 region. |
@arc9693, @fwang0 please disable Azure SDK auto instrumentation with instructions provided here adding that will allow you to still get Application Insights telemetry, we are working on pushing newer version of the SDK to Azure App Services but this usually takes several weeks. Manually instrumenting the App with Application Insights latest version also will solve the issue but I understand is not always an option. |
@hectorhdzg Thanks! The instruction works for us. Please let us know when the new version of SDK is pushed to Azure App Services. |
Azure App Services should have version of the SDK with the fix |
Describe the bug
Attempting an operation that requires a token will fail if Agent-based monitoring is enabled on the App Service.
The exact same code works OK on a local development environment.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The operation successfully obtains the token from the credential and fails or succeeds according to the permissions of the account.
Related issues
There seem to be several related issues (#13798, #16056) but the fixes there rely on upgrading the version of the appinsights and/or opentelemetry modules. However, when using the Agent-based monitoring option the developers have no control over the version of those packages.
Additional context
Stack trace of the error
"TypeError: _a.context is not a function\n at Object.getSpanContext (/agents/node/node_modules/@opentelemetry/api/build/src/context/context.js:70:76)\n at getParent (/agents/node/node_modules/@opentelemetry/tracing/build/src/Tracer.js:101:16)\n at Tracer.startSpan (/agents/node/node_modules/@opentelemetry/tracing/build/src/Tracer.js:49:31)\n at Tracer.tracer.startSpan (/agents/node/node_modules/diagnostic-channel-publishers/dist/src/azure-coretracing.pub.js:55:44)\n at /home/site/wwwroot/node_modules/@azure/core-tracing/dist/index.js:471:29\n at DefaultAzureCredential.<anonymous> (/home/site/wwwroot/node_modules/@azure/identity/dist/index.js:247:58)\n at Generator.next (<anonymous>)\n at /home/site/wwwroot/node_modules/@azure/identity/node_modules/tslib/tslib.js:117:75\n at new Promise (<anonymous>)\n at Object.__awaiter (/home/site/wwwroot/node_modules/@azure/identity/node_modules/tslib/tslib.js:113:16)\n at DefaultAzureCredential.getToken (/home/site/wwwroot/node_modules/@azure/identity/dist/index.js:244:22)\n at tryGetAccessToken (/home/site/wwwroot/node_modules/@azure/core-http/dist/index.js:3800:56)\n at tryGetAccessToken (/home/site/wwwroot/node_modules/@azure/core-http/dist/index.js:3730:38)\n at beginRefresh (/home/site/wwwroot/node_modules/@azure/core-http/dist/index.js:3738:23)\n at refresh (/home/site/wwwroot/node_modules/@azure/core-http/dist/index.js:3803:29)\n at /home/site/wwwroot/node_modules/@azure/core-http/dist/index.js:3833:20\n at BearerTokenAuthenticationPolicy.sendRequest (/home/site/wwwroot/node_modules/@azure/core-http/dist/index.js:3859:37)\n at DisableResponseDecompressionPolicy.sendRequest (/home/site/wwwroot/node_modules/@azure/core-http/dist/index.js:4385:33)\n at ProxyPolicy.sendRequest (/home/site/wwwroot/node_modules/@azure/core-http/dist/index.js:4086:33)\n at LogPolicy.sendRequest (/home/site/wwwroot/node_modules/@azure/core-http/dist/index.js:2837:37)\n at DeserializationPolicy.sendRequest (/home/site/wwwroot/node_modules/@azure/core-http/dist/index.js:3020:33)\n at StorageRetryPolicy.attemptSendRequest (/home/site/wwwroot/node_modules/@azure/storage-blob/dist/index.js:14657:47)\n at StorageRetryPolicy.sendRequest (/home/site/wwwroot/node_modules/@azure/storage-blob/dist/index.js:14629:21)\n at StorageBrowserPolicy.sendRequest (/home/site/wwwroot/node_modules/@azure/storage-blob/dist/index.js:14544:37)\n at GenerateClientRequestIdPolicy.sendRequest (/home/site/wwwroot/node_modules/@azure/core-http/dist/index.js:3417:33)\n at TelemetryPolicy.sendRequest (/home/site/wwwroot/node_modules/@azure/storage-blob/dist/index.js:14893:33)\n at KeepAlivePolicy.sendRequest (/home/site/wwwroot/node_modules/@azure/core-http/dist/index.js:4230:33)\n at TracingPolicy.sendRequest (/home/site/wwwroot/node_modules/@azure/core-http/dist/index.js:4257:37)"},"msg":"undefined","time":"2021-09-06T08:31:37.314Z","v":0}
Output of
npm ls @opentelemetry/api
package.json
The text was updated successfully, but these errors were encountered: