Documentation
¶
Overview ¶
Package tracing provides OpenTelemetry trace integration for GRIP.
This package creates spans for gRPC handler execution and records events for admission, retry, and failure classification.
Example:
tracer := tracing.New(tracing.Config{
TracerProvider: otel.GetTracerProvider(),
ServiceName: "my-service",
})
Package tracing provides OpenTelemetry trace integration for GRIP execution pipelines.
The tracer creates spans for each execution, recording RPC type, admission decisions, supervisor lifecycle events, and error classification.
Usage:
tracer := tracing.New() // uses global TracerProvider tracer := tracing.New(tracing.WithTracerProvider(tp)) // custom provider
Integration with GRIP pipelines:
u := unary.New(unary.WithTracer(tracer))
Manual span management:
ctx, span := tracer.StartSpan(ctx, "my.operation",
tracing.RPCType("unary"),
)
defer tracer.EndSpan(span, err)
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // RPCType returns an attribute for the RPC type. RPCType = it.RPCType // AdmissionResult returns an attribute for the admission result. AdmissionResult = it.AdmissionResult // RetryAttempt returns an attribute for the retry attempt number. RetryAttempt = it.RetryAttempt // FailureKind returns an attribute for the failure kind. FailureKind = it.FailureKind )
Attribute helpers for GRIP spans.
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.
var NoopTracer = it.NoopTracer
NoopTracer returns a tracer that does nothing.
Functions ¶
This section is empty.
Types ¶
type Option ¶
Option configures the tracer.
func WithTracerProvider ¶
func WithTracerProvider(tp trace.TracerProvider) Option
WithTracerProvider sets a custom TracerProvider.