datalust / seq-tickets

Issues, design discussions and feature roadmap for the Seq log server
https://datalust.co/seq
98 stars 5 forks source link

Sending OpenTelemetry traces from net8 to Seq don't seem to work (for me) #2295

Closed jbennink closed 1 month ago

jbennink commented 1 month ago

Describe the bug Once I set things up -- I think correctly -- I could net get traces to show in Seq. I made a small repro in github OpenTelemetryTestingDefaultIlogger based on the WeatherForecast WebApi template adding as little as possible to get it to work with OpenTelemetry.

P.S. This might not be a bug, but more some seup issue on my part but I scoured the web and could not find any better documentation of samples without them either being non complete or very hard to digest.

To Reproduce Steps to reproduce the behavior:

  1. First setup a local Seq container (see included docker-compose)
  2. Then run the project as-is
  3. Use the (included OpenTelemetryTestingDefaultIlogger.http) to execute an api call
  4. Check Seq to see the "Calling Weatherforcast" log entry, check the Trace dropdown and choose Show (see the screenshot)
  5. It says "The trace does not contain any spans". But as far as I could figure out I did using an ActivitySource "WeatherApi" that was added in program.cs which created an Activity (and an inner activity). The ConsoleExporter does show both in the Console.

Expected behavior I would have expected to see a trace like I have seens in some screenshots but I could never find actual complete samples code of the thing

Not to add 2 issues into one but I could also not get logging to work with otlp, on;y the builder.AddSeq() method seemed to get any logs to Seq.

Screenshots Seq output after the steps

Environment (please complete the following information):

nblumhardt commented 1 month ago

Hi @jbennink, thanks for reaching out.

There are two problems in your setup.

  1. The Seq default port is 5341, but your URLs are using 5431, and
  2. The tracing exporter setup needs /v1/traces at the end of the URL (the same as the logs endpoint).

Here's your sample running:

image

Not sure why ASP.NET Core is producing those messages without a ContentLength property - the should include a ContentLength: null but perhaps some optimization is wiping those out.

Seq 2024.3 doesn't support OTLP metrics so the metrics output will need to go to something like Prometheus or InfluxDB instead.

Hope this helps, Nick

jbennink commented 1 month ago

@nblumhardt OMG, I'm so embarres right now. It's the url, the thing I keep copy pasting. This is why you need peer review :-O After changing both it worked immediately.