TraceView: Display event names of a span (#91382)

* Display event name of a span

* Clean up

* Retrigger the build

* Show colon only when there are fields to display

* Rollback

* Use event name when exporting to OTLP

* Allow filtering spans by event name

* Show duration as a key/value pair

* Update betterer report (we do not translate panels that are planned to be externalized)

* Fix tests after changing how duration is rendered

* Handle long names

* Test handling long names

* Make parenthesis gray

* Fix a test

* Fix linting

* Fix tests

* Update label
This commit is contained in:
Piotr Jamróz
2024-09-03 11:18:50 +02:00
committed by GitHub
parent 1df622641c
commit d7d22bbbb8
15 changed files with 157 additions and 35 deletions
+2 -6
View File
@@ -22,6 +22,7 @@ type TraceLog struct {
// Millisecond epoch time
Timestamp float64 `json:"timestamp"`
Fields []*KeyValue `json:"fields"`
Name string `json:"name,omitempty"`
}
type TraceReference struct {
@@ -260,12 +261,6 @@ func spanEventsToLogs(events ptrace.SpanEventSlice) []*TraceLog {
for i := 0; i < events.Len(); i++ {
event := events.At(i)
fields := make([]*KeyValue, 0, event.Attributes().Len()+1)
if event.Name() != "" {
fields = append(fields, &KeyValue{
Key: TagMessage,
Value: event.Name(),
})
}
event.Attributes().Range(func(key string, attr pcommon.Value) bool {
fields = append(fields, &KeyValue{Key: key, Value: getAttributeVal(attr)})
return true
@@ -273,6 +268,7 @@ func spanEventsToLogs(events ptrace.SpanEventSlice) []*TraceLog {
logs = append(logs, &TraceLog{
Timestamp: float64(event.Timestamp()) / 1_000_000,
Fields: fields,
Name: event.Name(),
})
}