trace

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultAddress = ":8126"

DefaultAddress is the default address to listen to traces

Variables

This section is empty.

Functions

This section is empty.

Types

type ColourFormatter

type ColourFormatter struct{}

ColourFormatter formats spans in ANSI colour

func (ColourFormatter) Format

func (ColourFormatter) Format(span Span) string

Format taks a span and formats it in ANSI colour

type Formatter

type Formatter interface {
	Format(span Span) string
}

Formatter takes a span and formats the output

type Server

type Server struct {
	// tcp address to listen on
	Address string
	// contains filtered or unexported fields
}

Server mimics the HTTP API exposed by the datadog APM agent

func NewServer

func NewServer(address string, options ...ServerOption) *Server

NewServer creates a new trace server

func (Server) Close

func (server Server) Close() error

Close shuts down the trace server

func (Server) HandleTrace

func (server Server) HandleTrace(w http.ResponseWriter, req *http.Request)

HandleTrace receives tracing requests from datadog clients and prints them to the console

func (Server) Listen

func (server Server) Listen() error

Listen starts the trace server

type ServerOption

type ServerOption func(*serverConfig)

ServerOption provides optional configuration for initializing a new server

func WithOutput

func WithOutput(output io.Writer) ServerOption

WithOutput allows for overriding the output destination for traces

type Span

type Span struct {
	Operation string             `msgpack:"name"`              // operation name
	Service   string             `msgpack:"service"`           // service name (i.e. "grpc.server", "http.request")
	Resource  string             `msgpack:"resource"`          // resource name (i.e. "/user?id=123", "SELECT * FROM users")
	Type      string             `msgpack:"type"`              // protocol associated with the span (i.e. "web", "db", "cache")
	Start     int64              `msgpack:"start"`             // span start time expressed in nanoseconds since epoch
	Duration  int64              `msgpack:"duration"`          // duration of the span expressed in nanoseconds
	Meta      map[string]string  `msgpack:"meta,omitempty"`    // arbitrary map of metadata
	Metrics   map[string]float64 `msgpack:"metrics,omitempty"` // arbitrary map of numeric metrics
	SpanID    uint64             `msgpack:"span_id"`           // identifier of this span
	TraceID   uint64             `msgpack:"trace_id"`          // identifier of the root span
	ParentID  uint64             `msgpack:"parent_id"`         // identifier of the span's direct parent
	Error     int32              `msgpack:"error"`             // error status of the span; 0 means no errors
}

Span is a single dd-trace span

https://github.com/DataDog/dd-trace-go/blob/v1/ddtrace/tracer/span.go

func DecodeSpans

func DecodeSpans(data []byte) ([]Span, error)

DecodeSpans decodes an array of spans from a msgpack encoded array

type Trace

type Trace []*Span

Trace is a collection of spans with the same trace ID

type Traces

type Traces []Trace

Traces is a collection of traces for unmarshalling

Jump to

Keyboard shortcuts

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