nix-dotfiles/hosts/tsuki/services/grafana/prometheus-exporters/matrix-synapse.nix
h7x4 45497aea2b
tsuki: set up proper grafana infrastructure
- Set up a bunch of exporters
- Download matching dashboard declarations
- Remove influxdb
2023-01-20 19:55:52 +01:00

29 lines
854 B
Nix

{ lib, config, ... }:
{
services.prometheus.scrapeConfigs =
lib.pipe config.services.matrix-synapse-next.workers.instances [
(lib.mapAttrsToList (_: v: v))
# Add metrics for main process to the list of workers
(x: x ++ [{ type = "master"; index = 1; settings.worker_listeners = [{ port = 9000; }]; }])
(map (w: let
port = lib.pipe w.settings.worker_listeners [
lib.last
(l: l.port)
toString
];
in {
job_name = "synapse-${port}";
scrape_interval = "15s";
metrics_path = "/_synapse/metrics";
static_configs = [{
targets = [ "localhost:${port}" ];
labels = {
instance = "matrix.nani.wtf";
job = w.type;
index = toString w.index;
};
}];
}))
];
}