Documentation
¶
Overview ¶
Package tracer wraps an OpenTelemetry Tracer with a noop default and an errclass Registry so a single RecordError call can classify, record, and set span status. The package deliberately stays thin — SDKs add their own higher-level helpers (events, attributes) on top of this primitive.
Index ¶
- type Recorder
- type Span
- func (s *Span) AddEvent(name string, attrs ...attribute.KeyValue)
- func (s *Span) End()
- func (s *Span) MarkError(class errclass.Class)
- func (s *Span) Raw() trace.Span
- func (s *Span) RecordError(err error) errclass.Class
- func (s *Span) SetAttributes(attrs ...attribute.KeyValue)
- func (s *Span) SpanContext() trace.SpanContext
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Recorder ¶
type Recorder struct {
// contains filtered or unexported fields
}
Recorder wraps a trace.Tracer and an errclass.Registry.
func New ¶
func New(provider trace.TracerProvider, scopeName, scopeVersion string, classes *errclass.Registry) *Recorder
New returns a Recorder. A nil provider falls back to the noop TracerProvider, a nil classes registry causes all recorded errors to be labeled Unknown.
type Span ¶
type Span struct {
// contains filtered or unexported fields
}
Span wraps trace.Span with errclass integration. All methods are safe on nil.
func (*Span) MarkError ¶
MarkError flags the span as failed with a pre-classified Class but without a backing error value (e.g., a hook gated the call, no exception to capture).
func (*Span) RecordError ¶
RecordError classifies err via the registry, records it on the span, sets the error.type attribute, and marks the span status as error. Returns the classified Class so callers can reuse it for metric labels without double classification.
func (*Span) SetAttributes ¶
SetAttributes adds attributes to the span.
func (*Span) SpanContext ¶
func (s *Span) SpanContext() trace.SpanContext
SpanContext returns the underlying span context (useful for exemplar linking).