Skip to content

Commit

Permalink
Adding request_id data in span attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
markiing committed Dec 20, 2022
1 parent eab0f61 commit f744a77
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/support/opentelemetry.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ provider.register();
const tracer = opentelemetry.trace.getTracer(OtelConfig.service);

function StartSpanMiddleware(req, res, next) {
const span = tracer.startSpan(req.path);
const span = tracer.startSpan(req.path, { attributes: {
"http.request_id": req.headers["x-request-id"]
}});
req.otelSpan = span;
next();
}
Expand Down

0 comments on commit f744a77

Please sign in to comment.