Documentation
¶
Overview ¶
Package telemetry holds the tracing and metrics helpers the engine and the message bus share. It lives in the root module, so it uses only OpenTelemetry and go-utils and never forge: a Forge app installs the global tracer provider and hands the engine its metrics, and a host without Forge gets no-op spans and no metrics until it does the same.
Index ¶
- Constants
- Variables
- func Detach(ctx context.Context) context.Context
- func ErrorType(err error) string
- func Fail(span trace.Span, err error)
- func Links(scs ...trace.SpanContext) []trace.Link
- func StripSpan(ctx context.Context) context.Context
- func TakeLink(ctx context.Context) (context.Context, trace.SpanContext, bool)
- func Tracer() trace.Tracer
- type CounterVec
- type GaugeVec
- type HistogramVec
- type Throttle
Constants ¶
const LogInterval = time.Minute
LogInterval is how often one log site may write a line. Failures in between are counted and reported on the next line, so a store that is down fails every step and every run, and the log gets one line a minute per site rather than one per step.
const ScopeName = "github.com/xraph/cortex"
ScopeName is the instrumentation scope every cortex span carries.
Variables ¶
var ErrPanic = errors.New("cortex: panic")
ErrPanic stands in for a call that panicked. A deferred end records it, as the class "panic", while the panic carries on unwinding.
Functions ¶
func Detach ¶
Detach strips ctx's span and remembers it as a link target. The next run span started from the result is a new root that links back to the span ctx carried, instead of a child that outlives its parent.
func ErrorType ¶
ErrorType names err for a span: a known sentinel by its name, anything else by the Go type of the innermost error in its wrap chain.
func Fail ¶
Fail marks span as failed. The description is a short class, never the error's text: provider, driver and tool messages quote prompts, arguments and stored values. The exception event carries only the error's type.
func Links ¶
func Links(scs ...trace.SpanContext) []trace.Link
Links turns span contexts into span links, skipping invalid ones and repeats.
func StripSpan ¶
StripSpan keeps ctx's values and cancellation but drops its span, so work started from it begins a trace of its own. A loop started from a Forge start hook or a request needs this: context.WithoutCancel and WithCancel keep the span, and every query an idle tick made would land in a trace that ended long ago.
Types ¶
type CounterVec ¶
type CounterVec struct {
// contains filtered or unexported fields
}
CounterVec is a labelled counter. A nil *CounterVec records nothing, which is what a nil metrics sink gives you.
func NewCounterVec ¶
func NewCounterVec(m gometrics.Metrics, name, help string, keys ...string) *CounterVec
NewCounterVec declares a counter on m, or returns nil when m is nil.
func (*CounterVec) Inc ¶
func (c *CounterVec) Inc(values ...string)
Inc adds one to the series named by values, given in key order.
type GaugeVec ¶
type GaugeVec struct {
// contains filtered or unexported fields
}
GaugeVec is a labelled gauge. A nil *GaugeVec records nothing.
func NewGaugeVec ¶
NewGaugeVec declares a gauge on m, or returns nil when m is nil.
type HistogramVec ¶
type HistogramVec struct {
// contains filtered or unexported fields
}
HistogramVec is a labelled histogram. A nil *HistogramVec records nothing.
func NewHistogramVec ¶
func NewHistogramVec(m gometrics.Metrics, name, help, unit string, buckets []float64, keys ...string) *HistogramVec
NewHistogramVec declares a histogram on m, or returns nil when m is nil.
func (*HistogramVec) Observe ¶
func (h *HistogramVec) Observe(v float64, values ...string)
Observe records v in the series named by values, given in key order.
type Throttle ¶
type Throttle struct {
// contains filtered or unexported fields
}
Throttle limits log lines per key. Keys must come from a bounded set (a call site's message, or a hook and the name of a registered extension), which is what bounds the map. The zero value is ready to use and safe for concurrent use.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package telemetrytest is a recording metrics sink for cortex's own tests.
|
Package telemetrytest is a recording metrics sink for cortex's own tests. |