Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

How to enrich LogRecord with traceid and spanid? (web) #4210

Unanswered
gitck-scch asked this question in Q&A
Discussion options

In our setup we use NgxLogger and provide a specific logger monitor (impementation of INGXLoggerMonitor) that forwards the log messages via otlp to a running opentelemetry collector instance.

Currently, I'm struggeling with two things:

  1. How to add traceid and spanid to created LogRecord objects for correlation? Do I have to provide my own 'Context' object that returns appropriate values for 'traceId' and 'spanId'?
  2. Currently const currentSpan = trace.getSpan(context.active()); is undefined, even though the logger is triggered by interacting with the web page and instrumenation of user-interactions is configured correctly registerInstrumentations({ instrumentations: [ new DocumentLoadInstrumentation(), new UserInteractionInstrumentation(), ], });

I appreciate any hint pointing me in the right direction. I could only find one example that shows the basic use (see here \opentelemetry-js\experimental\examples\logs\index.ts). But this example does not cover how to get the current trace and span identifier and how to propagate them to the log record, for correlation of traces with log records.

You must be logged in to vote

Replies: 1 comment 1 reply

Comment options

Did you ever figure this out?

You must be logged in to vote
1 reply
Comment options

Did you ever figure this out?

Unfortunately not, nobody commented on this and I have not investigated this further. Since some time has passed since then, I hope that this is solved with current version and documentation. Do you have a similar issue, with current versions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /