Documentation
¶
Overview ¶
Package observability supplies process-local Prometheus registries and safe transport observations. Labels passed here must come from fixed operations or registered inventory, never request paths, credentials, or error messages.
Index ¶
- func App(r *http.Request, identity Identity)
- func Bool(value bool) float64
- func ETH(value *big.Rat) float64
- func ErrorKind(err error) string
- func Operation(r *http.Request, operation string)
- func Outcome(r *http.Request, outcome string)
- func Stream(r *http.Request, identity Identity, protocol string)
- func TrackResponse(r *http.Request, response *http.Response)
- type Emit
- type Identity
- type Labels
- type Metrics
- func (m *Metrics) Add(name string, value float64, labels Labels)
- func (m *Metrics) Discovery(source int, elapsed time.Duration, err error)
- func (m *Metrics) Gauge(name string, labels Labels) prometheus.Gauge
- func (m *Metrics) HTTP(w http.ResponseWriter, r *http.Request, serve http.HandlerFunc)
- func (m *Metrics) Handler() http.Handler
- func (m *Metrics) Legacy(collect func(Emit))
- func (m *Metrics) Observe(name string, value float64, labels Labels)
- func (m *Metrics) PaymentObserver(o *eth.PaymentObserver, logger *slog.Logger)
- func (m *Metrics) RPC(o eth.RPCObservation)
- func (m *Metrics) Snapshot(collect func(Emit))
- type Request
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Metrics ¶
type Metrics struct {
Registry *prometheus.Registry
Component string
// contains filtered or unexported fields
}
Metrics owns a registry; services and tests never share global collectors. Families are registered on first use, with a fixed label schema thereafter.
func (*Metrics) HTTP ¶
func (m *Metrics) HTTP(w http.ResponseWriter, r *http.Request, serve http.HandlerFunc)
HTTP observes the entire handler lifetime, including upgraded connections. httpsnoop preserves the exact optional ResponseWriter interfaces.
func (*Metrics) PaymentObserver ¶
func (m *Metrics) PaymentObserver(o *eth.PaymentObserver, logger *slog.Logger)
PaymentObserver collects authoritative memory-only state. The callback only remembers the last logged health transition; it does not decide freshness.
func (*Metrics) RPC ¶
func (m *Metrics) RPC(o eth.RPCObservation)
Contract/refresh metrics adapt Mike Zupper's BlueClawNetwork/livepeer-node internal/observability/metrics.go at 2c2ce3cf8a51f5464ce4961bbb6c2e640f348ae0 (MIT; see LICENSE).