Farid
Farid

Reputation: 1020

Jaeger not receiving any OpenTelemetry trace

So I'm trying send OpenTelemetry trace back to Jaeger. I've tried sending the traces to console and it works. But I'm not getting anything when sending it to Jaeger.

builder.Services.AddOpenTelemetryTracing(b =>
{
    b.SetResourceBuilder(ResourceBuilder.CreateDefault().AddService("ServiceA"))
        .AddSource("TelemetryDemo")
        .AddHttpClientInstrumentation()
        .AddAspNetCoreInstrumentation()
        .AddOtlpExporter(o =>
        {
            o.Endpoint = new Uri("http://localhost:4317");
            o.ExportProcessorType = ExportProcessorType.Simple;
        })
        .AddConsoleExporter();
});

I'm running Jaeger's All-in-One from Docker hub: https://hub.docker.com/r/jaegertracing/all-in-one

This is the command that I'm running: docker run -d --name jaeger -p 16686:16686 -p 6831:6831/udp -p 4317:4317 -p 55680:55680 jaegertracing/all-in-one

The traces is showing on the console, but when I open Jaeger's dashboard, I got nothing. What is wrong here?

Edit: Figured it out. Jaeger has 2 Docker images: one that is Otel-compliant, and one that is not. In this question I was using the one that is not, so that is why the Otlp Exporter did not work.

I have since changed to use the OTel-compliant image in https://hub.docker.com/r/jaegertracing/opentelemetry-all-in-one/ (notice this one has "OTEL" name in it)

Upvotes: 6

Views: 11318

Answers (2)

Juliano Costa
Juliano Costa

Reputation: 2733

Update 05/2023

For .net you need something like this:

.AddOtlpExporter(otlpOptions =>
{
    otlpOptions.Endpoint = new Uri("http://localhost:4317");
})

More details about that in here: https://opentelemetry.io/docs/instrumentation/net/exporters/#otlp-endpoint

With that set in your .NET app, you can either spin up a Jaeger All-in-one container, explained here: https://www.jaegertracing.io/docs/1.45/getting-started/#all-in-one

Or send the trace through the OTel Collector, with the following Collector config:

receivers:
  otlp:
    protocols:
      grpc:
      http:

exporters:
  otlp:
    endpoint: "jaeger:4317"
    tls:
      insecure: true
  logging:
    loglevel: debug

service:
  pipelines:
    traces:
      receivers: [otlp]
      processors: []
      exporters: [logging,otlp]

Old answer

You need to use the JaegerExporter or send the traces to a otel-collector and from the collector to Jaeger.
For .net you need something like this:

.AddJaegerExporter(o =>
    {
        o.AgentHost = "localhost";
        o.AgentPort = 14250;
    })

Make sure you expose the Jaeger port to your localhost.

That's the easiest way, and you can stop here if you want.

But if you think about changing the backend in the future, maybe it would be a good idea to invest some time in configuring the otel-collector now.

OTel-collector docs

You would need a conf.yml like this (logging is optional in this case):

receivers:
  otlp:
    protocols:
      grpc:
      http:

exporters:
  jaeger:
    endpoint: "jaeger:14250"
    tls:
      insecure: true
  logging:
    loglevel: debug

service:
  pipelines:
    traces:
      receivers: [otlp]
      processors: []
      exporters: [logging,jaeger]

And your collector Dockerfile would be something like this:

FROM otel/opentelemetry-collector-contrib:0.48.0
COPY conf.yml .
EXPOSE 1888
EXPOSE 8888
EXPOSE 8889
EXPOSE 13133
EXPOSE 4317
EXPOSE 55670
CMD [ "--config=conf.yml" ]

You can send the trace to the collector, the collector will receive OTLP and will send to Jaeger.
In this 2nd scenario, you can continue using "http://localhost:4317" if you configure your collector to expose its ports to localhost.

Upvotes: 1

Akhilesh
Akhilesh

Reputation: 141

I believe as of 2022, the AIO image does support OTLP. Try running the docker container using below

docker run -d --name jaeger \
  -e COLLECTOR_ZIPKIN_HOST_PORT=:9411 \
  -e COLLECTOR_OTLP_ENABLED=true \
  -p 6831:6831/udp \
  -p 6832:6832/udp \
  -p 5778:5778 \
  -p 16686:16686 \
  -p 4317:4317 \
  -p 4318:4318 \
  -p 14250:14250 \
  -p 14268:14268 \
  -p 14269:14269 \
  -p 9411:9411 \
  jaegertracing/all-in-one:<version>

Replace with whatever version of image you have. I tried with 1.37

Upvotes: 4

Related Questions