Documentation
¶
Overview ¶
Package observability is LadyM's internal metrics facade over prometheus/client_golang (the de-facto standard, kept behind this package so api/engine/cli share one metric surface without import cycles). Each Registry owns a private prometheus.Registry — the global default is never used, which keeps tests isolated.
Index ¶
- Variables
- type EndpointStats
- type Registry
- func (r *Registry) DecInFlight()
- func (r *Registry) DurationSumCount(endpoint string) (sum float64, count int)
- func (r *Registry) EndpointStatsSnapshot() map[string]EndpointStats
- func (r *Registry) HTTPHandler() http.Handler
- func (r *Registry) IncInFlight()
- func (r *Registry) IncRequests(endpoint, statusClass string)
- func (r *Registry) IncSystem2Cycle(result string)
- func (r *Registry) ObserveDuration(endpoint string, seconds float64)
- func (r *Registry) System2Cycles() map[string]uint64
Constants ¶
This section is empty.
Variables ¶
var HistogramBuckets = []float64{0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5}
HistogramBuckets are the ladym_http_request_duration_seconds bucket upper bounds (seconds).
Functions ¶
This section is empty.
Types ¶
type EndpointStats ¶
type EndpointStats struct {
Requests int `json:"requests"`
Errors int `json:"errors"` // non-2xx responses
}
EndpointStats is the /api/metrics JSON read-out for one endpoint.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry is a concurrency-safe metrics facade. The process-wide Default() serves production; tests build isolated instances with New().
func Default ¶
func Default() *Registry
Default returns the process-wide registry (api handler and worker share it).
func (*Registry) DecInFlight ¶
func (r *Registry) DecInFlight()
func (*Registry) DurationSumCount ¶
DurationSumCount returns the histogram _sum (seconds) and _count for one endpoint — the /api/metrics JSON face derives recall_avg_ms from it.
func (*Registry) EndpointStatsSnapshot ¶
func (r *Registry) EndpointStatsSnapshot() map[string]EndpointStats
EndpointStatsSnapshot exports per-endpoint request/error counts for the /api/metrics JSON face (errors = all non-2xx classes).
func (*Registry) HTTPHandler ¶
HTTPHandler serves the Prometheus text exposition of this registry.
func (*Registry) IncInFlight ¶
func (r *Registry) IncInFlight()
IncInFlight / DecInFlight track ladym_http_requests_in_flight.
func (*Registry) IncRequests ¶
IncRequests increments ladym_http_requests_total{endpoint,status}; status is a class string ("2xx"/"4xx"/"5xx"), not a raw code.
func (*Registry) IncSystem2Cycle ¶
IncSystem2Cycle increments ladym_system2_cycles_total{result} with result in ran/skipped/failed.
func (*Registry) ObserveDuration ¶
ObserveDuration records one request duration into ladym_http_request_duration_seconds{endpoint}.
func (*Registry) System2Cycles ¶
System2Cycles returns the per-result cycle counts (tests compare deltas).