Documentation
¶
Overview ¶
Package metrics holds the Prometheus instruments on the hot path of the pad message handler: etherpad-lite's prom-instruments (scaling dive, #7756). They let a load test tell the apply path from the fan-out and see per-pad concurrency. Everything is off unless scalingDiveMetrics is set: the recorders are no-ops then and nothing is registered.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ChangesetApplyDuration = prometheus.NewHistogram(prometheus.HistogramOpts{ Name: "etherpad_changeset_apply_duration_seconds", Help: "Time spent applying an incoming USER_CHANGES message on the server (apply path only, excludes fan-out to other clients)", Buckets: []float64{0.001, 0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 5}, }) SocketEmitsTotal = prometheus.NewCounterVec(prometheus.CounterOpts{ Name: "etherpad_socket_emits_total", Help: "Number of socket broadcast emits, bucketed by message type", }, []string{"type"}) // PadUsers is keyed by a pseudonym of the pad, not its name: /metrics // is not behind a login, and pad names (of group pads, of unguessable // pads) are what gives access to them. PadUsers = prometheus.NewGaugeVec(prometheus.GaugeOpts{ Name: "etherpad_pad_users", Help: "Active users connected to a pad, keyed by a pseudonym of the pad (stable within one process)", }, []string{"pad"}) )
Functions ¶
func PadLabel ¶
PadLabel is the pseudonym of padID in the metrics: 12 hex digits of an HMAC-SHA256 with the process's key.
func RecordChangesetApply ¶
func RecordChangesetApply() func()
RecordChangesetApply starts timing the apply path; call the result once the revision is stored. A failed apply leaves it uncalled, so the distribution is of successful applies only.
func RecordSocketEmit ¶
func RecordSocketEmit(msgType string)
RecordSocketEmit counts one emit of a message type.
func Register ¶
func Register(reg prometheus.Registerer)
Register adds the instruments to reg when they are enabled.
func SetEnabled ¶
func SetEnabled(on bool)
SetEnabled turns the instruments on or off (settings.scalingDiveMetrics).
func SetPadUsers ¶
SetPadUsers replaces the per-pad user counts, so drained pads leave no stale series.
Types ¶
This section is empty.