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: aee6c346a76e
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2986a7759804
Choose a head ref
  • 2 commits
  • 1 file changed
  • 3 contributors

Commits on Jan 16, 2021

  1. nixos/prometheus: remote_{read,write}

    - add [remote_write](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#remote_write) and [remote_read](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#remote_read) support
    
    Co-authored-by: Yorick van Pelt <yorickvanpelt@gmail.com>
    (cherry picked from commit c53a0c1)
    2 people authored and flokli committed Jan 16, 2021
    Copy the full SHA
    5fa844b View commit details
  2. Merge pull request #109536 from flokli/prometheus-remote-read-write

    [20.09] nixos/prometheus: remote_{read,write}
    flokli authored Jan 16, 2021
    Copy the full SHA
    2986a77 View commit details
Showing with 140 additions and 0 deletions.
  1. +140 −0 nixos/modules/services/monitoring/prometheus/default.nix
140 changes: 140 additions & 0 deletions nixos/modules/services/monitoring/prometheus/default.nix
Original file line number Diff line number Diff line change
@@ -32,6 +32,8 @@ let
(pkgs.writeText "prometheus.rules" (concatStringsSep "\n" cfg.rules))
]);
scrape_configs = filterValidPrometheus cfg.scrapeConfigs;
remote_write = filterValidPrometheus cfg.remoteWrite;
remote_read = filterValidPrometheus cfg.remoteRead;
alerting = {
inherit (cfg) alertmanagers;
};
@@ -101,6 +103,126 @@ let
};
};

promTypes.remote_read = types.submodule {
options = {
url = mkOption {
type = types.str;
description = ''
ServerName extension to indicate the name of the server.
http://tools.ietf.org/html/rfc4366#section-3.1
'';
};
remote_timeout = mkDefOpt types.str "30s" ''
Timeout for requests to the remote write endpoint.
'';
relabel_configs = mkOpt (types.listOf promTypes.relabel_config) ''
List of remote write relabel configurations.
List of relabel configurations.
'';
name = mkOpt types.string ''
Name of the remote write config, which if specified must be unique among remote write configs.
The name will be used in metrics and logging in place of a generated value to help users distinguish between
remote write configs.
'';
basic_auth = mkOpt (types.submodule {
options = {
username = mkOption {
type = types.str;
description = ''
HTTP username
'';
};
password = mkOpt types.str "HTTP password";
password_file = mkOpt types.str "HTTP password file";
};
}) ''
Sets the `Authorization` header on every remote write request with the
configured username and password.
password and password_file are mutually exclusive.
'';
bearer_token = mkOpt types.str ''
Sets the `Authorization` header on every remote write request with
the configured bearer token. It is mutually exclusive with `bearer_token_file`.
'';
bearer_token_file = mkOpt types.str ''
Sets the `Authorization` header on every remote write request with the bearer token
read from the configured file. It is mutually exclusive with `bearer_token`.
'';
tls_config = mkOpt promTypes.tls_config ''
Configures the remote write request's TLS settings.
'';
proxy_url = mkOpt types.str "Optional Proxy URL.";
metadata_config = {
send = mkDefOpt types.bool "true" ''
Whether metric metadata is sent to remote storage or not.
'';
send_interval = mkDefOpt types.str "1m" ''
How frequently metric metadata is sent to remote storage.
'';
};
};
};

promTypes.remote_write = types.submodule {
options = {
url = mkOption {
type = types.str;
description = ''
ServerName extension to indicate the name of the server.
http://tools.ietf.org/html/rfc4366#section-3.1
'';
};
remote_timeout = mkDefOpt types.str "30s" ''
Timeout for requests to the remote write endpoint.
'';
relabel_configs = mkOpt (types.listOf promTypes.relabel_config) ''
List of remote write relabel configurations.
List of relabel configurations.
'';
name = mkOpt types.string ''
Name of the remote write config, which if specified must be unique among remote write configs.
The name will be used in metrics and logging in place of a generated value to help users distinguish between
remote write configs.
'';
basic_auth = mkOpt (types.submodule {
options = {
username = mkOption {
type = types.str;
description = ''
HTTP username
'';
};
password = mkOpt types.str "HTTP password";
password_file = mkOpt types.str "HTTP password file";
};
}) ''
Sets the `Authorization` header on every remote write request with the
configured username and password.
password and password_file are mutually exclusive.
'';
bearer_token = mkOpt types.str ''
Sets the `Authorization` header on every remote write request with
the configured bearer token. It is mutually exclusive with `bearer_token_file`.
'';
bearer_token_file = mkOpt types.str ''
Sets the `Authorization` header on every remote write request with the bearer token
read from the configured file. It is mutually exclusive with `bearer_token`.
'';
tls_config = mkOpt promTypes.tls_config ''
Configures the remote write request's TLS settings.
'';
proxy_url = mkOpt types.str "Optional Proxy URL.";
metadata_config = {
send = mkDefOpt types.bool "true" ''
Whether metric metadata is sent to remote storage or not.
'';
send_interval = mkDefOpt types.str "1m" ''
How frequently metric metadata is sent to remote storage.
'';
};
};
};

promTypes.scrape_config = types.submodule {
options = {
job_name = mkOption {
@@ -541,6 +663,24 @@ in {
'';
};

remoteRead = mkOption {
type = types.listOf promTypes.remote_read;
default = [];
description = ''
Parameters of the endpoints to query from.
See <link xlink:href="https://prometheus.io/docs/prometheus/latest/configuration/configuration/#remote_read">the official documentation</link> for more information.
'';
};

remoteWrite = mkOption {
type = types.listOf promTypes.remote_write;
default = [];
description = ''
Parameters of the endpoints to send samples to.
See <link xlink:href="https://prometheus.io/docs/prometheus/latest/configuration/configuration/#remote_write">the official documentation</link> for more information.
'';
};

rules = mkOption {
type = types.listOf types.str;
default = [];