Documentation ¶
Overview ¶
Package traceutil contains functions for extracting and processing traces. It should only import payload and nothing else.
Index ¶
- func APITrace(t pb.Trace) *pb.APITrace
- func ChildrenMap(t pb.Trace) map[uint64][]*pb.Span
- func ComputeTopLevel(t pb.Trace)
- func GetEnv(t pb.Trace) string
- func GetMeta(s *pb.Span, key string) (string, bool)
- func GetRoot(t pb.Trace) *pb.Span
- func HasTopLevel(s *pb.Span) bool
- func IsMeasured(s *pb.Span) bool
- func SetMeta(s *pb.Span, key, val string)
- func SetMetric(s *pb.Span, key string, val float64)
- func SetTopLevel(s *pb.Span, topLevel bool)
- func TruncateUTF8(s string, limit int) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func APITrace ¶
APITrace returns an APITrace from t, as required by the Datadog API. It also returns an estimated size in bytes.
func ChildrenMap ¶
ChildrenMap returns a map containing for each span id the list of its direct children.
func ComputeTopLevel ¶
ComputeTopLevel updates all the spans top-level attribute.
A span is considered top-level if:
- it's a root span
- its parent is unknown (other part of the code, distributed trace)
- its parent belongs to another service (in that case it's a "local root" being the highest ancestor of other spans belonging to this service and attached to it).
func IsMeasured ¶
IsMeasured returns true if a span should be measured (i.e., it should get trace metrics calculated).
func SetTopLevel ¶
SetTopLevel sets the top-level attribute of the span.
func TruncateUTF8 ¶
TruncateUTF8 truncates the given string to make sure it uses less than limit bytes. If the last character is an utf8 character that would be splitten, it removes it entirely to make sure the resulting string is not broken.
Types ¶
This section is empty.