Commit Graph

36527 Commits

Author SHA1 Message Date
George Kadianakis f2da7b05b0 Add changes file for v3 metrics.
Closes ticket #23126.
2020-11-03 11:12:17 +02:00
George Kadianakis a96432ab06 Abstract v2/v3 "format stats to str" logic into a single function. 2020-11-03 11:12:17 +02:00
George Kadianakis 6178a64fcf Abstract v2/v3 "write stats to file" logic into a single function. 2020-11-03 11:12:17 +02:00
George Kadianakis 131da887d7 Write unittests for v3 metrics. 2020-11-03 11:12:17 +02:00
George Kadianakis 5c00bee1b1 Introduce v3 stat formatting functions.
They will be merged with the v2 ones in later commits.
2020-11-03 11:12:17 +02:00
George Kadianakis d0be2ae7f9 Extend get_voting_interval() so that it's callable by relays.
In the past, only authorities and clients had to use that function because of
the SRV subsystem. However, because of its use in rep_hist_hs_stats_init() it
will now also be used by relays when bootstrapping without a consensus. Make it
do something sensible.

Another approach (instead of using magic values) would be to wait
initialization of HSv3 stats until we get a consensus but that seems messy to
schedule.

Another approach would be to make dirauth_sched_get_configured_interval() also
work for relays (particularly when TestingNetwork is enabled), but that also
seems a good amount of work.
2020-11-03 11:12:17 +02:00
George Kadianakis f2eff17126 Introduce generic HS stats methods that apply to v2 and v3. 2020-11-03 11:12:17 +02:00
George Kadianakis 3cbc513ae7 Implement support for "v3 rend traffic" stat. 2020-11-03 11:09:34 +02:00
George Kadianakis 05880d238a Implement support for "unique v3 onions" stat. 2020-11-03 11:09:34 +02:00
George Kadianakis bd28551763 Introduce v3_stats_t structure and some of its methods. 2020-11-03 11:09:24 +02:00
George Kadianakis 5ed7fcec41 Make room for v3: Complete move from hs_stats_t to hs_v2_stats_t. 2020-11-02 21:05:50 +02:00
George Kadianakis 1de7843658 Make room for v3: s/hs_stats/hs_v2_stats/ 2020-11-02 21:05:05 +02:00
George Kadianakis 62d682e624 Make room for v3: Rename rephist objects to signify they are v2-only. 2020-11-02 21:04:43 +02:00
Nick Mathewson 7a75a1064f Fix another duplicate typedef.
Fixes #40177; bugfix on 0.4.5.1-alpha.
2020-11-02 07:15:10 -05:00
Nick Mathewson aa85284038 Update to 0.4.5.1-alpha-dev 2020-11-01 16:41:56 -05:00
Nick Mathewson 2667971336 rewrap changelog tor-0.4.5.1-alpha 2020-11-01 16:21:25 -05:00
Nick Mathewson 1fd058059c Edits on ChangeLog from seborn. 2020-11-01 11:46:08 -05:00
Nick Mathewson 6e25c49f76 Full round of edits on ChangeLog 2020-10-30 11:48:41 -04:00
Nick Mathewson e01f586e05 Bump version to 0.4.5.1-alpha 2020-10-30 11:05:22 -04:00
Nick Mathewson 013550d645 Sorting and editing on the changelog. 2020-10-30 11:04:38 -04:00
Nick Mathewson 4c165aca04 Run format_changelog 2020-10-30 10:59:14 -04:00
Nick Mathewson e6d3836d96 Minor edits to changelog headers 2020-10-30 10:58:57 -04:00
Nick Mathewson 7e56f80376 Start a changelog for 0.4.5.1-alpha. 2020-10-30 10:57:21 -04:00
Nick Mathewson 148b5b03a3 Merge branch 'bug40080_035' 2020-10-30 10:51:20 -04:00
George Kadianakis 54e6109499 Merge remote-tracking branch 'tor-gitlab/mr/174' into master 2020-10-30 14:14:14 +02:00
Nick Mathewson df16376004 Fix duplicate typedef in metrics_store_entry.h
Fixes #40171. Bug not in any released Tor.
2020-10-28 16:36:14 -04:00
Alexander Færøy 03be7de168 Merge branch 'maint-0.4.4' 2020-10-28 15:39:37 +00:00
Alexander Færøy b0e6ec627c Merge branch 'maint-0.4.3' into maint-0.4.4 2020-10-28 15:39:37 +00:00
Alexander Færøy 4876409c2a Merge branch 'maint-0.3.5' into maint-0.4.3 2020-10-28 15:39:37 +00:00
Alexander Færøy c37d05d0c6 Merge remote-tracking branch 'tor-gitlab/mr/171' 2020-10-28 15:15:39 +00:00
David Goulet 2edda444da test: Missing tor_free() in metrics unit tests
Found by coverity:

  *** CID 1468664:  Resource leaks  (RESOURCE_LEAK)
  /src/test/test_metrics.c: 83 in test_config()
  77       tt_int_op(ret, OP_EQ, false);
  78
  79      done:
  80       SMARTLIST_FOREACH(ports, port_cfg_t *, c, port_cfg_free(c));
  81       smartlist_free(ports);
  82       or_options_free(options);
  >>>     CID 1468664:  Resource leaks  (RESOURCE_LEAK)
  >>>     Variable "err_msg" going out of scope leaks the storage it points to.
  83     }
  84
  85     static char _c_buf[256];
  86     #define CONTAINS(conn, msg) \
  87       do { \
  88         tt_int_op(buf_datalen(conn->outbuf), OP_EQ, (strlen(msg))); \

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-10-28 08:52:02 -04:00
David Goulet 362229f184 lib/metrics: Fix wrong macro expansion
The "METRICS_PREFIX" was not expanded but rather used as a litteral. Fix that
by just removing the define and using "tor_" directly.

Reviewed-by: Alexander Færøy <ahf@torproject.org>
Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-10-27 13:00:20 -04:00
David Goulet 5de6673972 metrics: Add tor_ namespace to all metrics
Closes #40063

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-10-27 10:43:42 -04:00
David Goulet 238340ce54 test: Add test for onion service metrics module
Related to #40063

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-10-27 10:43:42 -04:00
David Goulet f65c0820af test: Metrics tests for lib/ and feature/
Related to #40063

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-10-27 10:43:42 -04:00
David Goulet 4c19eed35c tests: Fix unit tests after adding new HS metrics module
Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-10-27 10:43:42 -04:00
David Goulet f2e4204590 changes: File for ticket 40063, the MetricsPort
Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-10-27 10:43:42 -04:00
David Goulet 1c06c9f1c0 doc: Initial documentation of the lib/metrics
Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-10-27 10:43:42 -04:00
David Goulet 04ff22dc69 man: Add the MetricsPort manpage entry
Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-10-27 10:43:42 -04:00
David Goulet 97731196c4 hs: Collect introduction circuit metrics
Tracks the total number of established introduction circuit.

Related to #40063

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-10-27 10:43:42 -04:00
David Goulet c081bee38a hs: Collect rendezvous circuit metrics
The total number of rendezvous circuit created and the number of established
ones which is a gauge that decreases to keep an updated counter.

Related to #40063

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-10-27 10:43:42 -04:00
David Goulet 2fe0322fe4 hs: Collect service traffic metrics
Related to #40063

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-10-27 10:43:42 -04:00
David Goulet 695957511b hs: Always note the virtual port in the ident
Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-10-27 10:43:42 -04:00
David Goulet 50f44afeb4 hs: New metrics module
At this commit, a new service registers to the module and a store is created.
It also remove itself from the metrics module if it goes away.

In order to hook into the metrics subsystem, this commit attaches the HS
subsystem into the subsystem global list so its get_metrics() call can be
accessible.

HS initialization is still _not_ done through the subsys module as it is
likely require much more testing.

Related to #40063

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-10-27 10:43:42 -04:00
David Goulet 4f5cea1f59 conn: New Metrics listener port
If MetricsPort is defined, listen on it and handle the incoming request.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-10-27 10:43:42 -04:00
David Goulet a882d1bf0a metrics: New feature module to track tor metrics
Related to #40063

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-10-27 10:43:42 -04:00
David Goulet ec731290a5 lib: New metrics library
Used to provide an interface to create metrics store and update the entries.

Related to #40063

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-10-27 10:43:42 -04:00
David Goulet bd582583f6 Merge branch 'maint-0.4.4' 2020-10-27 10:20:05 -04:00
David Goulet 26cfac1880 Merge branch 'tor-gitlab/mr/176' into maint-0.4.4 2020-10-27 10:18:16 -04:00
David Goulet 6338fc2afa Merge branch 'tor-gitlab/mr/173' 2020-10-27 09:43:04 -04:00