How to get TraceId and SpanID from OTEL Tracing

How to get TraceId and SpanID from OTEL Tracing


0

I am using SpringBoot and Graphql for a module as well using OTEL. I need spanID and traceID in the logs of the application.

  • trace_id: OTel trace trace id, must be present in every log record
    produced in request context.
  • span_id: OTel trace span id, must be
    present in every log record produced in request context

In the Query of Subgraph, I tried to write

System.out.println(Span.current().getSpanContext().getTraceId());

But getting for every request:

00000000000000000000000000000000

Can anyone tell me what is an appropriate way to generate traceID and SpanID?


Load 7 more related questions


Show fewer related questions

0



Leave a Reply

Your email address will not be published. Required fields are marked *