mirror of
https://github.com/hanzoai/o11y.git
synced 2026-10-15 12:58:33 +00:00
* feat: add customer aggregation support in waterfall * chore: add tests for aggregation logic * chore: rename analytics to aggregations * chore: update openapi specs * feat: add support to request telemetry fields in flamegraph * chore: simplify getting attribute value for span * fix: remove overlapping time from duration aggregation * fix: use valuer.String for enums * feat: add preferences for preview and color by
46 lines
1.6 KiB
Go
46 lines
1.6 KiB
Go
package model
|
|
|
|
import "time"
|
|
|
|
type SpanItemV2 struct {
|
|
TimeUnixNano time.Time `ch:"timestamp"`
|
|
DurationNano uint64 `ch:"duration_nano"`
|
|
SpanID string `ch:"span_id"`
|
|
TraceID string `ch:"trace_id"`
|
|
HasError bool `ch:"has_error"`
|
|
Kind int8 `ch:"kind"`
|
|
ServiceName string `ch:"resource_string_service$$name"`
|
|
Name string `ch:"name"`
|
|
References string `ch:"references"`
|
|
Attributes_string map[string]string `ch:"attributes_string"`
|
|
Attributes_number map[string]float64 `ch:"attributes_number"`
|
|
Attributes_bool map[string]bool `ch:"attributes_bool"`
|
|
Resources_string map[string]string `ch:"resources_string"`
|
|
Events []string `ch:"events"`
|
|
StatusMessage string `ch:"status_message"`
|
|
StatusCodeString string `ch:"status_code_string"`
|
|
SpanKind string `ch:"kind_string"`
|
|
ParentSpanId string `ch:"parent_span_id"`
|
|
}
|
|
|
|
type TraceSummary struct {
|
|
TraceID string `ch:"trace_id"`
|
|
Start time.Time `ch:"start"`
|
|
End time.Time `ch:"end"`
|
|
NumSpans uint64 `ch:"num_spans"`
|
|
}
|
|
|
|
// AttributeValue looks up an attribute across string, number, and bool maps in priority order.
|
|
func (s SpanItemV2) AttributeValue(name string) any {
|
|
if v, ok := s.Attributes_string[name]; ok {
|
|
return v
|
|
}
|
|
if v, ok := s.Attributes_number[name]; ok {
|
|
return v
|
|
}
|
|
if v, ok := s.Attributes_bool[name]; ok {
|
|
return v
|
|
}
|
|
return nil
|
|
}
|