rest-server icon indicating copy to clipboard operation
rest-server copied to clipboard

`/metrics` should also provide repository stats

Open NobbZ opened this issue 2 years ago • 3 comments

Output of rest-server --version

$ /nix/store/ikr0wfhq239s7s8l65b1bl0q53y213nr-restic-rest-server-0.10.0/bin/rest-server --version
rest-server 0.10.0 compiled with go1.16.9 on linux/amd64

What should rest-server do differently?

Currently the metrics reported in the /metrics endpoint are the default metrics for go programs and actually more about the runtime and process behavior, which is totally fine and important data, still it is missing the interesting things like number of users, number of repositories, size of them, user quotas, snapshots (per user/repo), etc

What are you trying to do? What is your use case?

I want to collect meaningful metrics about the repository.

NobbZ avatar Nov 18 '21 11:11 NobbZ

It would be nice to have this extra data, but currently rest-server does not have all of this information and it could be expensive to collect from the spinnings disks that typically serve as the storage. It would be useful to have, but the implementation does require some careful consideration and we may want to make this opt-in.

When quota are enabled, we do keep track of the total size, but not per user or repo (see also #65).

There is also the issue of potentially leaking too much information. We probably want to move the /metrics to a different port for this reason (see also #116) and then this would not be an issue.

wojas avatar Nov 18 '21 14:11 wojas

Could also allow for a different .htaccess / password for the /metrics endpoint. 'Cheap' statistics should should be trivial to cache and would be extremely useful would be disk free space and repo disk size, so people could make simple alerts like 'disk about to run full'.

Gaibhne avatar Apr 01 '22 12:04 Gaibhne

Adding simple disk usage and disk free space would be a good idea, indeed. It's cheap and does not leak sensitive information.

wojas avatar Apr 01 '22 12:04 wojas