Skip to content

Commit 37a3e96

Browse files
authored
Use module name in fx tracing when event name is reflect (#44199)
### What does this PR do? Update fx tracing to use the module name when the event name is from reflect. ### Motivation We currently have many spans named `reflect.makeFuncStub()`, which doesn't let us know where the event comes from. Using the module name and event type instead gives us a lot more information. Eg. `reflect.makeFuncStub()` -> `provide(comp/core/ipc)`. ### Describe how you validated your changes Manual testing. ### Additional Notes Co-authored-by: pierre.gimalac <pierre.gimalac@datadoghq.com>
1 parent 62ba3ab commit 37a3e96

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/util/fxutil/logging/tracer.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
package logging
77

88
import (
9+
"fmt"
910
"io"
1011
"math/rand"
1112
"os"
@@ -115,7 +116,10 @@ func (l *FxTracingLogger) handleRun(e *fxevent.Run) {
115116
startTime := time.Now().Add(-e.Runtime).UnixNano()
116117

117118
name := extractShortPathFromFullPath(e.Name)
118-
119+
if name == "reflect.makeFuncStub()" {
120+
// fallback to the module to at least know where this comes from
121+
name = fmt.Sprintf("%s(%s)", e.Kind, e.ModuleName) // eg. "provide(comp/core/ipc)"
122+
}
119123
span := &Span{
120124
Service: serviceName,
121125
Name: constructorName,

0 commit comments

Comments
 (0)