aboutsummaryrefslogtreecommitdiff
path: root/src/internal
diff options
context:
space:
mode:
authorFelix Geisendörfer <felix.geisendoerfer@datadoghq.com>2025-08-19 17:17:03 +0200
committerGopher Robot <gobot@golang.org>2025-08-19 12:48:42 -0700
commitb80ffb64d815596eb8882eaefa3e2d2920380634 (patch)
treea5c334b8a4ffd1f8304d0085e0f6fbfc26722eee /src/internal
parentc7d8bda4596d2ad4970c8052fded76284b2f0be1 (diff)
downloadgo-b80ffb64d815596eb8882eaefa3e2d2920380634.tar.xz
internal/trace: remove redundant info from Event.String
Remove redundant information from state transition events. They currently mention the proc and goroutine id that is transitioning twice. Also reorder the reason to appear after the from->to state transition information since it is a detail that is not available for all transition. Before example: M=6164541440 P=3 G=17 StateTransition Time=7169014471424 Resource=Goroutine(17) Reason="chan receive" GoID=17 Running->Waiting M=6166261760 P=3 G=10 StateTransition Time=7169908799040 Resource=Proc(4) Reason="" ProcID=4 Idle->Idle After example: M=6164541440 P=3 G=17 StateTransition Time=7169014471424 GoID=17 Running->Waiting Reason="chan receive" M=6166261760 P=3 G=10 StateTransition Time=7169908799040 ProcID=4 Idle->Idle Reason="" Change-Id: I6a6a696487ff2905f7c98dae7e887b998a2cb298 Reviewed-on: https://go-review.googlesource.com/c/go/+/697356 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Michael Knyszek <mknyszek@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
Diffstat (limited to 'src/internal')
-rw-r--r--src/internal/trace/event.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/internal/trace/event.go b/src/internal/trace/event.go
index a47f71b65e..321e4e21fb 100644
--- a/src/internal/trace/event.go
+++ b/src/internal/trace/event.go
@@ -843,7 +843,6 @@ func (e Event) String() string {
fmt.Fprintf(&sb, " Task=%d Category=%q Message=%q", l.Task, l.Category, l.Message)
case EventStateTransition:
s := e.StateTransition()
- fmt.Fprintf(&sb, " Resource=%s Reason=%q", s.Resource, s.Reason)
switch s.Resource.Kind {
case ResourceGoroutine:
id := s.Resource.Goroutine()
@@ -854,6 +853,7 @@ func (e Event) String() string {
old, new := s.Proc()
fmt.Fprintf(&sb, " ProcID=%d %s->%s", id, old, new)
}
+ fmt.Fprintf(&sb, " Reason=%q", s.Reason)
if s.Stack != NoStack {
fmt.Fprintln(&sb)
fmt.Fprintln(&sb, "TransitionStack=")