I am not quite sure if I understand the terminology right.
Let’s say you nyx shows that you have 20 circuits. Can circuits be interpreted as users?
I think it depends on of you are a middle relay or a guard.
If you are a guard then you can’t say that if you have 20 circuits you have 20 different connected users, because one user can create another tab and this would create another circuit.
But I think if you are a middle relay you can assume that the 20 circuits are 20 users? The only possible exception I can think of would be that one user that is connected to e.g. my middle relay opens another tab and coincidentally get’s me again as a middle relay, but the possibility for that is obviously very low.
as a guard, you can use the same kind of processing as in Sources – Tor Metrics , but using only your own relay. The raw values are in $DataDirectory/stats/dirreq-stats. This will only count users for whom you are the guard though, not users using them as middle node.
For non-guard relay, maybe you could make some guesses based on the number of processed onionskins (data you can get from the MetricsPort, tor_relay_load_onionskins_total), but you’ll need to make some assumptions that are unlikely to be accurate, such as how many circuits would a single user make.