Documentation ¶
Overview ¶
Package tracing implements utility functions for interacting with a global tracing system. Currently this system uses the opentelemetry APIs.
Index ¶
- func FinishSpans(batch message.Batch)
- func GetTraceID(p *message.Part) string
- func InitSpan(prov trace.TracerProvider, operationName string, part *message.Part) *message.Part
- func InitSpans(prov trace.TracerProvider, operationName string, batch message.Batch)
- func InitSpansFromParentTextMap(prov trace.TracerProvider, operationName string, textMapGeneric map[string]any, ...) error
- type Span
- func GetActiveSpan(p *message.Part) *Span
- func GetSpan(p *message.Part) *Span
- func GetSpanFromContext(ctx context.Context) *Span
- func WithChildSpan(prov trace.TracerProvider, operationName string, part *message.Part) (*message.Part, *Span)
- func WithChildSpans(prov trace.TracerProvider, operationName string, batch message.Batch) (message.Batch, []*Span)
- func WithSiblingSpans(prov trace.TracerProvider, operationName string, batch message.Batch) (message.Batch, []*Span)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FinishSpans ¶
FinishSpans calls Finish on all message parts containing a span.
func GetTraceID ¶
GetTraceID returns the traceID from a span attached to a message part. Returns a zeroed traceID if the part doesn't have a span attached.
func InitSpan ¶
InitSpan sets up an OpenTracing span on a message part if one does not already exist.
func InitSpans ¶
func InitSpans(prov trace.TracerProvider, operationName string, batch message.Batch)
InitSpans sets up OpenTracing spans on each message part if one does not already exist.
func InitSpansFromParentTextMap ¶
func InitSpansFromParentTextMap(prov trace.TracerProvider, operationName string, textMapGeneric map[string]any, batch message.Batch) error
InitSpansFromParentTextMap obtains a span parent reference from a text map and creates child spans for each message.
Types ¶
type Span ¶
type Span struct {
// contains filtered or unexported fields
}
Span abstracts the span type of our global tracing system in order to allow it to be replaced in future.
func GetActiveSpan ¶
GetActiveSpan returns a span attached to a message part. Returns nil if the part doesn't have a span attached or it is inactive.
func GetSpan ¶
GetSpan returns a span attached to a message part. Returns nil if the part doesn't have a span attached.
func GetSpanFromContext ¶
GetSpan returns a span within a context. Returns nil if the context doesn't have a span attached.
func WithChildSpan ¶
func WithChildSpan(prov trace.TracerProvider, operationName string, part *message.Part) (*message.Part, *Span)
WithChildSpan takes a message, extracts a span, creates a new child span, and returns a new message with that span embedded. The original message is unchanged.
func WithChildSpans ¶
func WithChildSpans(prov trace.TracerProvider, operationName string, batch message.Batch) (message.Batch, []*Span)
WithChildSpans takes a message, extracts spans per message part, creates new child spans, and returns a new message with those spans embedded. The original message is unchanged.
func WithSiblingSpans ¶
func WithSiblingSpans(prov trace.TracerProvider, operationName string, batch message.Batch) (message.Batch, []*Span)
WithSiblingSpans takes a message, extracts spans per message part, creates new sibling spans, and returns a new message with those spans embedded. The original message is unchanged.