cargo-quickinstall icon indicating copy to clipboard operation
cargo-quickinstall copied to clipboard

switch to hosted influxdb for stats

Open alsuren opened this issue 2 years ago • 2 comments

I think that our redis instance is maybe full or something. I've archived some of the stats onto https://github.com/cargo-bins/cargo-quickinstall/issues/106 but I didn't delete them from redis. Maybe I should do that now.

Crazy plan:

  • [x] delete stats from redis to get us up and running again
  • [ ] stop using redis for stats
    • [x] pick influxdb IOx is now the default and the free tier pricing is generous - https://www.influxdata.com/influxdb-cloud-pricing/ (5MB/5 minutes, with 30day retention)
      • [x] set up an org
      • [x] add @NobodyXu (currently sharing the org with my backup mijia-homie monitoring, but I will probably bin that soon)
      • [x] add other maintainers (email addresses please)
    • [x] (optional) make the existing stats server proxy http requests onto another stats server that we can all mess about with (or fan out and give everyone their own "staging" server?)
    • [x] write stats to influxdb using the http api
      • [x] read the docs on influxdb https://docs.influxdata.com/influxdb/cloud-iox/get-started/
      • [x] design schema
        • [x] each install request is an integer count of 1 inserted into a "counts" table, with tags for arch, version, package, client etc.
      • [x] use http api to do the writing
        • [x] give vercel the secrets to our influxdb org
        • [x] write one stat per request (influx wire format is super-simple, but client libraries exist for many languages - we use https://github.com/driftluo/InfluxDBClient-rs in homie-influx but in typescript we could use https://github.com/influxdata/influxdb-client-js if we stick with typescript)
    • [ ] make github actions cronjob read from influxdb directly
      • [ ] select sum of all counts from the previous day, for the selected arch, grouped by package name
    • [ ] (optional) make a cronjob that archives stats onto a git branch.
    • [ ] (optional) make a thing to roll-up the data into one point per hour per (crate, version, arch, client) (summing up the counts for each tag) and set the milisecond-precision database retention policy to 1 week or something

Outstanding questions:

  • [ ] Should we switch away from typescript while we are do this?
  • [ ] Should we use this as an opportunity to fold the stats server code into this monorepo?

alsuren avatar Mar 04 '23 15:03 alsuren

@cargo-bins/binstall can you guys all provide your email address please?

NobodyXu avatar Mar 04 '23 16:03 NobodyXu

make a thing to roll-up the data into one point per hour per (crate, version, arch, client) (summing up the counts for each tag) and set the milisecond-precision database retention policy to 1 week or something

influx can do that for you btw, it's a core feature

passcod avatar Mar 05 '23 01:03 passcod