Documentation
¶
Index ¶
- Constants
- func CheckSetDefaultTextMapPropagator()
- func GetBaggageMap(ctx context.Context) map[string]any
- func GetBaggageVar(ctx context.Context, key string) *mvar.Var
- func GetDefaultTextMapPropagator() propagation.TextMapPropagator
- func GetSpanID(ctx context.Context) string
- func GetTraceID(ctx context.Context) string
- func IsUsingMaltoseProvider() bool
- func NewProvider(opts ...sdkTrace.TracerProviderOption) trace.TracerProvider
- func SetBaggageMap(ctx context.Context, data map[string]any) context.Context
- func SetBaggageValue(ctx context.Context, key string, value any) context.Context
- func SetProvider(p trace.TracerProvider)
- func WithTraceID(ctx context.Context, traceID string) (context.Context, error)
- func WithUUID(ctx context.Context, uuid string) (context.Context, error)
- type Baggage
- type Span
- type Tracer
Constants ¶
const ( AttributeHTTPMethod = "http.method" AttributeHTTPUrl = "http.url" AttributeHTTPTarget = "http.target" AttributeHTTPHost = "http.host" AttributeHTTPScheme = "http.scheme" AttributeHTTPStatusCode = "http.status_code" AttributeHTTPStatusText = "http.status_text" AttributeHTTPFlavor = "http.flavor" AttributeHTTPUserAgent = "http.user_agent" AttributeHTTPRequestSize = "http.request_content_length" AttributeHTTPResponseSize = "http.response_content_length" AttributeHTTPRoute = "http.route" AttributeHTTPClientIP = "http.client_ip" )
Semantic conventions for HTTP.
Variables ¶
This section is empty.
Functions ¶
func CheckSetDefaultTextMapPropagator ¶
func CheckSetDefaultTextMapPropagator()
CheckSetDefaultTextMapPropagator checks if the default TextMapPropagator is set.
func GetBaggageMap ¶
GetBaggageMap gets and returns the map of baggage values.
func GetBaggageVar ¶
GetBaggageVar gets and returns the value of the specified key from baggage.
func GetDefaultTextMapPropagator ¶
func GetDefaultTextMapPropagator() propagation.TextMapPropagator
GetDefaultTextMapPropagator returns the default TextMapPropagator for context propagation.
func GetTraceID ¶
GetTraceID gets the trace id from the context.
func IsUsingMaltoseProvider ¶ added in v0.1.3
func IsUsingMaltoseProvider() bool
IsUsingMaltoseProvider checks if the trace provider is a Maltose provider.
func NewProvider ¶ added in v0.1.3
func NewProvider(opts ...sdkTrace.TracerProviderOption) trace.TracerProvider
NewProvider creates a new Maltose TracerProvider with custom options. It uses the OpenTelemetry SDK's default IDGenerator (random IDs) by default, which can be overridden by providing a custom `sdktrace.WithIDGenerator` option.
func SetBaggageMap ¶
SetBaggageMap is a convenient function for adding multiple key-value pairs to baggage.
func SetBaggageValue ¶
SetBaggageValue is a convenient function for adding a key-value pair to baggage.
func SetProvider ¶ added in v0.1.3
func SetProvider(p trace.TracerProvider)
SetProvider sets the global tracer provider.
func WithTraceID ¶
WithTraceID injects a custom trace id into the context.
Types ¶
type Baggage ¶
type Baggage struct {
// contains filtered or unexported fields
}
Baggage is a mechanism for propagating key-value data in a distributed system. It allows attaching custom data (such as user ID, request ID, etc.) to traces and propagating them across service calls.
func NewBaggage ¶
NewBaggage creates a new Baggage instance.