-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
prometheus-rspamd-exporter broken on 22.11 and unstable #210390
Comments
I think the easiest/quickest way to fix this is probably to just wrap the current config in {
"modules": {
"default": ?
}
} That would fix the immediate issue AFAICT. |
Could probably change this line
to
This is really hard to patch after-the-fact outside of Nixpkgs without copy-pasting basically the whole module. This is the module I would think to write as a workaround: long code block{ lib, config, pkgs, ... }: {
systemd.services.prometheus-rpsamd-exporter.serviceConfig.ExecStart = let
cfg = config.services.prometheus.exporters.rspamd;
mkFile = conf:
pkgs.writeText "rspamd-exporter-config.yml" (builtins.toJSON conf);
generateConfig = extraLabels: {
modules.default.metrics = (map (path: {
name = "rspamd_${replaceStrings [ "[" "." " " "]" "\\" "'" ] [ "_" "_" "_" "" "" "" ] path}";
path = "{ .${path} }";
labels = extraLabels;
}) [
"actions['add\\ header']"
"actions['no\\ action']"
"actions['rewrite\\ subject']"
"actions['soft\\ reject']"
"actions.greylist"
"actions.reject"
"bytes_allocated"
"chunks_allocated"
"chunks_freed"
"chunks_oversized"
"connections"
"control_connections"
"ham_count"
"learned"
"pools_allocated"
"pools_freed"
"read_only"
"scanned"
"shared_chunks_allocated"
"spam_count"
"total_learns"
]) ++ [{
name = "rspamd_statfiles";
type = "object";
path = "{.statfiles[*]}";
labels = recursiveUpdate {
symbol = "{.symbol}";
type = "{.type}";
} extraLabels;
values = {
revision = "{.revision}";
size = "{.size}";
total = "{.total}";
used = "{.used}";
languages = "{.languages}";
users = "{.users}";
};
}];
};
in
lib.mkForce ''
${pkgs.prometheus-json-exporter}/bin/json_exporter \
--config.file ${mkFile (generateConfig cfg.extraLabels)} \
--web.listen-address "${cfg.listenAddress}:${toString cfg.port}" \
${concatStringsSep " \\\n " cfg.extraFlags}
'';
} |
Fixed by #208715. For some reason I hadn't found that PR when I searched on GitHub while making this issue. |
Describe the bug
The config.yml for
json_exporter
produced by NixOS' prometheus-rspamd-exporter module does not work withjson_exporter
0.5.0, which is the version shipped by NixOS 22.11 and current unstable.There was a breaking change in their config format: prometheus-community/json_exporter#166
Now, a top-level
modules
key is needed, and all config files for json_exporter 0.4.0 and prior are broken.Steps To Reproduce
Steps to reproduce the behavior:
services.prometheus.exporters.rspamd
and configure itcurl localhost:7980/probe
Instead of returning metrics, the exporter answers with a HTTP 400 and
Unknown module "default"
.Expected behavior
The exporter should return metrics, as it did on NixOS 22.05 with json_exporter 0.4.0.
Screenshots
Log output from starting the exporter on 22.05:
And on 22.11:
Note how 0 modules get loaded.
Additional context
It's possible that other exporters that are based on json_exporter also need fixing.
Notify maintainers
@WilliButz
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.The text was updated successfully, but these errors were encountered: