Skip to content
Discussion options

You must be logged in to vote

Following code taken from the examples and adjusted, it is for AspNetCore, but similar construction should working in another hosting stuff:

appBuilder.Services.AddOpenTelemetry()
    .ConfigureResource(r => r
        .AddService(
            serviceName: appBuilder.Configuration.GetValue("ServiceName", defaultValue: "otel-test"),
            serviceVersion: typeof(Program).Assembly.GetName().Version?.ToString() ?? "unknown",
            serviceInstanceId: Environment.MachineName))
    .WithTracing(builder =>
    {
        // Tracing

        // Ensure the TracerProvider subscribes to any custom ActivitySources.
        builder
            .AddSource(InstrumentationSource.ActivitySourceName)

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@andrew-vdb
Comment options

@Kielek
Comment options

@andrew-vdb
Comment options

@Kielek
Comment options

Answer selected by andrew-vdb
@andrew-vdb
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants