summaryrefslogtreecommitdiff
path: root/src/feature/stats
AgeCommit message (Collapse)Author
2023-08-09Extend DoS protection to partially-open channelsMicah Elizabeth Scott
tor only marks a channel as 'open' once the TLS and OR handshakes have both completed, and normal "client" (ORPort) DoS protection is not enabled until the channel becomes open. This patch adds an additional earlier initialization path for DoS protection on incoming TLS connections. This leaves the existing dos_new_client_conn() call sites intact, but adds a guard against multiple-initialization using the existing tracked_for_dos_mitigation flag. Other types of channels shouldn't be affected by this patch.
2023-05-25Removed getter abstraction and moved from rephist to relay_metrics.friendly73
2023-05-25Fixed est intro getter using wrong arrayfriendly73
2023-05-25Fixed REND1 metric label valuefriendly73
2023-05-25Added INTRO and REND metrics for relay.friendly73
2022-11-08Merge branch 'maint-0.4.7'David Goulet
2022-11-03metrics: Add connection socket family to metricsDavid Goulet
Adds either ipv4 or ipv6 to the "tor_relay_connections_total" stats. Closes #40710 Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-10-27Merge branch 'maint-0.4.7'David Goulet
2022-10-27metrics: Fix naming and documentationDavid Goulet
After nickm's review, minor changes to names and comments. Related to #40194 Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-10-26rephist: Track number of streams seen per typeDavid Goulet
Related to #40194 Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-10-12Merge branch 'maint-0.4.7'David Goulet
2022-10-12relay: Add number of rejected connections to MetricsPortDavid Goulet
Related to #40194 Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-10-12conn: Keep stats of opened and closed connectionsDavid Goulet
Related to #40194 Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-07-05fix easy typosRoger Dingledine
2022-03-15rephist: Introduce a fraction and period for overload onionskinDavid Goulet
This code was heavily reused from the previous DNS timeout work done in ticket #40491 that was removed afterall from our code. Closes #40560 Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-02-22Handle other places that use onion handshake type valuesMike Perry
We want ntor and ntorv3 to use the same queues and stats.
2021-12-13relay: Change DNS timeout label on MetricsPortDavid Goulet
Change it from "timeout" to "tor_timeout" in order to indicate that the DNS timeout is one from tor's DNS threshold and not the DNS server itself. Fixes #40527 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-12-13Merge branch 'ticket40527_046_01' into ticket40527_047_01David Goulet
2021-12-13relay: Don't make DNS timeout trigger an overloadDavid Goulet
Tor has configure libevent to attempt up to 3 times a DNS query for a maximum of 5 seconds each. Once that 5 seconds has elapsed, it consider the query "Timed Out" but tor only gets a timeout if all 3 attempts have failed. For example, using Unbound, it has a much higher threshold of timeout. It is well defined in https://www.nlnetlabs.nl/documentation/unbound/info-timeout/ and has some complexity to it. But the gist is that if it times out, it will be much more than 5 seconds. And so the Tor DNS timeouts are more of a "UX issue" rather than a "network issue". For this reason, we are removing this metric from the overload general signal. See https://gitlab.torproject.org/tpo/network-health/team/-/issues/139 for more information. Fixes #40527 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-21Merge branch 'maint-0.4.5' into maint-0.4.6Alexander Færøy
2021-10-20relay: For metrics, don't report DNS errors by query typeDavid Goulet
This is due to the libevent bug https://github.com/libevent/libevent/issues/1219 that fails to return back the DNS record type on error. And so, the MetricsPort now only reports the errors as a global counter and not a per record type. Closes #40490 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-20relay: Overload state on DNS timeout is now X% over Y secsDavid Goulet
With this commit, we will only report a general overload state if we've seen more than X% of DNS timeout errors over Y seconds. Previous behavior was to report when a single timeout occured which is really too small of a threshold. The value X is a consensus parameters called "overload_dns_timeout_scale_percent" which is a scaled percentage (factor of 1000) so we can represent decimal points for X like 0.5% for instance. Its default is 1000 which ends up being 1%. The value Y is a consensus parameters called "overload_dns_timeout_period_secs" which is the time period for which will gather DNS errors and once over, we assess if that X% has been reached ultimately triggering a general overload signal. Closes #40491 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-20relay: Overload state on DNS timeout is now X% over Y secsDavid Goulet
With this commit, we will only report a general overload state if we've seen more than X% of DNS timeout errors over Y seconds. Previous behavior was to report when a single timeout occured which is really too small of a threshold. The value X is a consensus parameters called "overload_dns_timeout_scale_percent" which is a scaled percentage (factor of 1000) so we can represent decimal points for X like 0.5% for instance. Its default is 1000 which ends up being 1%. The value Y is a consensus parameters called "overload_dns_timeout_period_secs" which is the time period for which will gather DNS errors and once over, we assess if that X% has been reached ultimately triggering a general overload signal. Closes #40491 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-06-28Merge remote-tracking branch 'tor-gitlab/mr/385'George Kadianakis
2021-06-14Merge remote-tracking branch 'tor-gitlab/mr/338'Nick Mathewson
2021-05-20Fix the fencepost issue when we check stability_last_downratedNeel Chauhan
2021-05-12rephist: Add a counter for the onioniskins statsDavid Goulet
Current counters are reset every heartbeat. This commit adds two counters for the assigned and dropped onionskins that are not reset so they can be exported onto the MetricsPort. Closes #40387 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-05-12relay: We might be noting down an unknown DNS error typeDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-05-12relay: Add TCP port exhaustion metricsDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-05-12dns: Gather DNS request statisticsDavid Goulet
We now keep track of all errors and total number of request seen. This is so we can expose those values to the MetricsPort to help Exit operators monitor the DNS requests and failures. Related to #40367. Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-05-12relay: Add the global connection limit metricsDavid Goulet
This emits two events (read and write) of the total number that the global connection limit was reached. Related to #40367 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-05-12relay: Add the onionskins processing metricsDavid Goulet
With this commit, a relay now emits metrics event on the MetricsPort related to how many onionskins were handled (processed or dropped) for each handshake type. Related to #40367 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-05-11Make MinTimeToReportBandwidth a testing-only option (and rename it)Nick Mathewson
2021-05-11Make client heartbeat stats tied to the heartbeat period.Nick Mathewson
Patch from cypherpunks. Closes #40330.
2021-04-13relay: Move "overload-general" from extra-info to server descriptor.Alexander Færøy
Fixes #40364 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-03-18Terminate rep_hist_get_overload_stats_lines() with an NL.tor-0.4.6.1-alphaNick Mathewson
We use it in router.c, where chunks are joined with "", not with NL... so leaving off the terminating NL will lead to an unparseable extrainfo. Found by toralf. Bug not in any released Tor.
2021-03-17Fix compiler warning about signed/unsigned conversion.George Kadianakis
``` src/feature/stats/rephist.c: In function ‘overload_happened_recently’: src/feature/stats/rephist.c:215:21: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare] if (overload_time > approx_time() - 3600 * n_hours) { ``` from https://gitlab.torproject.org/tpo/core/tor/-/issues/40341#note_2729364
2021-03-17Merge branch 'mr/334'George Kadianakis
2021-03-17Rate-limit counter should increase once per minute.George Kadianakis
2021-03-17Implement backbone of overload statistics.George Kadianakis
- Implement overload statistics structure. - Implement function that keeps track of overload statistics. - Implement function that writes overload statistics to descriptor. - Unittest for the whole logic.
2021-03-17Add a MinTimeToReportBandwidth option; make it 0 for testing networks.Nick Mathewson
This option changes the time for which a bandwidth measurement period must have been in progress before we include it when reporting our observed bandwidth in our descriptors. Without this option, we only consider a time period towards our maximum if it has been running for a full day. Obviously, that's unacceptable for testing networks, where we'd like to get results as soon as possible. For non-testing networks, I've put a (somewhat arbitrary) 2-hour minimum on the option, since there are traffic analysis concerns with immediate reporting here. Closes #40337.
2021-03-12Run "make autostyle" in advance of new series.Nick Mathewson
2021-03-12Update copyrights to 2021, using "make update-copyright"Nick Mathewson
2021-02-23Merge remote-tracking branch 'origin/master'Nick Mathewson
2021-02-22dos: New client connect rate detectionDavid Goulet
This is a new detection type which is that a relay can now control the rate of client connections from a single address. The mechanism is pretty simple, if the rate/burst is reached, the address is marked for a period of time and any connection from that address is denied. Closes #40253 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-22relay: Remove dirport reachability self testDavid Goulet
Regular relays are about to get their DirPort removed so that reachability test is not useful anymore Authorities will still use the DirPort but because network reentry towards their DirPort is now denied network wide, this test is not useful anymore and so it should simply be considered reachable at all time. Part of #40282 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-19hs: Remove v2 statsDavid Goulet
We still keep v2 rendezvous stats since we will allow them until the network has entirely phased out. Related to #40266 Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-11-23Revert HSv3 stats string formatting to its old %u self.George Kadianakis
The rest of rephist.c is doing the same kind of unsigned casting. For example see rep_hist_format_buffer_stats() and rep_hist_format_exit_stats(). The previous switch to %ld made Appveyor fail: https://ci.appveyor.com/project/torproject/tor/builds/36118502
2020-11-17Merge branch 'tor-gitlab/mr/182' into masterDavid Goulet
2020-11-12Fix typos.Samanta Navarro
Typos found with codespell. Please keep in mind that this should have impact on actual code and must be carefully evaluated: src/core/or/lttng_circuit.inc - ctf_enum_value("CONTROLER", CIRCUIT_PURPOSE_CONTROLLER) + ctf_enum_value("CONTROLLER", CIRCUIT_PURPOSE_CONTROLLER)