tracing

package
v0.0.0-...-b49207b Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2024 License: MIT Imports: 14 Imported by: 16

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractMetadataFromContext

func ExtractMetadataFromContext(ctx context.Context) map[string]string

ExtractMetadataFromContext extracts traceparent id from given context and returns it in a map following a format {"traceparent": "<id>"}.

func InitProvider

func InitProvider(ctx context.Context, serviceName, otelColelctorAddr string) (func() error, error)

InitProvider initializes the global meter and tracer providers and returns a func used to close exporters running in the background or an error if the initialization failed. Traces and metrics are exported to OTel Collector using gRPC. Takes a service name to use as a label for exported resource and address to the OTel Collector.

func InjectMetadataIntoContext

func InjectMetadataIntoContext(ctx context.Context, metadata map[string]string) context.Context

InjectMetadataIntoContext takes in a map following a format {"traceparent": "<id>"} and returns a new context with the metadata appended.

func SetSpanErr

func SetSpanErr(span trace.Span, err error)

SetSpanErr records given error to the span and sets the span's status as Error with err.Error() as the description. If the span is not recording or given err is nil then this func will not do anything.

Types

This section is empty.

Jump to

Keyboard shortcuts

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