export and scrape dibbler prometheus stats #143
Open
vegardbm
wants to merge 1 commits from
dibbler-prometheus into main
pull from: dibbler-prometheus
merge into: Drift:main
Drift:main
Drift:temmie-userweb-per-user-fcgiwrap
Drift:bekkalokk-mediawiki-matrix-notifs
Drift:the-heccin-quotes
Drift:setup-openvpn-tunnel
Drift:bicep-garage-test-deployment
Drift:nettsiden-postgresql
Drift:dagali-heimdal-openldap-sasl-stack
Drift:gitea-robots-txt
Drift:bicep-revival
Drift:fmt
Drift:errorpages
Drift:PVVtheme2026
Drift:skrot-new-thing
Drift:loginpage
Drift:gitea-vaskepersonalet
Drift:create-flake-input-exporter
Drift:nom
Drift:pvvvvv
Drift:gitea-show-license-in-list-view
Drift:openwebui
Drift:openstack-image-builder
Drift:elysium
Drift:deploy-doorbell
Drift:misc-gitea-fixes
Drift:spotifyd
Drift:remote
Drift:setup-bikkje-login
Drift:ozai-prod
Drift:ozai
Drift:heimdal-openldap-sasl-testing-on-salsa-on-buskerud
Drift:misc1
Drift:add-simple-saml-theme
Drift:misc-extra-gitea-setup
Drift:setup-kerberos
Drift:setup-home-areas
Drift:shark-kanidm
Dismiss Review
Are you sure you want to dismiss this review?
Labels
Clear labels
art
backup
big
blocked
bug
comprehensive first issue
crash report
disputed
documentation
duplicate
enhancement
good first issue
logging
networking
nixos
question
salt
security
servers n' hardware
simple first issue
wontfix
The issue needs someone to be creative
No, not bug, **big** - this is gonna take a while
This issue/PR depends on one or more other issues/PRs
Something is not working, and it's not the shield hero
Do this as your first issue, and learn a lot of things
Report an oopsie
kranglefanter
Documentation changes required
This issue or pull request already exists
New feature
Get your hands dirty with a new project here
TTM4100
Requires changes to our nixos setup
More information is needed
Requires changes to our salt setup
Skommel
Regards hardware, servers or VMs
Done in nix no time
This won't be fixed
No Label
Milestone
No items
No Milestone
Assignees
adriangl (Adrian Gunnar Lauterer)
albertba (Albert Bayazidi)
alfhj (Alf Helge Jakobsen)
amalieem (Amalie Erdal Mansaker)
bjornoka (Bjornar Orjansen Kaarevik)
chrisfjo (Christian Fredrik Johnsen)
chrivi (Christoffer Viken)
danio (Daniel Lovbrotte Olsen)
davidk (David Kaasen)
dungby (Dung-Bai Yen)
eirikwit (Eirik Witterso)
felixalb (Felix Albrigtsen)
frero (Fredrik Robertsen)
jonmro (Jon Martinus Rodtang)
jovre (Jo Vassbotn Remvik)
karolds (Karoline Dyve Samuelsen)
knuta (Knut Auvor Grythe)
krisleri (Kristoffer Longva Eriksen)
larshhan (Lars Halvor Hansen)
olived (Oliver Didriksen-Kolstad)
oysteikt (Oystein Kristoffer Tveit)
pederbs (Peder Bergebakken Sundt)
root (rot)
torsteno (Torstein Nordgård-Hansen)
vegardbm (Vegard Bieker Matthey)
yorinad (Yorin Anne De Jong)
Clear assignees
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: Drift/pvv-nixos-config#143
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "dibbler-prometheus"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
As it stands it would be pretty difficult to add another database connection.
closes Drift/issues#192
@@ -0,0 +15,4 @@jobs.dibbler = {interval = "1m";connections = ["postgres://pvv_vv:WP97&amDp&*gfhg3TyR8@postgres.pvv.ntnu.no"bro...
lol, lmao even
13a9af64bcto864cdab35e@@ -0,0 +48,4 @@help = "Sum of purchases for the current day.";labels = [ "thing" ];values = [ "sum" ];query = "SELECT SUM(price) FROM purchases GROUP BY DATE(time) ORDER BY DATE(time) DESC LIMIT 1";This is likely inefficient.
If we put a database index on
timeit's probably gonna be less inefficient. How fast does it run with current data?There is another one which is also pretty bad compared to the others:
Yeah, but that one is kinda inherent. There's no way to sum all purchases without actually looping over all the purchases and summing them. You can speed either by creating a index on the expression (effectively moving the calculation to being done everytime someone makes a purchase) or by doing more fancy things to only sum news rows onto a previously cached sum.
I wouldn't really worry though, it's still just 16 milliseconds
Here's the relevant statements ftr:
@@ -1,5 +1,6 @@config:mysqld_exporter_password: ENC[AES256_GCM,data:I9K+QMqaN3FOOVKzeOR9Q6UERStXX0P8WEHyN1jzzbM=,iv:UxvIdlfAyJvNuxPkU4+guKPa0fiD0vVLzHOTYktcmso=,tag:ltnIqEwESYx9HBu8UN0ZLw==,type:str]postgresql_dibbler_password: ENC[AES256_GCM,data:wP4CVz9qRE3CJrblWWYqOIkcH3LM5H81,iv:j8zr1TRNlPPqIppYlWhDoKlL7m2Ph2wQlU6bvFj8R9A=,tag:Cfp8zbYkoLqI7DTDpOBlJw==,type:str]This duplicates the dibbler postgresql database password.
Probably fine for now, we don't have very good order in our sops files. At some point we should do some spring cleaning and create shared files for shared passwords
@@ -0,0 +80,4 @@LoadCredential = "postgresql_dibbler_password:${config.sops.secrets."config/postgresql_dibbler_password".path}";ExecStartPre = ''/bin/sh -c '${lib.getExe' pkgs.coreutils "cat"} ${configFile} | ${lib.getExe' pkgs.jq "jq"} -c \".jobs[0].connections[0]=\\\"postgres://pvv_vv:$(${lib.getExe' pkgs.coreutils "cat"} %d/postgresql_dibbler_password)@postgres.pvv.ntnu.no\\\"\" > /run/prometheus-sql-exporter/config.yaml' '';This one is kinda hard to read.
Modern systemd allows you to prepend a
|to get rid of the/bin/shinvocation.jqalso has--slurpfileand--rawfileto get rid of most of the file trickery. Also, newlines are allowed with a\just like inExecStart(alternatively you can construct the args withlib.cli.toCommandLineShellGNU)What you provided works. Modified to use |, --slurpfile and --rawfile.
864cdab35etobe87d98060View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.