trace

package
v2.5.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2019 License: Apache-2.0 Imports: 2 Imported by: 43

Documentation

Index

Constants

View Source
const ValidJSON = `` /* 675-byte string literal not displayed */

ValidJSON is useful for testing

Variables

View Source
var DefaultLogger = log.DefaultLogger.CreateChild()

DefaultLogger is used by package structs that don't have a default logger set.

Functions

This section is empty.

Types

type Annotation

type Annotation struct {
	Timestamp *int64  `json:"timestamp,omitempty"`
	Value     *string `json:"value,omitempty"`
}

Annotation associates an event that explains latency with a timestamp. Unlike log statements, annotations are often codes. Ex. “ws” for WireSend

type Endpoint

type Endpoint struct {
	ServiceName *string `json:"serviceName,omitempty"`
	Ipv4        *string `json:"ipv4,omitempty"`
	Ipv6        *string `json:"ipv6,omitempty"`
	Port        *int32  `json:"port,omitempty"`
}

Endpoint is the network context of a node in the service graph

type MiddlewareConstructor

type MiddlewareConstructor func(sendTo Sink) Sink

A MiddlewareConstructor is used by FromChain to chain together a bunch of sinks that forward to each other

func NextWrap

func NextWrap(wrapping NextSink) MiddlewareConstructor

NextWrap wraps a NextSink to make it usable by MiddlewareConstructor

type NextSink

type NextSink interface {
	AddSpans(ctx context.Context, traces []*Span, next Sink) error
}

NextSink is a special case of a sink that forwards to another sink

type Sink

type Sink interface {
	AddSpans(ctx context.Context, traces []*Span) error
}

A Sink is an object that can accept traces and do something with them, like forward them to some endpoint

func FromChain

func FromChain(endSink Sink, sinks ...MiddlewareConstructor) Sink

FromChain creates an endpoint Sink that sends calls between multiple middlewares for things like counting traces in between.

type Span

type Span struct {
	TraceID        string                 `json:"traceId"` // required
	Name           *string                `json:"name,omitempty"`
	ParentID       *string                `json:"parentId,omitempty"`
	ID             string                 `json:"id"` // required
	Kind           *string                `json:"kind,omitempty"`
	Timestamp      *int64                 `json:"timestamp,omitempty"`
	Duration       *int64                 `json:"duration,omitempty"`
	Debug          *bool                  `json:"debug,omitempty"`
	Shared         *bool                  `json:"shared,omitempty"`
	LocalEndpoint  *Endpoint              `json:"localEndpoint,omitempty"`
	RemoteEndpoint *Endpoint              `json:"remoteEndpoint,omitempty"`
	Annotations    []*Annotation          `json:"annotations,omitempty"`
	Tags           map[string]string      `json:"tags,omitempty"`
	Meta           map[string]interface{} `json:"-"` // non serializeable field to hold any meta data we want to keep around
}

Span defines a span

type Trace

type Trace []*Span

Trace is a list of spans

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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