[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/main] relay: Avoid duplicate MetricsPort DNS error
commit 903fb3dd62add48fa71efc4ce554f6161dc409eb
Author: David Goulet <dgoulet@xxxxxxxxxxxxxx>
Date: Wed Oct 20 13:49:44 2021 -0400
relay: Avoid duplicate MetricsPort DNS error
We don't output per-type DNS errors anymore so avoid looping over the
DNS query type and output each errors for them. Before this commit, it
created 3x the same message because we had A, AAAA and PTR type records.
Fix on previous commit e7abab878241592e
Signed-off-by: David Goulet <dgoulet@xxxxxxxxxxxxxx>
---
src/feature/relay/relay_metrics.c | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/src/feature/relay/relay_metrics.c b/src/feature/relay/relay_metrics.c
index 82abeeeee5..5f1238a5d3 100644
--- a/src/feature/relay/relay_metrics.c
+++ b/src/feature/relay/relay_metrics.c
@@ -165,25 +165,36 @@ fill_dns_error_values(void)
};
static const size_t num_errors = ARRAY_LENGTH(errors);
- for (size_t i = 0; i < num_dns_types; i++) {
- /* NOTE: Disable the record type label until libevent is fixed. */
+ /* NOTE: Disable the record type label until libevent is fixed. */
+ (void) num_dns_types;
#if 0
+ for (size_t i = 0; i < num_dns_types; i++) {
/* Dup the label because metrics_format_label() returns a pointer to a
* string on the stack and we need that label for all metrics. */
char *record_label =
tor_strdup(metrics_format_label("record", dns_types[i].name));
-#endif
for (size_t j = 0; j < num_errors; j++) {
sentry = metrics_store_add(the_store, rentry->type, rentry->name,
rentry->help);
- //metrics_store_entry_add_label(sentry, record_label);
+ metrics_store_entry_add_label(sentry, record_label);
metrics_store_entry_add_label(sentry,
metrics_format_label("reason", errors[j].name));
metrics_store_entry_update(sentry,
rep_hist_get_n_dns_error(dns_types[i].type, errors[j].key));
}
- //tor_free(record_label);
+ tor_free(record_label);
+ }
+#endif
+
+ /* Put in the DNS errors, unfortunately not per-type for now. */
+ for (size_t j = 0; j < num_errors; j++) {
+ sentry = metrics_store_add(the_store, rentry->type, rentry->name,
+ rentry->help);
+ metrics_store_entry_add_label(sentry,
+ metrics_format_label("reason", errors[j].name));
+ metrics_store_entry_update(sentry,
+ rep_hist_get_n_dns_error(0, errors[j].key));
}
}
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits