pub fn thread_id() -> u32Expand description
Process-local sequential thread id.
Returns the same value on every call from the current thread. The id is allocated lazily on first call per thread via an atomic counter - no syscalls. The first thread that calls this gets id 1 (id 0 is reserved for “unspecified” so the Observation default is distinguishable from a real thread).
Stable across all observation pushes from the same thread; valid for the lifetime of the process; not valid across forks (the child keeps the parent’s counter but reissues new ids to its own threads).