prom
Exports a lith app's numbers to Prometheus: the writer's batches and commands, the live hub's ticks, renders and frames, and what the streams' encoders hold of the memory budget.
Import path github.com/zweiundeins/lith/prom, a module of its own: go get github.com/zweiundeins/lith/prom. Generated from the doc comments in prom/.
It is a module of its own, so that projects without Prometheus never pull it in. Statement timings come from dbmetrics/prom.
reg := prometheus.NewRegistry()
reg.MustRegister(prom.New("myapp", prom.Sources{Writer: w, Hub: hub}))
Functions
func New
func New(namespace string, s Sources) prometheus.Collector
New returns a collector of the sources' numbers, named under namespace: <namespace>_writer_*, <namespace>_live_* and <namespace>_sse_budget_*. It reads the sources' Stats on every scrape.
Types
type Sources
type Sources struct {
Writer *writer.Writer
Hub *live.Hub
// Budget defaults to the hub's (live.Hub.Budget).
Budget *sse.Budget
}
Sources are what the collector reads; a nil source exports nothing.