Documentation ¶
Overview ¶
Package traceutil contains functions for extracting and processing traces. It should only import payload and nothing else.
Index ¶
- Constants
- 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 GetRoot(t pb.Trace) *pb.Span
- func HasForceMetrics(s *pb.Span) bool
- func HasTopLevel(s *pb.Span) bool
- func SetMeta(s *pb.Span, key, val string)
- func SetTopLevel(s *pb.Span, topLevel bool)
- func TruncateUTF8(s string, limit int) string
Constants ¶
const ( // TraceMetricsKey is a tag key which, if set to true, // ensures all statistics are computed for this span. // [FIXME] *not implemented yet* TraceMetricsKey = "datadog.trace_metrics" )
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 GetEnv ¶
GetEnv returns the meta value for the "env" key for the first trace it finds or an empty string
func HasForceMetrics ¶
HasForceMetrics returns true if statistics computation should be forced for this span.
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.