Skip to content

or_metrics: Furnish various OR metrics over MetricsPort

Alex Xu requested to merge Hello71/tor:or_metrics into main

In particular, number of circuits open, sent and received bytes, and allocated bytes broken down by type are now exposed. The first two are already printed in the heartbeat, but this allows finer-grained sampling. The third is useful for relay operators on low-memory systems. The benefit of this over a full memory profiler is that this incurs significantly less overhead, both CPU and RAM.

Includes !561 (merged).

I think the main thing this patchset is missing is tests. I don't see much point of unit testing or_metrics directly; it would basically be function x() { foo = 1; } foo = 0; x(); assert(foo == 1);. End-to-end tests for MetricsPort might be a good idea, but I don't think those exist? Tests for the malloc size tracking might or might not be a good idea; there have been some bugs in previous iterations, but I'm not sure tests would have covered them, and considering it's relatively simple arithmetic, I don't think tests will catch future bugs.

Merge request reports