-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat/fix: allow disabling high cardinality metrics, and add an option…
… to periodically reset them (#51) This fixes #50 by periodically resetting the prometheus counters to keep the cardinality in check. Even though that mitigates the issue greatly, it requires tweaking `Metrics.resetPeriodMinutes` (depending on your traffic). So I still decided to disable high cardinality metrics by default in order to keep the rest of the metrics working (and protect people's privacy) by default.
- Loading branch information
Showing
6 changed files
with
167 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,41 @@ | ||
# Prometheus metrics | ||
|
||
The HTTP API has a `/metrics` endpoint that exposes Go runtime metrics as well as things including: | ||
|
||
- downstream DNS requests, broken down by type | ||
- upstream DNS requests | ||
- upstream DNS-over-HTTPS success rate | ||
- downstream DNS-over-HTTPS success rate | ||
|
||
No grafana dashboards exist for leng yet. If you make one, please make a PR! | ||
|
||
## High cardinality metrics | ||
|
||
Tags can be added to some metrics (`upstream_request`, `request_total`) so that | ||
they include information such as the name of the DNS request (ie, `example.com.`) | ||
or the IP of host making the request. | ||
|
||
If leng is left to run for a few hours (and you have enough traffic), | ||
the cardinality of these metrics will grow, to the point | ||
the | ||
size of the `/metrics` | ||
response will grow to be so big the metrics stop being updated. | ||
While resetting the counters periodically can help | ||
(and you can tweak that with the config `Metrics.resetPeriodMinutes`) | ||
but you might still see issues depending on your traffic. | ||
You can | ||
read [this SO post](https://stackoverflow.com/questions/46373442/how-dangerous-are-high-cardinality-labels-in-prometheus) | ||
to learn more. | ||
|
||
High cardinality metrics **can also compromise your privacy** by exposing in the metrics endpoint | ||
what domains clients are querying as well as their IPs. | ||
|
||
For these reasons, **high cardinality metrics are disabled by default**. You can enable them | ||
with the following config: | ||
|
||
No grafana dashboards exist for leng yet. If you make one, please make a PR! | ||
```toml | ||
[Metrics] | ||
enabled = true | ||
path = "/metrics" | ||
highCardinalityEnabled = true | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters