nixos/prometheus: add ec2_sd_configs
section to scrape_configs
#54691
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation for this change
Prometheus's configuration in Nix is exhaustively specified. To use any of the various service discovery mechanisms they must be defined in the module. This adds definitions for the EC2 service discovery according to the Prometheus Documentation for version 1.8, matching the default value of
config.services.prometheus.package
.Applies cleanly to 18.09 where I tested it, and is purely additive. If merged, I'd like it to be backported as well.
In the interests of not having to closely track upstream changes, would it be preferable to have an
extraConfigs
insidescrapeConfigs
, that is merged as pure data? For example, if a user wants to use prometheus 2.6, it has a new option in the EC2 service discovery section calledfilters
. As is, this is impossible(?) without updating this module again, but with anextraConfigs
there's an escape.Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)