Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

263
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda