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 IsUsingDefaultProvider() bool
- func SetBaggageMap(ctx context.Context, data map[string]any) context.Context
- func SetBaggageValue(ctx context.Context, key string, value any) context.Context
- 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 IsUsingDefaultProvider ¶
func IsUsingDefaultProvider() bool
IsUsingDefaultProvider checks if the default trace provider is used.
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 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.