mirror of
https://github.com/pomerium/pomerium.git
synced 2025-08-06 10:21:05 +02:00
linter fixes
This commit is contained in:
parent
99770f7ab0
commit
a7725702eb
1 changed files with 9 additions and 9 deletions
|
@ -50,13 +50,13 @@ func (td *TraceDetails) SpanTree() *SpanTree {
|
||||||
Span: span,
|
Span: span,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
detachedNodesById := map[oteltrace.SpanID]*SpanTreeNode{}
|
detachedNodesByID := map[oteltrace.SpanID]*SpanTreeNode{}
|
||||||
for _, span := range td.Spans {
|
for _, span := range td.Spans {
|
||||||
spanID, _ := trace.ToSpanID(span.Raw.SpanId)
|
spanID, _ := trace.ToSpanID(span.Raw.SpanId)
|
||||||
parentSpanID, _ := trace.ToSpanID(span.Raw.ParentSpanId)
|
parentSpanID, _ := trace.ToSpanID(span.Raw.ParentSpanId)
|
||||||
if _, ok := nodesByID[parentSpanID]; !ok {
|
if _, ok := nodesByID[parentSpanID]; !ok {
|
||||||
detachedNodesById[parentSpanID] = &SpanTreeNode{}
|
detachedNodesByID[parentSpanID] = &SpanTreeNode{}
|
||||||
nodesByID[parentSpanID] = detachedNodesById[parentSpanID]
|
nodesByID[parentSpanID] = detachedNodesByID[parentSpanID]
|
||||||
}
|
}
|
||||||
nodesByID[spanID].Parent = nodesByID[parentSpanID]
|
nodesByID[spanID].Parent = nodesByID[parentSpanID]
|
||||||
nodesByID[parentSpanID].Children = append(nodesByID[parentSpanID].Children, nodesByID[spanID])
|
nodesByID[parentSpanID].Children = append(nodesByID[parentSpanID].Children, nodesByID[spanID])
|
||||||
|
@ -68,7 +68,7 @@ func (td *TraceDetails) SpanTree() *SpanTree {
|
||||||
}
|
}
|
||||||
return &SpanTree{
|
return &SpanTree{
|
||||||
Root: nodesByID[oteltrace.SpanID([8]byte{})],
|
Root: nodesByID[oteltrace.SpanID([8]byte{})],
|
||||||
DetachedParents: detachedNodesById,
|
DetachedParents: detachedNodesByID,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ func (tr *TraceResults) computeResources() []*resourcev1.Resource {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tr *TraceResults) computeTraces() *Traces {
|
func (tr *TraceResults) computeTraces() *Traces {
|
||||||
tracesById := map[unique.Handle[oteltrace.TraceID]]*TraceDetails{}
|
tracesByID := map[unique.Handle[oteltrace.TraceID]]*TraceDetails{}
|
||||||
for _, resSpan := range tr.resourceSpans {
|
for _, resSpan := range tr.resourceSpans {
|
||||||
resource := resSpan.Resource
|
resource := resSpan.Resource
|
||||||
for _, scopeSpans := range resSpan.ScopeSpans {
|
for _, scopeSpans := range resSpan.ScopeSpans {
|
||||||
|
@ -108,13 +108,13 @@ func (tr *TraceResults) computeTraces() *Traces {
|
||||||
for _, span := range scopeSpans.Spans {
|
for _, span := range scopeSpans.Spans {
|
||||||
traceID, _ := trace.ToTraceID(span.TraceId)
|
traceID, _ := trace.ToTraceID(span.TraceId)
|
||||||
var details *TraceDetails
|
var details *TraceDetails
|
||||||
if d, ok := tracesById[traceID]; ok {
|
if d, ok := tracesByID[traceID]; ok {
|
||||||
details = d
|
details = d
|
||||||
} else {
|
} else {
|
||||||
details = &TraceDetails{
|
details = &TraceDetails{
|
||||||
ID: traceID,
|
ID: traceID,
|
||||||
}
|
}
|
||||||
tracesById[traceID] = details
|
tracesByID[traceID] = details
|
||||||
}
|
}
|
||||||
svc := ""
|
svc := ""
|
||||||
for _, attr := range resource.Attributes {
|
for _, attr := range resource.Attributes {
|
||||||
|
@ -139,7 +139,7 @@ func (tr *TraceResults) computeTraces() *Traces {
|
||||||
tracesByName := map[string][]*TraceDetails{}
|
tracesByName := map[string][]*TraceDetails{}
|
||||||
|
|
||||||
// sort spans by start time and compute durations
|
// sort spans by start time and compute durations
|
||||||
for _, td := range tracesById {
|
for _, td := range tracesByID {
|
||||||
slices.SortFunc(td.Spans, func(a, b *SpanDetails) int {
|
slices.SortFunc(td.Spans, func(a, b *SpanDetails) int {
|
||||||
return cmp.Compare(a.Raw.StartTimeUnixNano, b.Raw.StartTimeUnixNano)
|
return cmp.Compare(a.Raw.StartTimeUnixNano, b.Raw.StartTimeUnixNano)
|
||||||
})
|
})
|
||||||
|
@ -162,7 +162,7 @@ func (tr *TraceResults) computeTraces() *Traces {
|
||||||
}
|
}
|
||||||
|
|
||||||
return &Traces{
|
return &Traces{
|
||||||
ByID: tracesById,
|
ByID: tracesByID,
|
||||||
ByName: tracesByName,
|
ByName: tracesByName,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue