Documentation
¶
Overview ¶
Package telemetry is the tracing and metrics plumbing the engine and the plugin registry share. Spans go to the global OpenTelemetry tracer provider, which forge.New installs. Metrics go to a go-utils metrics.Metrics the caller hands over, and a nil one records nothing.
Index ¶
- Constants
- func Detach(ctx context.Context) context.Context
- func Fail(span trace.Span, typ string)
- func Start(ctx context.Context, name string, opts ...trace.SpanStartOption) (context.Context, trace.Span)
- func StartChild(ctx context.Context, name string, opts ...trace.SpanStartOption) (context.Context, trace.Span)
- func StartRoot(ctx context.Context, name string, opts ...trace.SpanStartOption) (context.Context, trace.Span)
- func Tracer() trace.Tracer
- func TypeOf(err error) string
- type CounterVec
- type HistogramVec
Constants ¶
const InstrumentationName = "github.com/xraph/ledger"
InstrumentationName is the tracer name on every span ledger starts.
Variables ¶
This section is empty.
Functions ¶
func Detach ¶
Detach returns ctx with no span in it, keeping its values, deadline and cancellation. A worker started from a traced context uses it so that the queries it runs while idle hang off no trace.
func Fail ¶
Fail marks span as failed. The status description and the exception event carry only typ, the error's class, never its message: driver and provider messages quote the values they failed on.
func Start ¶
func Start(ctx context.Context, name string, opts ...trace.SpanStartOption) (context.Context, trace.Span)
Start starts an internal span.
func StartChild ¶
func StartChild(ctx context.Context, name string, opts ...trace.SpanStartOption) (context.Context, trace.Span)
StartChild starts an internal span only when ctx already carries one, so a hot call made outside any trace does not begin a trace of its own. Without a parent it returns ctx and a span that records nothing.
func StartRoot ¶
func StartRoot(ctx context.Context, name string, opts ...trace.SpanStartOption) (context.Context, trace.Span)
StartRoot starts an internal span that begins its own trace, for background work whose context may still carry the span of whatever started the worker.
Types ¶
type CounterVec ¶
type CounterVec struct {
// contains filtered or unexported fields
}
CounterVec is a labeled counter. A nil *CounterVec records nothing.
func NewCounterVec ¶
func NewCounterVec(m gometrics.Metrics, name, help string, labels ...string) *CounterVec
NewCounterVec declares a counter on m. It returns nil when m is nil.
func (*CounterVec) Add ¶
func (c *CounterVec) Add(n float64, values ...string)
Add adds n to the child named by values.
func (*CounterVec) Inc ¶
func (c *CounterVec) Inc(values ...string)
Inc adds one to the child named by values.
type HistogramVec ¶
type HistogramVec struct {
// contains filtered or unexported fields
}
HistogramVec is a labeled histogram. A nil *HistogramVec records nothing.
func NewHistogramVec ¶
func NewHistogramVec(m gometrics.Metrics, name, help string, buckets []float64, labels ...string) *HistogramVec
NewHistogramVec declares a histogram in seconds on m. It returns nil when m is nil.
func (*HistogramVec) ObserveSince ¶
func (h *HistogramVec) ObserveSince(start time.Time, values ...string)
ObserveSince records the seconds since start on the child named by values.