Documentation ¶
Index ¶
- func ExtractMetadataFromContext(ctx context.Context) map[string]string
- func InitProvider(ctx context.Context, serviceName, otelColelctorAddr string) (func() error, error)
- func InjectMetadataIntoContext(ctx context.Context, metadata map[string]string) context.Context
- func SetSpanErr(span trace.Span, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractMetadataFromContext ¶
ExtractMetadataFromContext extracts traceparent id from given context and returns it in a map following a format {"traceparent": "<id>"}.
func InitProvider ¶
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 ¶
InjectMetadataIntoContext takes in a map following a format {"traceparent": "<id>"} and returns a new context with the metadata appended.
func SetSpanErr ¶
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.