tracing

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AttrRPCType      = attribute.Key("grip.rpc.type")
	AttrAdmission    = attribute.Key("grip.admission.result")
	AttrRetryAttempt = attribute.Key("grip.retry.attempt")
	AttrFailureKind  = attribute.Key("grip.failure.kind")
)

Common attribute keys for GRIP spans.

Functions

func AdmissionResult

func AdmissionResult(result string) attribute.KeyValue

AdmissionResult returns an attribute for the admission result.

func FailureKind

func FailureKind(kind string) attribute.KeyValue

FailureKind returns an attribute for the failure kind.

func RPCType

func RPCType(rpcType string) attribute.KeyValue

RPCType returns an attribute for the RPC type.

func RetryAttempt

func RetryAttempt(attempt int) attribute.KeyValue

RetryAttempt returns an attribute for the retry attempt number.

Types

type Option

type Option func(*Tracer)

Option configures the tracer.

func WithTracerProvider

func WithTracerProvider(tp trace.TracerProvider) Option

WithTracerProvider sets a custom TracerProvider.

type Tracer

type Tracer struct {
	// contains filtered or unexported fields
}

Tracer wraps OpenTelemetry tracing for GRIP execution pipelines.

It creates spans for each execution, recording:

  • RPC type (unary, server-stream, client-stream, bidi-stream)
  • Admission decisions
  • Supervisor lifecycle events
  • Error classification

func New

func New(opts ...Option) *Tracer

New creates a new GRIP tracer.

If no TracerProvider is set, uses the global provider.

func NoopTracer

func NoopTracer() *Tracer

NoopTracer returns a tracer that does nothing. Useful for tests and when tracing is not configured.

func (*Tracer) EndSpan

func (t *Tracer) EndSpan(span trace.Span, err error)

EndSpan ends a span, recording error status if present.

func (*Tracer) RecordEvent

func (t *Tracer) RecordEvent(ctx context.Context, name string, attrs ...attribute.KeyValue)

RecordEvent adds an event to the current span.

func (*Tracer) StartSpan

func (t *Tracer) StartSpan(ctx context.Context, name string, attrs ...attribute.KeyValue) (context.Context, trace.Span)

StartSpan creates a new span for a GRIP execution.

The returned context contains the span. Caller MUST call EndSpan when the execution completes.

Jump to

Keyboard shortcuts

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