aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_hs_metrics.c
diff options
context:
space:
mode:
authorGabriela Moldovan <gabi@torproject.org>2023-02-10 12:20:23 +0000
committerGabriela Moldovan <gabi@torproject.org>2023-02-16 18:54:30 +0000
commitdb4c4d656a8d3cc58bd6179c8dedd3f3b5f68dd6 (patch)
treea972533634b7dc888dafacd1d47026d3663dcf00 /src/test/test_hs_metrics.c
parent482ce87a8de23bf6d29ec55c1c7b9399dbdfac3b (diff)
downloadtor-db4c4d656a8d3cc58bd6179c8dedd3f3b5f68dd6.tar.gz
tor-db4c4d656a8d3cc58bd6179c8dedd3f3b5f68dd6.zip
metrics: Add metrics for rendezvous and introduction request failures.
This introduces a couple of new service side metrics: * `hs_intro_rejected_intro_req_count`, which counts the number of introduction requests rejected by the hidden service * `hs_rdv_error_count`, which counts the number of rendezvous errors as seen by the hidden service (this number includes the number of circuit establishment failures, failed retries, end-to-end circuit setup failures) Closes #40755. This partially addresses #40717. Signed-off-by: Gabriela Moldovan <gabi@torproject.org>
Diffstat (limited to 'src/test/test_hs_metrics.c')
-rw-r--r--src/test/test_hs_metrics.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/test/test_hs_metrics.c b/src/test/test_hs_metrics.c
index 8625933df7..03f6aedbb4 100644
--- a/src/test/test_hs_metrics.c
+++ b/src/test/test_hs_metrics.c
@@ -56,6 +56,23 @@ test_metrics(void *arg)
service, 0, 42);
tt_int_op(metrics_store_entry_get_value(entry), OP_EQ, 84);
+ /* Update tor_hs_intro_rejected_intro_req_count */
+ hs_metrics_update_by_ident(HS_METRICS_NUM_REJECTED_INTRO_REQ,
+ &service->keys.identity_pk, 0, 112);
+
+ entries = metrics_store_get_all(service->metrics.store,
+ "tor_hs_intro_rejected_intro_req_count");
+ tt_assert(entries);
+ tt_int_op(smartlist_len(entries), OP_EQ, 1);
+ entry = smartlist_get(entries, 0);
+ tt_assert(entry);
+ tt_int_op(metrics_store_entry_get_value(entry), OP_EQ, 112);
+
+ /* Update tor_hs_intro_rejected_intro_req_count entry by service now. */
+ hs_metrics_update_by_service(HS_METRICS_NUM_REJECTED_INTRO_REQ,
+ service, 0, 10);
+ tt_int_op(metrics_store_entry_get_value(entry), OP_EQ, 122);
+
done:
hs_free_all();
}