tracing: track goroutine ID in Span #59200
Labels
A-tracing
Relating to tracing in CockroachDB.
C-enhancement
Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)
Is your feature request related to a problem? Please describe.
While
Span
can cross goroutine boundaries, idiomatically it should not. This gives us a straightforward way to, in many cases, heuristically find the goroutine associated to a long-running trace span. Note that the tracked goroutine may already have terminated, and the goroutine ID may now be reused by a different goroutine. This is why it says "heuristically" - in practice this should work well.Describe the solution you'd like
We grab the goroutine ID (
goid
package does it) at span creation time (we could also update it on every access, but not sure this buys us much) and can expose it as part of #55733.Describe alternatives you've considered
#58609 suggests allowing to hook into the output of a span (making it verbose if need be). However, that gives no clue as to the location of a truly stuck span (say a goroutine sitting on a
select
). It also involves more complexity.Additional context
We are at the moment targeting "expert debugging" for this use case only. Chasing down a goroutine in this way will be too complicated for end users, but should be within the realm of engineers, TSEs, CC-SREs, CS, etc with proper playbooks.
The text was updated successfully, but these errors were encountered: