Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

265
Views
DataDog to OpenTracing IDs - Converting 64-bit unsigned integer to 128-bit unsigned and 64-bit unsigned hex

I am attempting to correlate traces originating in DataDog's RUM SDK, which are hitting by BE instrumented with OpenTelemetry. Essentially trying to implement the reverse of DD's documentation on Connect OpenTelemetry Traces And Logs

OpenTelemetry TraceId and SpanId properties differ from Datadog conventions. Therefore it’s necessary to translate TraceId and SpanId from their OpenTelemetry formats (a 128bit unsigned int and 64bit unsigned int represented as a 32-hex-character and 16-hex-character lowercase string, respectively) into their Datadog Formats(a 64bit unsigned int).

The context is being set in my BE in the following way;

(event:any) => {
      if(event.headers) {
        const traceId = event.headers['x-datadog-trace-id']
        const spanId = event.headers['x-datadog-parent-id']
        if(traceId && spanId) {
          const convertedTraceId = convertToOtelId(traceId, 32);
          const convertedSpanId = convertToOtelId(spanId, 16);
          const spanContext: SpanContext = {
            traceId: convertedTraceId,
            spanId: convertedSpanId,
            traceFlags: 1,
            isRemote: true,
          };
    
          return propagation.extract(context.active(), spanContext);
        }
      }
      return ROOT_CONTEXT;
    }

convertToOtelId is producing these results;

trace id - In: 2245099779221068633, Out: 00000000000000001f28325aa9c79b59

span id - In: 4011377516575614177, Out: 37ab46991f7a64e1

Obviously the 128-bit uint for the trace_id does not look correct with its leading zeros. Am I understanding this conversion correctly?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Yes, you are doing it correct. The extra leading zeros indicate the remaining unused bits. Here is simple cross check in python.

>>>
>>> format(2245099779221068633, "032x")  # The trace ID as 32-byte hexadecimal string
'00000000000000001f28325aa9c79b59'
>>>
>>> format(4011377516575614177, "016x")  # The span ID as 16-byte hexadecimal string
'37ab46991f7a64e1'
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!