Documentation ¶
Overview ¶
Package gtrace provides convenience wrapping functionality for tracing feature using OpenTelemetry.
Index ¶
- func CheckSetDefaultTextMapPropagator()
- func CommonLabels() []attribute.KeyValue
- func GetBaggageMap(ctx context.Context) *gmap.StrAnyMap
- func GetBaggageVar(ctx context.Context, key string) *gvar.Var
- func GetDefaultTextMapPropagator() propagation.TextMapPropagator
- func GetSpanId(ctx context.Context) string
- func GetTraceId(ctx context.Context) string
- func IsActivated(ctx context.Context) bool
- func IsTracingInternal() bool
- func MaxContentLogSize() int
- func SetBaggageMap(ctx context.Context, data map[string]interface{}) context.Context
- func SetBaggageValue(ctx context.Context, key string, value interface{}) context.Context
- type Baggage
- type Carrier
- type Span
- type Tracer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckSetDefaultTextMapPropagator ¶ added in v1.15.4
func CheckSetDefaultTextMapPropagator()
CheckSetDefaultTextMapPropagator sets the default TextMapPropagator if it is not set previously.
func CommonLabels ¶
CommonLabels returns common used attribute labels: ip.intranet, hostname.
func GetBaggageMap ¶ added in v1.15.4
GetBaggageMap retrieves and returns the baggage values as map.
func GetBaggageVar ¶
GetBaggageVar retrieves value and returns a *gvar.Var for specified key from baggage.
func GetDefaultTextMapPropagator ¶ added in v1.15.4
func GetDefaultTextMapPropagator() propagation.TextMapPropagator
GetDefaultTextMapPropagator returns the default propagator for context propagation between peers.
func GetSpanId ¶
GetSpanId retrieves and returns SpanId from context. It returns an empty string is tracing feature is not activated.
func GetTraceId ¶
GetTraceId retrieves and returns TraceId from context. It returns an empty string is tracing feature is not activated.
func IsActivated ¶
IsActivated checks and returns if tracing feature is activated.
func IsTracingInternal ¶ added in v1.16.5
func IsTracingInternal() bool
IsTracingInternal returns whether tracing spans of internal components.
func MaxContentLogSize ¶ added in v1.15.5
func MaxContentLogSize() int
MaxContentLogSize returns the max log size for request and response body, especially for HTTP/RPC request.
func SetBaggageMap ¶
SetBaggageMap is a convenient function for adding map key-value pairs to baggage. Note that it uses attribute.Any to set the key-value pair.
Types ¶
type Baggage ¶ added in v1.15.4
type Baggage struct {
// contains filtered or unexported fields
}
Baggage holds the data through all tracing spans.
func NewBaggage ¶ added in v1.15.4
NewBaggage creates and returns a new Baggage object from given tracing context.
func (*Baggage) GetVar ¶ added in v1.15.4
GetVar retrieves value and returns a *gvar.Var for specified key from baggage.
type Carrier ¶ added in v1.15.4
type Carrier map[string]interface{}
Carrier is the storage medium used by a TextMapPropagator.