codec

package
v1.36.3 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2025 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 Spans into a new Trace.

Types

type Annotation

type Annotation interface {
	// Timestamp returns the timestamp of the annotation.
	Timestamp() time.Time
	// Value returns the value of the annotation.
	Value() string
	// Host returns the endpoint associated with the annotation.
	Host() Endpoint
}

Annotation represents an event that explains latency with a timestamp.

type BinaryAnnotation

type BinaryAnnotation interface {
	// Key returns the key of the binary annotation.
	Key() string
	// Value returns the value of the binary annotation.
	Value() string
	// Host returns the endpoint associated with the binary annotation.
	Host() Endpoint
}

BinaryAnnotation represents tags applied to a Span to give it context.

type Decoder

type Decoder interface {
	// Decode decodes the given byte slice into a slice of Spans.
	Decode(octets []byte) ([]Span, error)
}

Decoder decodes the bytes and returns a trace

type Endpoint

type Endpoint interface {
	// Host returns the host address of the endpoint.
	Host() string
	// Name returns the name of the service associated with the endpoint.
	Name() string
}

Endpoint represents the network context of a service recording an annotation.

type Span

type Span interface {
	// Trace returns the trace ID of the span.
	Trace() (string, error)
	// SpanID returns the span ID.
	SpanID() (string, error)
	// Parent returns the parent span ID.
	Parent() (string, error)
	// Name returns the name of the span.
	Name() string
	// Annotations returns the annotations of the span.
	Annotations() []Annotation
	// BinaryAnnotations returns the binary annotations of the span.
	BinaryAnnotations() ([]BinaryAnnotation, error)
	// Timestamp returns the timestamp of the span.
	Timestamp() time.Time
	// Duration returns the duration of the span.
	Duration() time.Duration
}

Span represents a span 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