Documentation
¶
Overview ¶
Package metrics bridges a running goav task to monitoring: Handler serves its counters in the Prometheus text exposition format, and Publish exposes the same data through expvar. It reads Stats and Snapshot, which are lock-free atomic reads, so scraping never slows the data plane.
http.Handle("/metrics", metrics.Handler(task))
metrics.Publish("goav", task) // visible at /debug/vars
Metrics carry the goav_ prefix. Per-node counters are labelled node; drops add reason; branch and destination states are one-hot gauges labelled by name and state (1 for the current state, 0 for the others).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Handler ¶
func Handler(task StatsSource) http.Handler
Handler serves the task's counters and states as Prometheus text.
func Publish ¶
func Publish(name string, task StatsSource)
Publish exposes the task's stats and snapshot (state, branches, destinations) as the expvar variable name, rendered as JSON on demand. Like expvar.Publish it panics if name is already taken.
Types ¶
type StatsSource ¶ added in v0.3.0
type StatsSource interface {
Stats() pipeline.GraphStats
Snapshot() goav.TaskSnapshot
}
StatsSource is the narrow view of a *goav.Task that metrics reads.