feat(matrix-synapse): enable metrics #100

Merged
teutat3s merged 4 commits from feat/synapse-metrics into main 2024-01-28 23:56:42 +00:00
2 changed files with 24 additions and 4 deletions
Showing only changes of commit 69b976607f - Show all commits

View file

@ -55,7 +55,6 @@ in
compress = false;
names = [
"federation"
"metrics"
];
}
];
@ -63,6 +62,20 @@ in
type = "http";
x_forwarded = true;
}
{
bind_addresses = [
"127.0.0.1"
];
port = 8012;
resources = [
{
names = [
"metrics"
];
}
];
type = "metrics";
}
];
account_threepid_delegates.msisdn = "";

View file

@ -1,7 +1,14 @@
{ config, flake, lib, ... }:
let
# Get port from first element in list of matrix-synapse listeners
synapsePort = "${toString (lib.findFirst (listener: listener.port != null) "" config.services.matrix-synapse.settings.listeners).port}";
# Find element in list config.services.matrix-synapse.settings.listeners
# that sets type = "metrics"
listenerWithMetrics = lib.findFirst
(listener:
listener.type == "metrics")
(throw "Found no matrix-synapse.settings.listeners.*.type containing string metrics")
config.services.matrix-synapse.settings.listeners
;
synapseMetricsPort = "${toString listenerWithMetrics.port}";
in
{
age.secrets.nachtigall-metrics-nginx-basic-auth = {
@ -18,7 +25,7 @@ in
proxyPass = "http://127.0.0.1:${toString(config.services.prometheus.exporters.node.port)}";
};
locations."/_synapse/metrics" = {
proxyPass = "http://127.0.0.1:${synapsePort}";
proxyPass = "http://127.0.0.1:${synapseMetricsPort}";
};
};
};