-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Update Azure Functions guide to use OpenTelemetry #15568
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
base: master
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
Bundle ReportChanges will decrease total bundle size by 214.05kB (-0.61%) ⬇️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: sentry-docs-client-array-pushAssets Changed:
view changes for bundle: sentry-docs-server-cjsAssets Changed:
|
| .AddSentry() // <-- Configure OpenTelemetry to send traces to Sentry | ||
| .AddAspNetCoreInstrumentation() // From OpenTelemetry.Instrumentation.AspNetCore... adds automatic tracing for incoming requests | ||
| .AddHttpClientInstrumentation() // From OpenTelemetry.Instrumentation.Http... adds automatic tracing for outgoing HTTP requests | ||
| .Build(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: TracerProvider created outside host service collection
The tracerProvider is created as a standalone local variable using using var instead of being registered with the Azure Functions host's service collection. This means the tracer provider won't be accessible to the Azure Functions runtime, and the instrumentation methods like AddAspNetCoreInstrumentation() and AddHttpClientInstrumentation() won't function correctly because they require integration with the host's dependency injection container to intercept requests and responses. The tracer provider should be added through ConfigureServices on the HostBuilder, similar to how ASP.NET Core uses builder.Services.AddOpenTelemetry().
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this code example is (almost) the same as in the sample linked at the bottom of the page
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is yes... that's the point, and the reason for:
If I add the trace builder as a service, as suggested by cursor, we end up with double telemetry for some reason... which is the reason I didn't simply do that.
Flash0ver
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe there is an issue with the 'performance' product button.
See https://github.com/getsentry/sentry-docs/pull/15568/files#r2565809885.
DESCRIBE YOUR PR
Resolves getsentry/sentry-dotnet#4726
See also:
IS YOUR CHANGE URGENT?
SLA
cc: @Flash0ver
PRE-MERGE CHECKLIST