traceutil

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2025 License: Apache-2.0, MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithLink(ctx context.Context, sc trace.SpanContext) context.Context

ContextWithLink stores a link on the context without setting a parent.

func LinkFromContext

func LinkFromContext(ctx context.Context) (trace.Link, bool)

LinkFromContext retrieves a span link added by the worker when a trace context was present at enqueue time.

func MarshalPayload

func MarshalPayload(payload *SpanContextPayload) ([]byte, error)

func SpanContextFromPayload

func SpanContextFromPayload(payload *SpanContextPayload) (trace.SpanContext, bool)

SpanContextFromPayload reconstructs a span context from a payload.

func StartSpan

func StartSpan(ctx context.Context, tracer trace.Tracer, name string, opts ...trace.SpanStartOption) (context.Context, trace.Span)

StartSpan creates a new span that is linked (not parented) to the stored trace context if present.

Types

type SpanContextPayload

type SpanContextPayload struct {
	TraceID    string `json:"trace_id"`
	SpanID     string `json:"span_id"`
	TraceFlags uint8  `json:"trace_flags,omitempty"`
	TraceState string `json:"trace_state,omitempty"`
}

SpanContextPayload is a lightweight representation of a span context for persistence.

func PayloadFromContext

func PayloadFromContext(ctx context.Context) *SpanContextPayload

PayloadFromContext builds a payload from the span context on the provided context.

func PayloadFromSpanContext

func PayloadFromSpanContext(sc trace.SpanContext) *SpanContextPayload

PayloadFromSpanContext builds a payload from a span context.

func UnmarshalPayload

func UnmarshalPayload(b []byte) (*SpanContextPayload, error)

Jump to

Keyboard shortcuts

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