codec

package
v1.26.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2023 License: MIT Imports: 3 Imported by: 33

Documentation

Index

Constants

View Source
const DefaultServiceName = "unknown"

DefaultServiceName when the span does not have any serviceName

Variables

This section is empty.

Functions

func MicroToTime

func MicroToTime(micro int64) time.Time

MicroToTime converts zipkin's native time of microseconds into time.Time

func NewAnnotations

func NewAnnotations(annotations []Annotation, endpoint Endpoint) []trace.Annotation

NewAnnotations converts a slice of Annotation into a slice of new Annotations

func NewBinaryAnnotations

func NewBinaryAnnotations(annotations []BinaryAnnotation, endpoint Endpoint) []trace.BinaryAnnotation

NewBinaryAnnotations is very similar to NewAnnotations, but it converts BinaryAnnotations instead of the normal Annotation

func NewTrace

func NewTrace(spans []Span) (trace.Trace, error)

NewTrace converts a slice of []Span into a new Trace

Types

type Annotation

type Annotation interface {
	Timestamp() time.Time
	Value() string
	Host() Endpoint
}

Annotation represents an event that explains latency with a timestamp.

type BinaryAnnotation

type BinaryAnnotation interface {
	Key() string
	Value() string
	Host() Endpoint
}

BinaryAnnotation represent tags applied to a Span to give it context

type Decoder

type Decoder interface {
	Decode(octets []byte) ([]Span, error)
}

Decoder decodes the bytes and returns a trace

type DefaultEndpoint

type DefaultEndpoint struct{}

DefaultEndpoint is used if the annotations have no endpoints

func (*DefaultEndpoint) Host

func (d *DefaultEndpoint) Host() string

Host returns 0.0.0.0; used when the host is unknown

func (*DefaultEndpoint) Name

func (d *DefaultEndpoint) Name() string

Name returns "unknown" when an endpoint doesn't exist

type Endpoint

type Endpoint interface {
	Host() string
	Name() string
}

Endpoint represents the network context of a service recording an annotation

type Span

type Span interface {
	Trace() (string, error)
	SpanID() (string, error)
	Parent() (string, error)
	Name() string
	Annotations() []Annotation
	BinaryAnnotations() ([]BinaryAnnotation, error)
	Timestamp() time.Time
	Duration() time.Duration
}

Span are created by instrumentation in RPC clients or servers

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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