Documentation
¶
Index ¶
- func RegisterSpecs(meterObj metric.Meter, specArr []SpecObj, observeFunc func() ([]int64, bool)) (metric.Registration, error)
- type Group
- type Obj
- func (obj *Obj) Close(ctx context.Context) error
- func (obj *Obj) Enabled() bool
- func (obj *Obj) GroupValues(group Group) (map[string]float64, bool)
- func (obj *Obj) InternalOM() ([]byte, bool)
- func (obj *Obj) Meter(group Group) metric.Meter
- func (obj *Obj) MeterProvider() metric.MeterProvider
- func (obj *Obj) Start(ctx context.Context)
- type SpecObj
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterSpecs ¶ added in v0.4.0
func RegisterSpecs( meterObj metric.Meter, specArr []SpecObj, observeFunc func() ([]int64, bool), ) (metric.Registration, error)
RegisterSpecs creates instruments from the table and registers the shared callback.
Types ¶
type Group ¶
type Group string
Group defines the metric groups; public values match the JSON routes /metrics/<group>.
const ( GroupCore Group = "core" GroupCache Group = "cache" GroupRescan Group = "rescan" GroupErrors Group = "errors" GroupYgg Group = "ygg" GroupInternal Group = "internal" )
Groups separate public series from the internal exposition. Core collects ogen and unknown scopes, internal holds push and Go runtime self-metrics.
type Obj ¶
type Obj struct {
// contains filtered or unexported fields
}
Obj owns the SDK state, prebuilt Prometheus snapshots and the optional push to VictoriaMetrics.
func New ¶
New builds telemetry from validated config. When no exposure method is enabled, it returns a disabled noop provider without SDK allocation or loops.
func (*Obj) Close ¶
Close stops the loops and shuts down the SDK provider. The final push is skipped: snapshots are cumulative, losing one tick does not change the counter total.
func (*Obj) GroupValues ¶
GroupValues returns the prebuilt map of metric name -> aggregated value for a public group. ok=false when telemetry is disabled or the group is unknown; before the first build the map is empty.
func (*Obj) InternalOM ¶
InternalOM returns the prebuilt full Prometheus text document across all groups. ok=false when telemetry is disabled; before the first build an empty document is returned.
func (*Obj) Meter ¶
Meter returns a group meter for producers such as cache, rescan and errors. Metric names and attributes must stay low-cardinality: key, version and raw path are never recorded.
func (*Obj) MeterProvider ¶
func (obj *Obj) MeterProvider() metric.MeterProvider
MeterProvider returns the provider to pass into ogen via api.WithMeterProvider. A nil receiver yields a noop provider, matching the nil tolerance of Enabled.