Skip to content

Commit

Permalink
feat(context): add injectMetadata
Browse files Browse the repository at this point in the history
  • Loading branch information
main-kun committed Nov 26, 2024
1 parent c774747 commit 1b5ce6d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/lib/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,18 @@ export class AppContext {
return metadata;
}

injectMetadata(metadata: IncomingHttpHeaders) {
if (this.span) {
propagation.inject(
trace.setSpan(api.context.active(), this.span),
metadata,
headerSetter,
);
return true;
}
return false;
}

getTraceId(): string | undefined {
if (!this.span) {
this.log('Span is undefined');
Expand Down

0 comments on commit 1b5ce6d

Please sign in to comment.