traceutil

package
v0.0.0-...-4646cf5 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2020 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Overview

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

Index

Constants

This section is empty.

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 first "env" tag found in trace t.

func GetMeta

func GetMeta(s *pb.Span, key string) (string, bool)

GetMeta gets the metadata value in the span Meta map.

func GetRoot

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

GetRoot extracts the root span from a trace

func HasTopLevel

func HasTopLevel(s *pb.Span) bool

HasTopLevel returns true if span is top-level.

func IsMeasured

func IsMeasured(s *pb.Span) bool

IsMeasured returns true if a span should be measured (i.e., it should get trace metrics calculated).

func SetMeta

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

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

func SetMetric

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

SetMetric sets the metric 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