again, thanks for your work on adding more metrics to tor's MetricsPort!
Many relay operators will love this and documentation will be useful .
which got closed yesterday, but there was likely a misunderstanding and
the changes did not solve the underlying issue.
The core issue is: The metric called
contains a mix of different types (gauge, counter).
When mixing types in a single metric, the TYPE definition will always be
wrong for one or the other value.
For example grafana will show this if you use a counter metric without
"Selected metric is a counter. Consider calculating rate of counter by
It is a best practice to avoid mixing different types in a single metric.
From the prometheus best practices :
"As a rule of thumb, either the sum() or the avg() over all dimensions of
a given metric should be meaningful (though not necessarily useful). If it
is not meaningful, split the data up into multiple metrics. For example,
having the capacity of various queues in one metric is good, while mixing
the capacity of a queue with the current number of elements in the queue
An idea to address the underlying issue:
One connection metric for counter and one for gauge:
- tor_relay_connections_total for counters, like the current label
- tor_relay_connections for gauge metrics, like the current label
state="opened". "rejected" also appears to be a gauge metric.
Another nice feature of these metrics would be to have a label for what
type of system is connecting (src="relay", src="non-relay") - more on that
in yesterday's email.
A tool by toralf  also shows these and uses the source IP but tor
itself does not need to look at the source IP to determine the type,
something discussed in last week's relay operator meetup.
 Add connection stats to MetricsPort documentation (#312) · Issues · The Tor Project / Web / support · GitLab
relay: Change the connection metrics name (06a26f18) · Commits · The Tor Project / Core / Tor · GitLab
metrics: Treat relay connections as gauge, not counter (6d40e980) · Commits · The Tor Project / Core / Tor · GitLab
 Metric and label naming | Prometheus
tor-relays mailing list