SIGN IN SIGN UP
etcd-io / etcd UNCLAIMED

Distributed reliable key-value store for the most critical data of a distributed system

0 0 159 Go

traceutil: emit stable message name with trace_id and operation as fields

Before this change, LogWithStepThreshold formatted the log message as
  fmt.Sprintf("trace[%d] %s", rand.Int31(), t.operation)
producing a unique string on every invocation (e.g. "trace[12345678] range",
"trace[87654321] range"). In structured logging each unique message value is a
distinct cardinality entry, so a busy etcd instance generated O(ops/s) unique
event names per minute. This made grouping, alerting, and dashboard queries on
slow-trace events impractical.

After this change the message is always the stable string "trace". The random
trace identifier and the operation name are moved to structured zap fields
("trace_id" int32 and "operation" string), preserving full queryability while
reducing message cardinality from O(N) to 1.

The per-step format strings also no longer embed the trace ID inline; the ID
appears once at the top level.

Fixes #21733

Signed-off-by: Andrew Liu <andrewjliu22@gmail.com>
A
Andrew Liu committed
af18caa8f51d6931de180d654c32fd72245f6f2c
Parent: 0235df9