]> Cypherpunks repositories - gostls13.git/commit
cmd/trace: change span id computation for trace view use
authorHana Kim <hakim@google.com>
Thu, 12 Apr 2018 21:06:33 +0000 (17:06 -0400)
committerHyang-Ah Hana Kim <hyangah@gmail.com>
Fri, 13 Apr 2018 16:18:30 +0000 (16:18 +0000)
commit1d8fc211f99ea813e3c6517c12d7758691bf0529
tree478f50e73566a5af5a2f048a8f98e4855ae32624
parent4d59b14400aff02ded4ccf62a7518266ea8fd767
cmd/trace: change span id computation for trace view use

golang.org/cl/102697 attempted to fix the span presentation by utilizing
the position of the span in the span slices of a task. But it is
not complete either.

First, id=0 is omitted in json encoding and the trace viewer silently
drops entries with the missing id field, so we must avoid zero-value id.
Second, it is possible that a goroutine handles multiple tasks. Then,
id collisions will happen.

This takes a simpler approach - have a counter that increments for every
emitSpan call, and use the value as the id value.

Change-Id: Idaa9505634acf6d327c6f00af32d8260955b85e1
Reviewed-on: https://go-review.googlesource.com/106755
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/cmd/trace/trace.go