fix(oohelperd): metrics improvements after design review (#903)
This diff updates the metrics according to https://github.com/ooni/probe/issues/2183#issuecomment-1230327725
This commit is contained in:
parent
ffc2527fc5
commit
8c855ca597
2 changed files with 21 additions and 24 deletions
|
|
@ -3,6 +3,8 @@ package main
|
|||
//
|
||||
// Metrics definitions
|
||||
//
|
||||
// See https://github.com/ooni/probe/issues/2183#issuecomment-1230327725
|
||||
//
|
||||
|
||||
import (
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
|
|
@ -10,30 +12,26 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
// metricRequestsTotal counts the total number of requests
|
||||
metricRequestsTotal = promauto.NewCounter(prometheus.CounterOpts{
|
||||
Name: "oohelperd_requests_total",
|
||||
Help: "The total number of processed requests",
|
||||
})
|
||||
// metricRequestsCount counts the number of requests we served.
|
||||
metricRequestsCount = promauto.NewCounterVec(prometheus.CounterOpts{
|
||||
Name: "oohelperd_requests_count",
|
||||
Help: "Total number of processed requests",
|
||||
}, []string{"code", "reason"})
|
||||
|
||||
// metricRequestsByStatusCode counts the number of requests that
|
||||
// have returned a given status code to the caller.
|
||||
metricRequestsByStatusCode = promauto.NewCounterVec(prometheus.CounterOpts{
|
||||
Name: "oohelperd_requests_by_status_code",
|
||||
Help: "Total number of processed requests by status code",
|
||||
}, []string{"code"})
|
||||
|
||||
// metricRequestsInflight counts the number of requests currently inflight.
|
||||
// metricRequestsInflight gauges the number of requests currently inflight.
|
||||
metricRequestsInflight = promauto.NewGauge(prometheus.GaugeOpts{
|
||||
Name: "oohelperd_requests_inflight",
|
||||
Name: "oohelperd_requests_inflight_gauge",
|
||||
Help: "The number or requests currently inflight",
|
||||
})
|
||||
|
||||
// metricMeasurementTime summarizes the time to perform a measurement.
|
||||
metricMeasurementTime = promauto.NewSummary(prometheus.SummaryOpts{
|
||||
Name: "oohelperd_measurement_time",
|
||||
// metricWCTaskDurationSeconds summarizes the duration of the web connectivity measurement task.
|
||||
metricWCTaskDurationSeconds = promauto.NewSummary(prometheus.SummaryOpts{
|
||||
Name: "oohelperd_wctask_duration_seconds",
|
||||
Help: "Summarizes the time to perform a test-helper measurement (in seconds)",
|
||||
// See https://grafana.com/blog/2022/03/01/how-summary-metrics-work-in-prometheus/
|
||||
//
|
||||
// TODO(bassosimone,FedericoCeratto): investigate whether using
|
||||
// a shorter-than-10m observation interval is better for us
|
||||
Objectives: map[float64]float64{
|
||||
0.25: 0.010, // 0.240 <= φ <= 0.260
|
||||
0.5: 0.010, // 0.490 <= φ <= 0.510
|
||||
|
|
|
|||
Loading…
Reference in a new issue