Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2df0a3e45304
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: bfd706923e4d
Choose a head ref
  • 4 commits
  • 1 file changed
  • 3 contributors

Commits on May 19, 2020

  1. prometheus: Split options listenAddress and port

    Accessing the configured port of a service is quite useful, for example
    when configuring virtual hosts for a service. The prometheus module did
    not expose the configured por separately, making it unnecessarily
    cumbersome to consume.
    
    This is a breaking change only if you were setting `listenAddress` to
    a non-standard value. If you were, you should now set `listenAddress`
    and `port` separately.
    Christian Höppner committed May 19, 2020
    Copy the full SHA
    ba3c3de View commit details

Commits on Jul 23, 2020

  1. Copy the full SHA
    5d2a465 View commit details
  2. 1
    Copy the full SHA
    e1d80de View commit details

Commits on Aug 23, 2020

  1. Merge pull request #87700 from serokell/mkaito/upstream/prometheus-port

    prometheus: Split options listenAddress and port
    Lassulus authored Aug 23, 2020
    Copy the full SHA
    bfd7069 View commit details
Showing with 25 additions and 2 deletions.
  1. +25 −2 nixos/modules/services/monitoring/prometheus/default.nix
27 changes: 25 additions & 2 deletions nixos/modules/services/monitoring/prometheus/default.nix
Original file line number Diff line number Diff line change
@@ -46,7 +46,7 @@ let
cmdlineArgs = cfg.extraFlags ++ [
"--storage.tsdb.path=${workingDir}/data/"
"--config.file=${prometheusYml}"
"--web.listen-address=${cfg.listenAddress}"
"--web.listen-address=${cfg.listenAddress}:${builtins.toString cfg.port}"
"--alertmanager.notification-queue-capacity=${toString cfg.alertmanagerNotificationQueueCapacity}"
"--alertmanager.timeout=${toString cfg.alertmanagerTimeout}s"
] ++
@@ -489,9 +489,17 @@ in {
'';
};

port = mkOption {
type = types.port;
default = 9090;
description = ''
Port to listen on.
'';
};

listenAddress = mkOption {
type = types.str;
default = "0.0.0.0:9090";
default = "0.0.0.0";
description = ''
Address to listen on for the web interface, API, and telemetry.
'';
@@ -619,6 +627,21 @@ in {
};

config = mkIf cfg.enable {
assertions = [
( let
legacy = builtins.match "(.*):(.*)" cfg.listenAddress;
in {
assertion = legacy == null;
message = ''
Do not specify the port for Prometheus to listen on in the
listenAddress option; use the port option instead:
services.prometheus.listenAddress = ${builtins.elemAt legacy 0};
services.prometheus.port = ${builtins.elemAt legacy 1};
'';
}
)
];

users.groups.prometheus.gid = config.ids.gids.prometheus;
users.users.prometheus = {
description = "Prometheus daemon user";