Documentation
¶
Overview ¶
Package obs is subflux's /metrics registry: the platform series and the door every other owner's series registers through. It wraps github.com/cplieger/go/measure under another name so the two never collide at an import.
Index ¶
- type Metric
- type Metrics
- func (m *Metrics) DeleteAlertActive(kind, id string)
- func (m *Metrics) Gather(ctx context.Context) ([]measure.Family, error)
- func (m *Metrics) Handler() http.HandlerFunc
- func (m *Metrics) RecordHTTP(r httpserver.RequestMetric)
- func (m *Metrics) RecordPanic()
- func (m *Metrics) Register(ms ...Metric) error
- func (m *Metrics) SetAlertActive(kind, id string)
- func (m *Metrics) SetConfigMode(mode string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Metric ¶
Metric is the metrics library's collector, so a series another package declares with that library registers here.
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}
Metrics is the process's one registry; New builds it.
func New ¶
func New() *Metrics
New builds the registry, prefix subflux, with the platform series registered and build_info set. The library already exports process_start_time_seconds beside its other process series.
func (*Metrics) DeleteAlertActive ¶
DeleteAlertActive removes a cleared alert's alerts_active series.
func (*Metrics) Gather ¶
Gather reads every registered family, a declared family with no series yet included, as measure's Registry.Gather does.
func (*Metrics) Handler ¶
func (m *Metrics) Handler() http.HandlerFunc
Handler serves the exposition.
func (*Metrics) RecordHTTP ¶
func (m *Metrics) RecordHTTP(r httpserver.RequestMetric)
RecordHTTP is httpserver.WithRecordRouteMetric's hook: the library bounds the method and route labels.
func (*Metrics) RecordPanic ¶
func (m *Metrics) RecordPanic()
RecordPanic counts one recovered handler panic.
func (*Metrics) Register ¶
Register adds other owners' collectors in turn, stopping at the first error: a duplicate family, or one a collector captured at construction.
func (*Metrics) SetAlertActive ¶
SetAlertActive sets the alerts_active series of one active alert.
func (*Metrics) SetConfigMode ¶
SetConfigMode sets mode's config_mode series to 1 and the others to 0. A mode outside settings' three is a programming fault: logged at ERROR, and nothing changes.