package otelutil

import "github.com/docker/buildx/util/otelutil"

Index

Types

type JaegerData

type JaegerData struct {
	Data []jaeger.Trace `json:"data"`
}

type Span

type Span struct {
	// Name is the name of a specific span
	Name string
	// SpanContext is the unique SpanContext that identifies the span
	SpanContext trace.SpanContext
	// Parten is the unique SpanContext that identifies the parent of the span.
	// If the span has no parent, this span context will be invalid.
	Parent trace.SpanContext
	// SpanKind is the role the span plays in a Trace
	SpanKind trace.SpanKind
	// StartTime is the time the span started recording
	StartTime time.Time
	// EndTime returns the time the span stopped recording
	EndTime time.Time
	// Attributes are the defining attributes of a span
	Attributes []attribute.KeyValue
	// Events are all the events that occurred within the span
	Events []tracesdk.Event
	// Links are all the links the span has to other spans
	Links []tracesdk.Link
	// Status is that span status
	Status tracesdk.Status
	// DroppedAttributes is the number of attributes dropped by the span due to
	// a limit being reached
	DroppedAttributes int
	// DroppedEvents is the number of attributes dropped by the span due to a
	// limit being reached
	DroppedEvents int
	// DroppedLinks is the number of links dropped by the span due to a limit
	// being reached
	DroppedLinks int
	// ChildSpanCount is the count of spans that consider the span a direct
	// parent
	ChildSpanCount int
	// Resource is the information about the entity that produced the span
	// We have to change this type from the otel type to make this struct
	// marshallable
	Resource []attribute.KeyValue
	// InstrumentationLibrary is information about the library that produced
	// the span
	//nolint:staticcheck
	InstrumentationLibrary instrumentation.Library
}

Span is a type similar to otel's SpanStub, but with the correct types needed for handle marshaling and unmarshalling.

func (*Span) Snapshot

func (s *Span) Snapshot() tracesdk.ReadOnlySpan

Snapshot turns a Span into a ReadOnlySpan which is exportable by otel.

func (*Span) UnmarshalJSON

func (s *Span) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler for Span which allows correctly retrieving attribute.KeyValue values.

type Spans

type Spans []Span

func ParseSpanStubs

func ParseSpanStubs(rdr io.Reader) (Spans, error)

ParseSpanStubs parses BuildKit trace data into a list of SpanStubs.

func (Spans) JaegerData

func (s Spans) JaegerData() JaegerData

JaegerData return Jaeger data compatible with ui import feature. https://github.com/jaegertracing/jaeger-ui/issues/381#issuecomment-494150826

func (Spans) Len

func (s Spans) Len() int

Len return the length of the Spans.

func (Spans) ReadOnlySpans

func (s Spans) ReadOnlySpans() []tracesdk.ReadOnlySpan

ReadOnlySpans return a list of tracesdk.ReadOnlySpan from span stubs.

Source Files

jaeger.go span.go

Directories

PathSynopsis
util/otelutil/jaeger
Version
v0.22.0 (latest)
Published
Mar 17, 2025
Platform
linux/amd64
Imports
14 packages
Last checked
4 weeks ago

Tools for package owners.