Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace trace ID with latency in trace list #156

Merged
merged 2 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions tuiexporter/internal/tui/component/trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (

var spanTableHeader = [5]string{
" ", // Error indicator
"Trace ID",
"Service Name",
"Latency",
"Received At",
"Span Name",
}
Expand Down Expand Up @@ -69,11 +69,12 @@ func (s SpanDataForTable) getCellFromSpan(span *telemetry.SpanData, column int)
}
}
case 1:
text = span.Span.TraceID().String()
case 2:
if sname, ok := span.ResourceSpan.Resource().Attributes().Get("service.name"); ok {
text = sname.AsString()
}
case 2:
duration := span.Span.EndTimestamp().AsTime().Sub(span.Span.StartTimestamp().AsTime())
text = duration.String()
case 3:
text = span.ReceivedAt.Local().Format("2006-01-02 15:04:05")
case 4:
Expand Down
12 changes: 6 additions & 6 deletions tuiexporter/internal/tui/component/trace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,16 @@ func TestSpanDataForTable(t *testing.T) {
want: "",
},
{
name: "trace ID trace 1 span-1-1-1",
row: 0,
name: "service name trace 1 span-2-1-1",
row: 1,
column: 1,
want: "01000000000000000000000000000000",
want: "test-service-2",
},
{
name: "service name trace 1 span-2-1-1",
row: 1,
name: "latency span-1-1-1",
row: 0,
column: 2,
want: "test-service-2",
want: "200ms",
},
{
name: "received at trace 2 span-1-1-1",
Expand Down
Loading