otel

package
v0.0.7-beta Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const METRIC_EXPORT_INTERVAL = 10 * time.Second

Batch interval for sending metrics to the OTEL collector

Variables

This section is empty.

Functions

func ContextWithHeaders

func ContextWithHeaders(r *http.Request) context.Context

Helper function which extracts and propagates OTEL TraceContext, Baggage, and StanzaHeaders from a given http.Request.

func GetFeature

func GetFeature(ctx context.Context, fn *string) (context.Context, *string)

func GetPriorityBoost

func GetPriorityBoost(ctx context.Context, pb *int32) (context.Context, *int32)

func GetTextMapPropagator

func GetTextMapPropagator() propagation.TextMapPropagator

GetTextMapPropagator is a passthrough helper function

func GetTracerProvider

func GetTracerProvider() trace.TracerProvider

GetTracePropagator is a passthrough helper function

func InitTextMapPropagator

func InitTextMapPropagator(propagator propagation.TextMapPropagator)

InitTextMapPropagator is a passthrough helper function

func Setup

func Setup(ctx context.Context, sc SetupConfig) (shutdown func(context.Context) error, err error)

Setup bootstraps the OpenTelemetry export pipeline. If it does not return an error, make sure to call shutdown for proper cleanup.

Types

type MetadataSupplier

type MetadataSupplier struct {
	Metadata *metadata.MD
}

func (*MetadataSupplier) Get

func (s *MetadataSupplier) Get(key string) string

Set returns value for given key from metadata.

func (*MetadataSupplier) Keys

func (s *MetadataSupplier) Keys() []string

Keys returns the keys who's values are set with Inject.

func (*MetadataSupplier) Set

func (s *MetadataSupplier) Set(key string, value string)

Set sets key-value pairs in metadata.

type SetupConfig

type SetupConfig struct {
	ServiceName        string
	ServiceVersion     string
	ServiceEnvironment string
	Headers            map[string]string
	MetricCollector    string
	TraceCollector     string
	TraceSampleRate    float64
}

type StanzaHeaders

type StanzaHeaders struct{}

func (StanzaHeaders) Extract

Extract returns a copy of parent with the Stanza Headers from the carrier added.

func (StanzaHeaders) Fields

func (s StanzaHeaders) Fields() (headers []string)

Fields returns the keys who's values are set with Inject.

func (StanzaHeaders) Inject

func (s StanzaHeaders) Inject(ctx context.Context, carrier propagation.TextMapCarrier)

Inject sets Stanza Headers from ctx into the carrier.

Jump to

Keyboard shortcuts

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