pub struct Id(/* private fields */);
Expand description
An identifier for flows and async spans.
Implementations§
Source§impl Id
impl Id
Sourcepub fn new() -> Id
pub fn new() -> Id
Creates a new Id
. Id
s created by separate calls to new
in the same process are
guaranteed to be distinct.
WARNING: Id::new
is likely to hit the UI bug where UIs group async
durations with the same trace id but different process ids. Use
Id::random
instead. (Until https://fxbug.dev/42054669 is fixed.)
Sourcepub fn random() -> Id
pub fn random() -> Id
Creates a new Id
based on the current montonic time and a random u16
to, with high
probability, avoid the bug where UIs group async durations with the same trace id but
different process ids.
Id::new
is likely to hit the UI bug because it (per process) generates trace ids
consecutively starting from 1.
https://cs.opensource.google/fuchsia/fuchsia/+/main:zircon/system/ulib/trace-engine/nonce.cc;l=15-17;drc=b1c2f508a59e6c87c617852ed3e424693a392646
TODO(https://fxbug.dev/42054669) Delete this and migrate clients to Id::new
once UIs stop grouping
async durations with the same trace id but different process ids.