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

In Jaeger I get "unknown_service:dotnet" and "Duplicate tag "peer.service:"

Open SVronskiy opened this issue 3 years ago • 11 comments

List of NuGet packages and version that you are using: "OpenTelemetry.Exporter.Console" Version="1.1.0-beta1" /> "OpenTelemetry.Exporter.Jaeger" Version="1.0.1" /> "OpenTelemetry.Exporter.Zipkin" Version="1.0.1" /> "OpenTelemetry.Extensions.Hosting" Version="1.0.0-rc4" /> "OpenTelemetry.Instrumentation.AspNetCore" Version="1.0.0-rc4" /> "OpenTelemetry.Instrumentation.Http" Version="1.0.0-rc4" /> "OpenTelemetry.Instrumentation.SqlClient" Version="1.0.0-rc4" />

Runtime version netcoreapp2.2

Question

In Jaeger I get "unknown_service:dotnet" and "Duplicate tag "peer.service:"

image

Describe your environment.

Startup.cs:

services.AddOpenTelemetryTracing((builder) => builder
    .AddAspNetCoreInstrumentation()
    .AddHttpClientInstrumentation()
    .AddSqlClientInstrumentation()
    .AddZipkinExporter(options =>
    {
        options.Endpoint = new Uri("http://zipkin.istio-system:9411/api/v2/spans");
    })
    );

Run application under kubernetes 1.18, jaegertracing/all-in-one:1.20, istio 1.9.2.

What are you trying to achieve?

What did you expect to see?

I'de like to have name situated in "peer.service" instead of unknown_service:dotnet, on my screen it should be "content".

Additional Context

Problem is similar to described here: #2584 span.kind & peer.service

I still do not have any idea how to fix it. Could you help me, please.

SVronskiy avatar May 03 '21 16:05 SVronskiy

To set the name from unknown_service to something descriptive:

public void ConfigureServices(IServiceCollection services)
{
    // ... snip ...
    services.AddOpenTelemetryTracing((builder) => {
        builder
            .SetResourceBuilder(ResourceBuilder
                .CreateDefault()
                .AddService(env.ApplicationName)) // <-- sets service name
            .AddAspNetCoreInstrumentation();
            // .AddMoreThings :D
    // ... snip ...
}

robrich avatar May 09 '21 05:05 robrich

Hello, @robrich!

Thank you for reply! Anfortunitely this is not a solution.

Above source code will return "env.ApplicationName" anythere, but we need to get text "google.com", "yandex.ru" etc according to url in httpclient, Take a look at at second screenshots at #2584 span.kind & peer.service - this is how it should work.

SVronskiy avatar May 09 '21 05:05 SVronskiy

I am having exact same issue, getting warning for duplicate tag "peer.service". @SVronskiy Can we mark this as bug rather than question. I just want to get rid of warning message.

ElectricVampire avatar May 21 '21 06:05 ElectricVampire

@ElectricVampire I do not have option to change issue kind ((

SVronskiy avatar Jun 23 '21 09:06 SVronskiy

Can anyone share a repro code which results in duplicate peer.service tags?

cijothomas avatar Jun 23 '21 19:06 cijothomas

@cijothomas Any trace going to DB or another API will show the warning of duplicate peer.service tag on jaeger UI if we use Zipkin exporter with http(s) endpoint on 9411 port. .AddZipkinExporter(options => { options.Endpoint = new Uri("http://zipkin.istio-system:9411/api/v2/spans"); })

ElectricVampire avatar Jun 24 '21 02:06 ElectricVampire

Can anyone share a repro code which results in duplicate peer.service tags?

@cijothomas, I reproduced the Duplicate tag "peer.service:localhost:5001" in this example. Maybe that's not an issue, but it could be a wrong setup. It happened with me when I used the AddZipkinExporter method instead of using AddJaegerExporter:

with-zipkin-exporter

changing to AddJaegerExporter the duplicate tag warning stopped to appear:

with-jaeger-exporter

@ElectricVampire and @SVronskiy, as you're using the Jaeger UI, did you tried to use the AddJaegerExporter method?

luizhlelis avatar Jul 17 '21 01:07 luizhlelis

@luizhlelis it works with JaegerExporter but jaegerExporter has limitation that it doesn't support Http or grpc(https://github.com/open-telemetry/opentelemetry-dotnet/issues/2054) hence using ZipkinExporter which does support Http.

Jaeger has a port open for Zipkin traces as well (https://www.jaegertracing.io/docs/1.17/features/#backwards-compatibility-with-zipkin), hence we can still use ZipkinExporter for JaegerUI, so I would not say this as invalid configuration.

ElectricVampire avatar Jul 19 '21 07:07 ElectricVampire

To set the name from unknown_service to something descriptive:

public void ConfigureServices(IServiceCollection services)
{
    // ... snip ...
    services.AddOpenTelemetryTracing((builder) => {
        builder
            .SetResourceBuilder(ResourceBuilder
                .CreateDefault()
                .AddService(env.ApplicationName)) // <-- sets service name
            .AddAspNetCoreInstrumentation();
            // .AddMoreThings :D
    // ... snip ...
}

@robrich , is there any particular reason why using the application name is not already the default when calling the OTel hosting extensions?

I've configured the instrumentation in a couple services here and only realized later how bad the default name really is.

julealgon avatar Jul 18 '22 20:07 julealgon

@julealgon I agree, I think making the name more descriptive by default would be wonderful.

robrich avatar Jul 19 '22 01:07 robrich

I just quickly scrolled through the issue and it looks related to this one https://github.com/open-telemetry/opentelemetry-dotnet/issues/2781

pellared avatar Jul 19 '22 05:07 pellared