#Sentry logger api does not record the span id

3 messages · Page 1 of 1 (latest)

acoustic vector
#

I use the javascript Sentry logger api, but it would not record the span it.
I also couldn't find a way to log the span id manually

valid pierBOT
#

Hi @acoustic vector. I'm happy to dig into this for you! I'll check my internal sources for answers to your question! :wave:

#

The knowledge sources you provided don’t mention any way for the JavaScript logger API to automatically include or record the current span ID, nor do they show an API to explicitly log a span ID via the logger.

What is documented is how to create spans (startSpan, startSpanManual, startInactiveSpan) and how they relate to each other, but not how to access their IDs or tie them into the logger output. [JS tracing instr.]

Because of that, I can’t reliably tell you:

  • how to get a span’s ID from the SDK, or
  • how to configure the logger so that it automatically logs span IDs.

Those details simply aren’t present in the docs or issues you shared.

If you need span IDs in logs, the safest next step is to:

  • check the full Sentry JavaScript SDK API docs for a method to read span IDs, and/or
  • open an issue or discussion on getsentry/sentry-javascript describing your use case (similar to the Fastify and NestJS tracing issues you see in the provided sources). [Fastify span issue; NestJS startSpan issue]

I’m sorry I can’t give a concrete code example here—the necessary API details just aren’t in the supplied knowledge.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: