Skip to content

Commit

Permalink
Merge pull request #23 from quintoandar/log-all-span-ids
Browse files Browse the repository at this point in the history
Log all span ids
  • Loading branch information
pginca authored Feb 8, 2023
2 parents 5bc30e7 + 8d81bf3 commit 5dfc6cd
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,9 @@ function formatParams(params, module, funcCallerParam) {
const metadata = {};

if (tracer && tracer.currentRootSpan && tracer.currentRootSpan.traceId) {
const allDescendants = tracer.currentRootSpan.allDescendants().map((span) => span.id)
metadata.traceId = tracer.currentRootSpan.traceId;
if (tracer.currentRootSpan.spanContext && tracer.currentRootSpan.spanContext.spanId) {
metadata.spanId = tracer.currentRootSpan.spanContext.spanId;
}
metadata.spanIds = [tracer.currentRootSpan.parentSpanId, tracer.currentRootSpan.id, allDescendants].flat()
}

if (typeof params[0] === 'string') {
Expand Down

0 comments on commit 5dfc6cd

Please sign in to comment.