-
Notifications
You must be signed in to change notification settings - Fork 2
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
Configuring when not using UseAzureMonitor() #20
Comments
My current take:
|
So question basically boils down to - if I do not call |
@christophwille Thanks for the feedback. As of today, the part that we rely on is in OpenTelemetry for .NET. In theory, you should be fine (of course, connection string is still needed for profiler to work). That said, this is actually an interesting scenario that you are using more than just 1 exporter for different parts. We probably should have some sort of probe in the bootstrap to making sure the necessary services are registered. |
Examples of things we do:
A slightly outdated version (PoC) of some of this can be found at https://github.com/christophwille/OTel-de-Wille/blob/main/aspnet-aspiredashboard/WebApplicationBuilderExtensions.cs |
Hey @christophwille, how about something like this? builder.Services.AddOpenTelemetry().ConfigureResource(resource => resource.AddService(serviceName))
.WithTracing(tracerProviderBuilder =>
{
tracerProviderBuilder.AddAspNetCoreInstrumentation()
.AddAzureMonitorTraceExporter()
.UseProfiler(); // Enable profiler
}); |
Actually, we now built two code paths - one for standard OTel, one for UseAzureMonitor.
is where we call methods that are used in both code paths.
That got us the rest of the way. It is ugly, but at least we got away without duplication. |
We are not using
builder.Services.AddOpenTelemetry().UseAzureMonitor();
but the following approach:(Reason: based on flags, we also sometimes - esp. locally - send to
AddOtlpExporter();
)Should we tack on it at the very end or what is recommended / expected way in such a configuration scenario? (I will admit that UseAzureMonitor as convenient as it might be is slightly a headache when you export to multiple places)
The text was updated successfully, but these errors were encountered: