rehansaeed.github.io icon indicating copy to clipboard operation
rehansaeed.github.io copied to clipboard

[Comment] Exporting Open Telemetry Data to Jaeger

Open RehanSaeed opened this issue 4 years ago • 7 comments

https://rehansaeed.com/exporting-open-telemetry-data-to-jaeger/

RehanSaeed avatar Feb 11 '21 10:02 RehanSaeed

I ran the docker for jaeger with following command as given in the post docker run --name jaeger -p 13133:13133 -p 16686:16686 -p 4317:55680 -d --restart=unless-stopped jaegertracing/opentelemetry-all-in-one

and configure the otlp exporter to http://localhost:4317 in my api. I could see the telemetry in the console of my api. But I could not see the same of my api in http://localhost:16686/. the only service I could see is 'jaeger-query' in http://localhost:16686.

what could be missing?

martinmani avatar Mar 02 '21 06:03 martinmani

I changed to the following and found working :) docker run -d --name jaeger -e COLLECTOR_ZIPKIN_HTTP_PORT=9411 -p 5775:5775/udp -p 6831:6831/udp -p 6832:6832/udp -p 5778:5778 -p 16686:16686 -p 14268:14268 -p 14250:14250 -p 9411:9411 jaegertracing/all-in-one:1.22

And in the api use AddJaegerExporter() instead of AddOtlpExporter(options => options.Endpoint = new Uri("http://localhost:4317"))

martinmani avatar Mar 02 '21 06:03 martinmani

I am using Serilog for logging - I enrich all the logs with TraceID and SpanID of Http Request. I am using Prometheus.NET to collect metrics. How do I leverage OpenTelemetry.NET in this setup?

Can I use OpenTelemetry to collect metrics as well? Can existing logs from application through Serilog can also be used Telemetry? I also have one more problem- I receive messages from Third Party MF system to my kafka queue. Each message has its own unique id. There is .Net core kafka message processor which reads message from Queue and call a multiple Web Apis. How do I assign unique Id of message to System.Diagnostics.Activity.TraceID in Kafak .Net processor, so any HttpClient call made from this exe to any API get that copied over via request headers.

Alternatively please also let me know if I am approaching the problem in wrong way and there is already a standard solution for this kind of problem.

I really appreciate your time and help in above queries

ElectricVampire avatar Apr 23 '21 06:04 ElectricVampire

The series of articles is very interesting and to the point. Great work! However it is mostly focused on the area of OpenTelemetry dedicated to distributed tracing. In the examples above there is no explanation as to how application logs can be also sent and correlated with the tracing capabilities of Jaeger. In fact, when using this configuration along with a ILogger and trying to log information, the Console logger configuration does not log the messages.

How would you achieve correlation between Logs and Traces based in this configuration and using Jaeger?

neoaisac avatar Apr 23 '21 09:04 neoaisac

@ElectricVampire Open Telemetry metrics are still a work in progress. You can push logs via Open Telemetry so they show up in tools like Jaeger but this is not currently working out of the box. https://github.com/open-telemetry/opentelemetry-dotnet/issues/1739 talks about adding logging support and how Serilog fits into the picture (hint: we might not need Serilog anymore!). If you have ID's that you want to relate to a trace, you can add them easily as attributes.

@neoaisac I'm glad you found the resource useful! https://github.com/open-telemetry/opentelemetry-dotnet/issues/1739 talks about adding logging support and how Serilog fits into the picture (hint: we might not need Serilog anymore!).

RehanSaeed avatar Apr 23 '21 10:04 RehanSaeed

@RehanSaeed : Thanks for reply,

If you have ID's that you want to relate to a trace, you can add them easily as attributes.

But in that case it won't be used by .net FW. For example if I receive a message from queue -> I read unique ID from message -> I create an activity and assign attribute -> then make a Http web API call within the scope of Activity According to the code which I understood from HttpClient it will read and copy the Activity.TraceId in header and not from custom attribute. So is there any way by which .NetFw(specially HttpClient) can be configured to use my unique message Id rather than system generated TraceID) Thanks again for your time on query.

ElectricVampire avatar Apr 26 '21 04:04 ElectricVampire

@ElectricVampire You can use HttpContext.TraceIdentifier = foo for that.

RehanSaeed avatar Apr 26 '21 09:04 RehanSaeed