Documentation
¶
Overview ¶
Package observability exposes Chronos's runtime metrics in Prometheus exposition format. It is intentionally small — counters only, hand-rolled rendering, no external dependencies.
Two consumers feed the registry:
- The pipeline package calls ObserveSignal whenever a detector emits and ObserveObservations whenever entity states are saved.
- The HTTP middleware calls ObserveHTTP for every request once the response has been written.
The /metrics endpoint (mounted by internal/api) renders the current state in Prometheus text format. Operators wanting more sophisticated instrumentation (histograms, exemplars, OTLP) should front Chronos with a sidecar; this in-process implementation is the operational floor, not the ceiling.
Index ¶
- type Metrics
- func (m *Metrics) ObserveHTTP(method string, status int, path string, dur time.Duration)
- func (m *Metrics) ObserveObservations(adapter string, n int)
- func (m *Metrics) ObserveSignal(pattern string)
- func (m *Metrics) ObserveWebhook(outcome string, status int)
- func (m *Metrics) Render(w io.Writer) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}
Metrics is a thread-safe in-memory metrics registry. The zero value is unusable; construct with New.
func (*Metrics) ObserveHTTP ¶
ObserveHTTP records the outcome of an HTTP request. method and status are coarse labels; path is included separately on the duration counters because high-cardinality paths can blow up label space and we keep the request count cardinality bounded.
func (*Metrics) ObserveObservations ¶
ObserveObservations records that n observations were ingested from the named adapter.
func (*Metrics) ObserveSignal ¶
ObserveSignal records that one signal of the given pattern was emitted.
func (*Metrics) ObserveWebhook ¶
ObserveWebhook records the outcome of a single webhook delivery attempt. outcome is one of "success", "client_error", "failure"; status is the final HTTP status code observed (0 when the request never returned, e.g., DNS failure).