trace

package
v0.4.36 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package trace provides support for tracing operations.

Index

Constants

This section is empty.

Variables

View Source
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

func EndSpanErr(span trace.Span, err error)

EndSpanErr ends the span with an error status containing the given error as its description.

func EndSpanErrorf

func EndSpanErrorf(span trace.Span, format string, args ...interface{})

EndSpanErrorf ends the span with an error status containing the given printf-formatted description.

func EndSpanOk

func EndSpanOk(span trace.Span)

EndSpanOk ends the span with an ok status.

func Gauge

func Gauge(namespace string, name string) metric.Int64ObservableGauge

Gauge creates an instrument for recording the current value.

func GetMethodName

func GetMethodName(method string) string

GetMethodName returns the method name from a fully qualified gRPC method value.

func Hexify

func Hexify(key string, val []byte) attribute.KeyValue

Hexify returns a byte slice encoded in hex for trace attributes.

func Histogram

func Histogram(namespace string, name string) metric.Int64Histogram

Histogram creates an instrument for recording a distribution of values.

func Init

func Init(ctx context.Context)

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

func SetAttributes(ctx context.Context, attrs ...attribute.KeyValue)

SetAttributes sets the given attributes on the span for the given context.

func Uint64

func Uint64(key string, val uint64) attribute.KeyValue

Uint64 returns a uint64 encoded as a string for trace attributes.

func UpDownCounter

func UpDownCounter(namespace string, name string) metric.Int64UpDownCounter

UpDownCounter creates an instrument for recording changes of a value.

Types

type KeyValue

type KeyValue = attribute.KeyValue

KeyValue is an alias for the opentelemetry attribute.KeyValue type.

type Span

type Span = trace.Span

Span is an alias for the opentelemetry trace.Span type.

Jump to

Keyboard shortcuts

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