Documentation
¶
Overview ¶
Package obs is packtrail's OpenTelemetry instrumentation. It uses the OTel API only: the application chooses the SDK and exporters, and without one every span and instrument is a no-op. The wire format of trace context is the W3C traceparent header, as before.
Index ¶
- Constants
- func ContextWithTraceparent(ctx context.Context, tp string) context.Context
- func Extract(ctx context.Context, h nats.Header) context.Context
- func Fail(span trace.Span, err error)
- func Meter(mp metric.MeterProvider) metric.Meter
- func ObserveEngine(m metric.Meter, counters func() metrics.Snapshot, ...) (metric.Registration, error)
- func SpanContext(tp string) trace.SpanContext
- func Traceparent(ctx context.Context) string
- func Tracer(tp trace.TracerProvider) trace.Tracer
- type Engine
- type HeaderCarrier
- type Worker
Constants ¶
const ( AttrExecID = attribute.Key("packtrail.exec.id") AttrFlow = attribute.Key("packtrail.flow.name") AttrFlowHash = attribute.Key("packtrail.flow.hash") AttrNode = attribute.Key("packtrail.node") AttrTaskKey = attribute.Key("packtrail.task.key") AttrGeneration = attribute.Key("packtrail.task.generation") AttrAttempt = attribute.Key("packtrail.task.attempt") AttrKind = attribute.Key("packtrail.worker.kind") AttrCommandType = attribute.Key("packtrail.command.type") AttrCommandID = attribute.Key("packtrail.command.id") AttrEvents = attribute.Key("packtrail.events") AttrConflicts = attribute.Key("packtrail.conflicts") AttrPartition = attribute.Key("packtrail.partition") AttrOutcome = attribute.Key("packtrail.job.outcome") AttrStatus = attribute.Key("packtrail.execution.status") AttrSignal = attribute.Key("packtrail.signal.name") AttrSchedule = attribute.Key("packtrail.schedule.name") AttrSourceExecID = attribute.Key("packtrail.source.exec.id") AttrDeliveries = attribute.Key("packtrail.job.deliveries") AttrRetryable = attribute.Key("packtrail.job.retryable") AttrMessagingDest = attribute.Key("messaging.destination.name") )
Attribute keys of spans and metrics.
const Scope = "github.com/henomis/packtrail"
Scope is the instrumentation scope of packtrail's tracer and meter.
Variables ¶
This section is empty.
Functions ¶
func ContextWithTraceparent ¶
ContextWithTraceparent returns ctx with tp as its remote parent; ctx unchanged when tp is "" or invalid.
func Meter ¶
func Meter(mp metric.MeterProvider) metric.Meter
Meter is packtrail's meter from mp, the global provider when nil.
func ObserveEngine ¶
func ObserveEngine(m metric.Meter, counters func() metrics.Snapshot, lag func(context.Context) metrics.Snapshot, ) (metric.Registration, error)
ObserveEngine registers the engine's observable instruments: its counters (read from counters, cheap) and the dispatcher's lag and stall (read from lag, which may do I/O). The registration ends with Unregister.
func SpanContext ¶
func SpanContext(tp string) trace.SpanContext
SpanContext is the span context tp carries; invalid when tp is not one.
func Traceparent ¶
Traceparent is the W3C traceparent of the span in ctx, "" when ctx holds no valid span context.
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine holds the engine's synchronous instruments.
type HeaderCarrier ¶
HeaderCarrier adapts a NATS header to OTel propagation.
func (HeaderCarrier) Get ¶
func (h HeaderCarrier) Get(key string) string
Get implements propagation.TextMapCarrier.
func (HeaderCarrier) Keys ¶
func (h HeaderCarrier) Keys() []string
Keys implements propagation.TextMapCarrier.
func (HeaderCarrier) Set ¶
func (h HeaderCarrier) Set(key, value string)
Set implements propagation.TextMapCarrier.