traceutil

package
v0.0.0-...-dca2ff9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 10, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package traceutil contains functions for extracting and processing traces. It should only import payload and nothing else.

Index

Constants

View Source
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

func APITrace(t pb.Trace) *pb.APITrace

APITrace returns an APITrace from t, as required by the Datadog API. It also returns an estimated size in bytes.

func ChildrenMap

func ChildrenMap(t pb.Trace) map[uint64][]*pb.Span

ChildrenMap returns a map containing for each span id the list of its direct children.

func ComputeTopLevel

func ComputeTopLevel(t pb.Trace)

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

func GetEnv(t pb.Trace) string

GetEnv returns the meta value for the "env" key for the first trace it finds or an empty string

func GetRoot

func GetRoot(t pb.Trace) *pb.Span

GetRoot extracts the root span from a trace

func HasForceMetrics

func HasForceMetrics(s *pb.Span) bool

HasForceMetrics returns true if statistics computation should be forced for this span.

func HasTopLevel

func HasTopLevel(s *pb.Span) bool

HasTopLevel returns true if span is top-level.

func SetMeta

func SetMeta(s *pb.Span, key, val string)

SetMeta sets the metadata at key to the val on the span s.

func SetTopLevel

func SetTopLevel(s *pb.Span, topLevel bool)

SetTopLevel sets the top-level attribute of the span.

func TruncateUTF8

func TruncateUTF8(s string, limit int) string

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL