Documentation
¶
Overview ¶
Package obs is grelot's /metrics page: the counters and histograms the server and store record into, and the gauges read from the store at scrape time. No label value is ever an agent name, path, subject or session.
Index ¶
Constants ¶
const ( StartedEmptyCorrupt = "corrupt" StartedEmptyFormat = "format" RefusedStoreFull = "store_full" RefusedRateLimited = "rate_limited" RefusedScope = "scope" SendAccepted = "accepted" SendRetry = "retry" SendGaveUp = "gave_up" SendGone = "gone" AttemptFirst = "first" AttemptRepeat = "repeat" )
The bounded label values the record paths take.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Metrics ¶
type Metrics struct {
// SweepLastSuccess is the Unix time of the last sweep that committed.
SweepLastSuccess *measure.Gauge
SweepFailures *measure.Counter
// StoreStartedEmpty counts opens that started with no rows, by reason.
StoreStartedEmpty *measure.LabeledCounter
// Posts counts stored posts by thread kind.
Posts *measure.LabeledCounter
// PostsRefused counts refused posts by reason.
PostsRefused *measure.LabeledCounter
// WritesReplayed counts keyed writes that answered their stored first
// result.
WritesReplayed *measure.Counter
// PushDoorUp is 1 for a door that pushes, 0 for one turned off.
PushDoorUp *measure.LabeledGauge
// PushSends counts push tries by door and outcome.
PushSends *measure.LabeledCounter
// ProvidersInvalid is the number of provider files skipped at load, 1
// for a folder that cannot be read.
ProvidersInvalid *measure.Gauge
// Nudges counts recorded nudges by layer and attempt.
Nudges *measure.LabeledCounter
// NudgeDelay is the oldest-in-batch post-to-nudge delay by layer.
NudgeDelay *measure.LabeledHistogram
// contains filtered or unexported fields
}
Metrics holds every family on the page. Build it with New.
func New ¶
func New() *Metrics
New builds the page with every family registered and the refusal and started-empty reasons seeded at 0, so a first one shows in increase().
func (*Metrics) RecordHTTP ¶
func (m *Metrics) RecordHTTP(rm httpserver.RequestMetric)
RecordHTTP records one completed request; it is the hook for httpserver.WithRecordRouteMetric, whose Path is a registered pattern.
func (*Metrics) ServeState ¶
ServeState registers the gauges read at each scrape from read, which reports false when it cannot count; the page then leaves them out. now is the clock the oldest unread age is taken against. Call it once.