BeryJu/gravity

[Enhancement] Verbose DNS Metrics

TheiLLeniumStudios opened this issue · 1 comments

Hi,

I've been using gravity as my primary DNS server running on k8s with multiple replicas for a while now and it seems to work great so far.

However, it would be nice to have more verbose metrics for DNS queries. I know that the DNS queries are logged with the client IP and the request:

{"level":"info","ts":1700391001.1684859,"logger":"role.dns","msg":"DNS Query","instance":"gravity-dns-1","version":"0.6.17-2219b6b2","runtime":9,"client":"10.2.0.16","response":"NOERROR","queryNames":["mobile.events.data.microsoft.com."],"queryTypes":["A"],"answerRecords":["mobile.events.data.trafficmanager.net.","onedscolprdcus09.centralus.cloudapp.azure.com.","13.89.179.9"],"answerTypes":["CNAME","CNAME","A"]}

but having it in prometheus would be great to visualize DNS queries made per client or DNS queries made per Host etc.

BeryJu commented

Metrics like that are purposefully not exposed to prometheus as they have a very high cardinality, which isn't great for prometheus. Instead it is recommended to store the logs from gravity (for example with Loki) and build metrics off of that.

It might be an interesting option to leave that choice to the gravity user and optionally expose those metrics via prometheus while acknowledging the downsides (https://stackoverflow.com/questions/46373442/how-dangerous-are-high-cardinality-labels-in-prometheus)