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

225
Views
¿Cómo extraer manualmente el contexto o el intervalo de la solicitud http entrante en NodeJS?

Estoy tratando de migrar mi aplicación Node.js de jaeger-client a @opentelemetry/* paquetes

En mi aplicación Node.js tengo un servidor http simple y quiero crear intervalos en cada respuesta.

Con jaeger-client lo hice de la siguiente manera:

 import { FORMAT_HTTP_HEADERS } from 'opentracing'; import { initTracerFromEnv } from 'jaeger-client'; const tracer = initTracerFromEnv(/* some options here */); // app is expressjs app app.get('/home', req => { const rootSpan = tracer.startSpan('response', { childOf: tracer.extract(FORMAT_HTTP_HEADERS, req.headers), }); // ...make child spans of rootSpan });

Quiero conectar mi intervalo raíz de respuesta con intervalos de otra aplicación, que realiza la solicitud a mi servidor de aplicaciones Node.js Casi lo mismo que haría con jaeger-client .

¿Cómo puedo hacerlo con OpenTelemetry en lugar de jeager-client y opentracing ? ¿Es posible crear tramos secundarios manualmente, sin instrumentaciones automáticas?

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

0

Puede hacer la Propagación de contexto extrayendo el contexto principal de los encabezados de solicitud y creando el intervalo secundario con él, de la siguiente manera:

 const opentelemetry = require('@opentelemetry/api'); const {SpanKind, ROOT_CONTEXT} = require("@opentelemetry/api"); app.get('/home', req => { // Get incoming context from headers const remoteCtx = opentelemetry.propagation.extract(ROOT_CONTEXT, req.headers); // ...make child spans of remoteSpan // Create child span passing parent context const childSpan = tracer.startSpan( 'childSpan', remoteCtx ); // ... Do important stuff // End the span childSpan.end(); });
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!