opacity/storage-node

Add metrics to prometheus for number of unique accounts

Closed this issue · 8 comments

Run a job every X minutes to count the number of unique accounts and set a metric on prometheus.

image

Same as for files: the way I would do this for the website counter is increment a simple counter each time a payment is complete (account created), not worry about exact current amount. For internal metrics, we would eventually need total number currently active to remove expired accounts from total (not urgent for 1.0 release).

@funkydrummer, @rfornea does this metric need to be real time (same for number of file uploaded). Can it have some delay on the counter?

@pzhao It sounds like Jason is wanting it to be real-time, i.e. it's probably more important for people to see the counter increment when they create an account and pay for it, than it is for it to be completely accurate.

If we're going with an approach where the counter increments everytime the backend detects a new paid account, and if we're reportingsimilar data for files, maybe we should add a simple metrics table that stores such values so that they persist.

Make sense. How do you query this metric from the client. Does the client ping the Prometheus server every sec?

Or do we have an endpoint to return such info

I don't think it has to be a 'real-time' counter. Some delay is fine.

@pzhao5 We have the metrics endpoint that the client could query, or there may be some other way for the client to ask the instance's prometheus service directly (port 9100 or 9090 or something).

Should be query via /admin/user_stats endpoint