gtrace

package
v1.16.9 Latest Latest
Warning

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

Go to latest
Published: May 30, 2022 License: MIT Imports: 14 Imported by: 2

Documentation

Overview

Package gtrace provides convenience wrapping functionality for tracing feature using OpenTelemetry.

Index

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

func CommonLabels() []attribute.KeyValue

CommonLabels returns common used attribute labels: ip.intranet, hostname.

func GetBaggageMap added in v1.15.4

func GetBaggageMap(ctx context.Context) *gmap.StrAnyMap

GetBaggageMap retrieves and returns the baggage values as map.

func GetBaggageVar

func GetBaggageVar(ctx context.Context, key string) *gvar.Var

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

func GetSpanId(ctx context.Context) string

GetSpanId retrieves and returns SpanId from context. It returns an empty string is tracing feature is not activated.

func GetTraceId

func GetTraceId(ctx context.Context) string

GetTraceId retrieves and returns TraceId from context. It returns an empty string is tracing feature is not activated.

func IsActivated

func IsActivated(ctx context.Context) bool

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

func SetBaggageMap(ctx context.Context, data map[string]interface{}) context.Context

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.

func SetBaggageValue

func SetBaggageValue(ctx context.Context, key string, value interface{}) context.Context

SetBaggageValue is a convenient function for adding one key-value pair 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

func NewBaggage(ctx context.Context) *Baggage

NewBaggage creates and returns a new Baggage object from given tracing context.

func (*Baggage) Ctx added in v1.15.4

func (b *Baggage) Ctx() context.Context

Ctx returns the context that Baggage holds.

func (*Baggage) GetMap added in v1.15.4

func (b *Baggage) GetMap() *gmap.StrAnyMap

GetMap retrieves and returns the baggage values as map.

func (*Baggage) GetVar added in v1.15.4

func (b *Baggage) GetVar(key string) *gvar.Var

GetVar retrieves value and returns a *gvar.Var for specified key from baggage.

func (*Baggage) SetMap added in v1.15.4

func (b *Baggage) SetMap(data map[string]interface{}) context.Context

SetMap is a convenient function for adding map key-value pairs to baggage. Note that it uses attribute.Any to set the key-value pair.

func (*Baggage) SetValue added in v1.15.4

func (b *Baggage) SetValue(key string, value interface{}) context.Context

SetValue is a convenient function for adding one key-value pair to baggage. Note that it uses attribute.Any to set the key-value pair.

type Carrier added in v1.15.4

type Carrier map[string]interface{}

Carrier is the storage medium used by a TextMapPropagator.

func NewCarrier added in v1.15.4

func NewCarrier(data ...map[string]interface{}) Carrier

func (Carrier) Get added in v1.15.4

func (c Carrier) Get(k string) string

Get returns the value associated with the passed key.

func (Carrier) Keys added in v1.15.5

func (c Carrier) Keys() []string

Keys lists the keys stored in this carrier.

func (Carrier) MustMarshal added in v1.15.4

func (c Carrier) MustMarshal() []byte

func (Carrier) Set added in v1.15.4

func (c Carrier) Set(k, v string)

Set stores the key-value pair.

func (Carrier) String added in v1.15.4

func (c Carrier) String() string

func (Carrier) UnmarshalJSON added in v1.15.4

func (c Carrier) UnmarshalJSON(b []byte) error

type Span added in v1.15.4

type Span struct {
	trace.Span
}

func NewSpan added in v1.15.4

func NewSpan(ctx context.Context, spanName string, opts ...trace.SpanStartOption) (context.Context, *Span)

NewSpan creates a span using default tracer.

type Tracer

type Tracer struct {
	trace.Tracer
}

func NewTracer added in v1.15.4

func NewTracer(name ...string) *Tracer

Tracer is a short function for retrieving Tracer.

Jump to

Keyboard shortcuts

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