Documentation ¶
Overview ¶
Package telemetry is an internal API for observability/instrumentation.
Index ¶
- Variables
- func HandleID() string
- type Attr
- func Bool[T ~bool](k string, v T) Attr
- func Float[T constraints.Float](k string, v T) Attr
- func If(cond bool, attr Attr) Attr
- func Int[T constraints.Integer](k string, v T) Attr
- func String[T ~string](k string, v T) Attr
- func Stringer(k string, v fmt.Stringer) Attr
- func Type[T any](k string, v T) Attr
- type Provider
- type Recorder
- func (r *Recorder) Float64Counter(name string, options ...metric.Float64CounterOption) metric.Float64Counter
- func (r *Recorder) Float64Histogram(name string, options ...metric.Float64HistogramOption) metric.Float64Histogram
- func (r *Recorder) Float64UpDownCounter(name string, options ...metric.Float64UpDownCounterOption) metric.Float64UpDownCounter
- func (r *Recorder) Int64Counter(name string, options ...metric.Int64CounterOption) metric.Int64Counter
- func (r *Recorder) Int64Histogram(name string, options ...metric.Int64HistogramOption) metric.Int64Histogram
- func (r *Recorder) Int64UpDownCounter(name string, options ...metric.Int64UpDownCounterOption) metric.Int64UpDownCounter
- func (r *Recorder) StartSpan(ctx context.Context, name string, attrs ...Attr) (context.Context, *Span)
- type Span
Constants ¶
This section is empty.
Variables ¶
var ( // ReadDirection is an attribute that indicates a read operation. ReadDirection = metric.WithAttributeSet( attribute.NewSet( attribute.String("direction", "read"), ), ) // WriteDirection is an attribute that indicates a write operation. WriteDirection = metric.WithAttributeSet( attribute.NewSet( attribute.String("direction", "write"), ), ) )
Functions ¶
Types ¶
type Attr ¶
type Attr struct {
// contains filtered or unexported fields
}
Attr is a telemetry attribute.
type Provider ¶
type Provider struct { TracerProvider trace.TracerProvider MeterProvider metric.MeterProvider Logger *slog.Logger Attrs []Attr }
Provider provides Recorder instances scoped to particular subsystems.
func (*Provider) Recorder ¶
Recorder returns a new Recorder instance.
pkg is the path to the Go package that is performing the instrumentation. If it is an internal package, use the package path of the public parent package instead.
name is the one-word name of the subsystem that the recorder is for, for example "journal" or "aggregate".
type Recorder ¶
type Recorder struct {
// contains filtered or unexported fields
}
Recorder records traces, metrics and logs for a particular subsystem.
func (*Recorder) Float64Counter ¶
func (r *Recorder) Float64Counter(name string, options ...metric.Float64CounterOption) metric.Float64Counter
Float64Counter returns a new Float64Counter instrument.
func (*Recorder) Float64Histogram ¶
func (r *Recorder) Float64Histogram(name string, options ...metric.Float64HistogramOption) metric.Float64Histogram
Float64Histogram returns a new Float64Histogram instrument.
func (*Recorder) Float64UpDownCounter ¶
func (r *Recorder) Float64UpDownCounter(name string, options ...metric.Float64UpDownCounterOption) metric.Float64UpDownCounter
Float64UpDownCounter returns a new Float64UpDownCounter instrument.
func (*Recorder) Int64Counter ¶
func (r *Recorder) Int64Counter(name string, options ...metric.Int64CounterOption) metric.Int64Counter
Int64Counter returns a new Int64Counter instrument.
func (*Recorder) Int64Histogram ¶
func (r *Recorder) Int64Histogram(name string, options ...metric.Int64HistogramOption) metric.Int64Histogram
Int64Histogram returns a new Int64Histogram instrument.
func (*Recorder) Int64UpDownCounter ¶
func (r *Recorder) Int64UpDownCounter(name string, options ...metric.Int64UpDownCounterOption) metric.Int64UpDownCounter
Int64UpDownCounter returns a new Int64UpDownCounter instrument.
type Span ¶
type Span struct {
// contains filtered or unexported fields
}
Span represents a single named and timed operation of a workflow.
func (*Span) Error ¶
Error logs an error message to the log and as a span event.
It marks the span as an error and emits increments the "errors" metric.
func (*Span) SetAttributes ¶
SetAttributes adds the given attributes to the underlying OpenTelemetry span and any future log messages.