Documentation ¶
Overview ¶
Package tracing implements utility functions for interacting with a global tracing system. Currently this system uses the opentracing APIs. However, eventually we will need to migrate to the new opentelemetry APIs, and therefore in order to reduce disruption this package abstracts interaction with these packages.
Index ¶
- func FinishSpans(msg message.Batch)
- func InitSpan(prov trace.TracerProvider, operationName string, part *message.Part) *message.Part
- func InitSpanFromParent(prov trace.TracerProvider, operationName string, parent *Span, ...) *message.Part
- func InitSpans(prov trace.TracerProvider, operationName string, msg message.Batch)
- func InitSpansFromParent(prov trace.TracerProvider, operationName string, parent *Span, ...)
- func InitSpansFromParentTextMap(prov trace.TracerProvider, operationName string, ...) error
- func IterateWithChildSpans(prov trace.TracerProvider, operationName string, msg message.Batch, ...) error
- func WithSiblingSpans(prov trace.TracerProvider, operationName string, msg message.Batch) message.Batch
- type Span
- func CreateChildSpan(prov trace.TracerProvider, operationName string, part *message.Part) *Span
- func CreateChildSpans(prov trace.TracerProvider, operationName string, msg message.Batch) []*Span
- func GetSpan(p *message.Part) *Span
- func PartsWithChildSpans(prov trace.TracerProvider, operationName string, parts []*message.Part) ([]*message.Part, []*Span)
- func WithChildSpans(prov trace.TracerProvider, operationName string, msg 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 InitSpan ¶
InitSpan sets up an OpenTracing span on a message part if one does not already exist.
func InitSpanFromParent ¶
func InitSpanFromParent(prov trace.TracerProvider, operationName string, parent *Span, part *message.Part) *message.Part
InitSpanFromParent sets up an OpenTracing span as children of a parent span on a message part if one does not already exist.
func InitSpans ¶
func InitSpans(prov trace.TracerProvider, operationName string, msg message.Batch)
InitSpans sets up OpenTracing spans on each message part if one does not already exist.
func InitSpansFromParent ¶
func InitSpansFromParent(prov trace.TracerProvider, operationName string, parent *Span, msg message.Batch)
InitSpansFromParent sets up OpenTracing spans as children of a parent span on each message part if one does not already exist.
func InitSpansFromParentTextMap ¶
func InitSpansFromParentTextMap(prov trace.TracerProvider, operationName string, textMapGeneric map[string]interface{}, msg message.Batch) error
InitSpansFromParentTextMap obtains a span parent reference from a text map and creates child spans for each message.
func IterateWithChildSpans ¶
func IterateWithChildSpans(prov trace.TracerProvider, operationName string, msg message.Batch, iter func(int, *Span, *message.Part) error) error
IterateWithChildSpans iterates all the parts of a message and, for each part, creates a new span from an existing span attached to the part and calls a func with that span before finishing the child span.
func WithSiblingSpans ¶
func WithSiblingSpans(prov trace.TracerProvider, operationName string, msg message.Batch) message.Batch
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.
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 CreateChildSpan ¶
CreateChildSpan takes a message part, extracts an existing span if there is one and returns child span.
func CreateChildSpans ¶
CreateChildSpans takes a message, extracts spans per message part and returns a slice of child spans. The length of the returned slice is guaranteed to match the message size.
func GetSpan ¶
GetSpan returns a span attached to a message part. Returns nil if the part doesn't have a span attached.
func PartsWithChildSpans ¶
func PartsWithChildSpans(prov trace.TracerProvider, operationName string, parts []*message.Part) ([]*message.Part, []*Span)
PartsWithChildSpans takes a slice of message parts, extracts spans per part, creates new child spans, and returns a new slice of parts with those spans embedded. The original parts are unchanged.
func WithChildSpans ¶
func WithChildSpans(prov trace.TracerProvider, operationName string, msg 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.