9001/copyparty

statistics

9001 opened this issue · 1 comments

9001 commented

a suggestion came up on discord to add statistics; making an issue for ideas / brainstorming

help-wanted: mostly for ideas (see labels below), but just in case someone feels adventurous enough to tackle the implementation as well, I was roughly planning to do it based on u2idx, doing direct sqlite3 queries

design

  • how should this work? There will be an html page with basic display of the metrics, but should probably also be made available over some api. I have briefly heard of things like nagios and grafana, but I don't know what kind of api these expect. What softwares can I use to test this / integrate with? Would appreciate suggestions! help-wanted
  • should this require user authentication / some specific access-level, or is it fine if anyone can read it? Some of the metrics would be expensive to compute, so requiring auth might be in order

metrics

List of metrics that are easy to add,

  • number of uploads and/or unique uploaders, in each volume or in total, during the last N hours/days/... Or within a given timespan (date-date)
  • number of files, total size, in each volume / in total
  • number of deduplicated files / amount of space saved due to dedup
  • number of currently banned IPs
  • Probably more... help-wanted

unlikely metrics

List of metrics that are unlikely to be added

  • visitor / downloads counter -- would likely have a performance impact even if the feature is not in use, and also non-trivial -- could probably be done by parsing nginx logs instead
9001 commented

there is a stats/metrics endpoint at /.cpr/s/metrics which implements openmetrics 1.0.0

the following metrics were added:

  • server uptime
  • number of banned IPs
  • disk space available
  • disk space in use
  • volume size limit (bytes and num files)
  • current volume size (bytes and num files)
  • unfinished / incoming uploads (bytes and num files)

most of the metrics are listed per-volume and also as a total

the moving-window metrics mentioned previously (number of recent uploads and such) were not added because they don't appear to fit well in openmetrics