Documentation ¶
Overview ¶
Package trace provides support for tracing operations.
Index ¶
- Variables
- func Counter(namespace string, name string) metric.Int64Counter
- func EndSpanErr(span trace.Span, err error)
- func EndSpanErrorf(span trace.Span, format string, args ...interface{})
- func EndSpanOk(span trace.Span)
- func Gauge(namespace string, name string) metric.Int64ObservableGauge
- func GetMethodName(method string) string
- func Hexify(key string, val []byte) attribute.KeyValue
- func Histogram(namespace string, name string) metric.Int64Histogram
- func Init(ctx context.Context)
- func NewSpan(ctx context.Context, name string, attrs ...attribute.KeyValue) (context.Context, trace.Span)
- func SetAttributes(ctx context.Context, attrs ...attribute.KeyValue)
- func Uint64(key string, val uint64) attribute.KeyValue
- func UpDownCounter(namespace string, name string) metric.Int64UpDownCounter
- type KeyValue
- type Span
Constants ¶
This section is empty.
Variables ¶
var ( Bool = attribute.Bool Int = attribute.Int Int64 = attribute.Int64 Float64 = attribute.Float64 SpanFromContext = trace.SpanFromContext String = attribute.String Stringer = attribute.Stringer )
Re-export useful functions from the the otel trace package.
Functions ¶
func Counter ¶
func Counter(namespace string, name string) metric.Int64Counter
Counter creates an instrument for recording increasing values.
func EndSpanErr ¶
EndSpanErr ends the span with an error status containing the given error as its description.
func EndSpanErrorf ¶
EndSpanErrorf ends the span with an error status containing the given printf-formatted description.
func Gauge ¶
func Gauge(namespace string, name string) metric.Int64ObservableGauge
Gauge creates an instrument for recording the current value.
func GetMethodName ¶
GetMethodName returns the method name from a fully qualified gRPC method value.
func Histogram ¶
func Histogram(namespace string, name string) metric.Int64Histogram
Histogram creates an instrument for recording a distribution of values.
func Init ¶
Init initializes the global tracer provider with an OTLP (OpenTelemetry Protocol) exporter.
func NewSpan ¶
func NewSpan(ctx context.Context, name string, attrs ...attribute.KeyValue) (context.Context, trace.Span)
NewSpan returns a new span for the given context.
func SetAttributes ¶
SetAttributes sets the given attributes on the span for the given context.
func UpDownCounter ¶
func UpDownCounter(namespace string, name string) metric.Int64UpDownCounter
UpDownCounter creates an instrument for recording changes of a value.