opentelemetry-dotnet icon indicating copy to clipboard operation
opentelemetry-dotnet copied to clipboard

Filter Processor causes exported spans to lose `ResourceDefinition` information in Jaeger

Open Aaronontheweb opened this issue 3 years ago • 2 comments

Bug Report

<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.0.0-rc9.4" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.0.0-rc9.4" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.0.0-rc9.4" />
<PackageReference Include="OpenTelemetry.Exporter.Jaeger" Version="1.0.1" />
<PackageReference Include="OpenTelemetry.Exporter.Prometheus" Version="1.2.0-rc5" />

Runtime version: .NET 6.0

Symptom

When using the a filter CompositeProcessor<Activity> that is nearly identical to what's included in the OpenTelemetry .NET documentation:

https://github.com/open-telemetry/opentelemetry-dotnet/blob/4310e08afdd3a6d2533836c3d71a6f56cf3148ef/docs/trace/extending-the-sdk/MyFilteringProcessor.cs#L34-L53

I compose my OpenTelemetry tracing integration like so:

var resource = ResourceBuilder.CreateDefault()
            .AddService(Assembly.GetEntryAssembly().GetName().Name, serviceInstanceId: $"{Dns.GetHostName()}");

        // enables OpenTelemetry for ASP.NET / .NET Core
        services.AddOpenTelemetryTracing(builder =>
        {
            builder
                .SetResourceBuilder(resource)
                .AddPhobosInstrumentation()
                .AddHttpClientInstrumentation()
                .AddAspNetCoreInstrumentation()
                .AddProcessor(new ExcludeShardingProcessor(new[]
                    { new SimpleActivityExportProcessor(new JaegerExporter(new JaegerExporterOptions())) }));
        });

The filter works as expected - however, I lose all of my ResourceBuilder information and see this instead:

image

What is the expected behavior?

I expected to see my resource data, which I could see before I added the CompositeProcessor<Activity> to my pipeline:

image

What is the actual behavior?

image - none of my ResourceDefinition data is present on the traces.

Reproduce

Run https://github.com/open-telemetry/opentelemetry-dotnet/blob/4310e08afdd3a6d2533836c3d71a6f56cf3148ef/docs/trace/extending-the-sdk/Program.cs#L24-L50 with the MyFilteringProcessor wrapped around a JaegerExporter.

Aaronontheweb avatar Aug 24 '22 21:08 Aaronontheweb

https://github.com/open-telemetry/opentelemetry-dotnet/issues/3241 same? Has a fix in latest alpha.

cijothomas avatar Aug 24 '22 21:08 cijothomas

#3241 same? Has a fix in latest alpha.

totally missed that issue - I can check

Aaronontheweb avatar Aug 24 '22 21:08 Aaronontheweb

Closing as this is expected to be fixed. Feel free to reopen if that was not the issue here.

cijothomas avatar Feb 28 '23 17:02 cijothomas