summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVladimír Čunát <vladimir.cunat@nic.cz>2024-05-20 13:32:45 +0200
committerOto Šťáva <oto.stava@nic.cz>2024-05-20 13:32:45 +0200
commitea78253482d802c2464c98c030d37c0248c7f59b (patch)
tree6f5eac5a3f164bef5319d5fae6aca64d66a5d6e0
parentMerge branch 'coverity' into 'master-5' (diff)
downloadknot-resolver-ea78253482d802c2464c98c030d37c0248c7f59b.tar.xz
knot-resolver-ea78253482d802c2464c98c030d37c0248c7f59b.zip
modules/stats: add answer.sum_ms metric
(cherry picked from commit 44df5dd0d0fedfae390e7137572bcb14270e4d48)
-rw-r--r--modules/stats/README.rst2
-rw-r--r--modules/stats/stats.c2
2 files changed, 4 insertions, 0 deletions
diff --git a/modules/stats/README.rst b/modules/stats/README.rst
index 7d423aa8..014c9f06 100644
--- a/modules/stats/README.rst
+++ b/modules/stats/README.rst
@@ -89,6 +89,8 @@ Built-in counters keep track of number of queries and answers matching specific
+-----------------+----------------------------------+
| answer.slow | completed in more than 1500ms |
+-----------------+----------------------------------+
+| answer.sum_ms | sum of all latencies in ms |
++-----------------+----------------------------------+
+-----------------+----------------------------------+
| **Answer flags** |
diff --git a/modules/stats/stats.c b/modules/stats/stats.c
index 129023f8..c93401cf 100644
--- a/modules/stats/stats.c
+++ b/modules/stats/stats.c
@@ -42,6 +42,7 @@
X(answer,total) X(answer,noerror) X(answer,nodata) X(answer,nxdomain) X(answer,servfail) \
X(answer,cached) X(answer,1ms) X(answer,10ms) X(answer,50ms) X(answer,100ms) \
X(answer,250ms) X(answer,500ms) X(answer,1000ms) X(answer,1500ms) X(answer,slow) \
+ X(answer,sum_ms) \
X(answer,aa) X(answer,tc) X(answer,rd) X(answer,ra) X(answer, ad) X(answer,cd) \
X(answer,edns0) X(answer,do) \
X(query,edns) X(query,dnssec) \
@@ -220,6 +221,7 @@ static int collect(kr_layer_t *ctx)
/* Histogram of answer latency. */
struct kr_query *first = rplan->resolved.at[0];
uint64_t elapsed = kr_now() - first->timestamp_mono;
+ stat_const_add(data, metric_answer_sum_ms, elapsed);
if (elapsed <= 1) {
stat_const_add(data, metric_answer_1ms, 1);
} else if (elapsed <= 10) {