diff --git a/nixos/modules/services/monitoring/thanos.nix b/nixos/modules/services/monitoring/thanos.nix index 93e858c6607..b41e99b7647 100644 --- a/nixos/modules/services/monitoring/thanos.nix +++ b/nixos/modules/services/monitoring/thanos.nix @@ -113,23 +113,39 @@ let ''; }; - gcloudtrace = { + tracing = cfg: { + tracing.config-file = { + toArgs = _opt: path: optionToArgs "tracing.config-file" path; + option = mkOption { + type = with types; nullOr str; + default = if cfg.tracing.config == null then null + else toString (toYAML "tracing.yaml" cfg.tracing.config); + defaultText = '' + if config.services.thanos..tracing.config == null then null + else toString (toYAML "tracing.yaml" config.services.thanos..tracing.config); + ''; + description = '' + Path to YAML file that contains tracing configuration. + ''; + }; + }; - gcloudtrace.project = mkParam types.str '' - GCP project to send Google Cloud Trace tracings to. + tracing.config = + { + toArgs = _opt: _attrs: []; + option = nullOpt types.attrs '' + Tracing configuration. - If null, tracing will be disabled. - ''; + When not null the attribute set gets converted to + a YAML file and stored in the Nix store. The option + will default to its path. - gcloudtrace.sample-factor = mkParamDef types.int 1 '' - How often we send traces 1/<sample-factor>. - - If 0 no trace will be sent periodically, unless - forced by baggage item. - ''; + If is set this option has no effect. + ''; + }; }; - common = params.log // params.gcloudtrace // { + common = cfg: params.log // params.tracing cfg // { http-address = mkParamDef types.str "0.0.0.0:10902" '' Listen host:port for HTTP endpoints. @@ -190,7 +206,7 @@ let }; }; - sidecar = params.common // params.objstore cfg.sidecar // { + sidecar = params.common cfg.sidecar // params.objstore cfg.sidecar // { prometheus.url = mkParamDef types.str "http://localhost:9090" '' URL at which to reach Prometheus's API. @@ -224,7 +240,7 @@ let }; - store = params.common // params.objstore cfg.store // { + store = params.common cfg.store // params.objstore cfg.store // { stateDir = mkStateDirParam "data-dir" "thanos-store" '' Data directory relative to /var/lib @@ -262,7 +278,7 @@ let ''; }; - query = params.common // { + query = params.common cfg.query // { grpc-client-tls-secure = mkFlagParam '' Use TLS when talking to the gRPC server @@ -385,7 +401,7 @@ let ''; }; - rule = params.common // params.objstore cfg.rule // { + rule = params.common cfg.rule // params.objstore cfg.rule // { labels = mkAttrsParam "label" '' Labels to be applied to all generated metrics. @@ -497,7 +513,7 @@ let ''; }; - compact = params.log // params.gcloudtrace // params.objstore cfg.compact // { + compact = params.log // params.tracing cfg.compact // params.objstore cfg.compact // { http-address = mkParamDef types.str "0.0.0.0:10902" '' Listen host:port for HTTP endpoints. @@ -553,7 +569,7 @@ let ''; }; - downsample = params.log // params.gcloudtrace // params.objstore cfg.downsample // { + downsample = params.log // params.tracing cfg.downsample // params.objstore cfg.downsample // { stateDir = mkStateDirParam "data-dir" "thanos-downsample" '' Data directory relative to /var/lib @@ -562,7 +578,7 @@ let }; - receive = params.common // params.objstore cfg.receive // { + receive = params.common cfg.receive // params.objstore cfg.receive // { remote-write.address = mkParamDef types.str "0.0.0.0:19291" '' Address to listen on for remote write requests. diff --git a/pkgs/servers/monitoring/thanos/default.nix b/pkgs/servers/monitoring/thanos/default.nix index 4bb7e8e037c..28218b8f66d 100644 --- a/pkgs/servers/monitoring/thanos/default.nix +++ b/pkgs/servers/monitoring/thanos/default.nix @@ -1,16 +1,16 @@ { stdenv, buildGoModule, fetchFromGitHub }: buildGoModule rec { pname = "thanos"; - version = "0.5.0"; + version = "0.6.0"; src = fetchFromGitHub { rev = "v${version}"; owner = "improbable-eng"; repo = "thanos"; - sha256 = "0my0653mkb14m93s4x3nyf8khyljkvi5sq049lir8yqzqn7p1654"; + sha256 = "0vcp7m8fsk4jyk49jh9wmbvkx5k03xw10f4lbsxfmwib1y5pz2x0"; }; - modSha256 = "1236cg00h8077fmvyddwjsnw85r69ac18b2chcpgzd85xdcaxavk"; + modSha256 = "139b66jdryqv4s1hjbn9fzkyzn1160wr4z6a6wmmvm3f6p6wgjxp"; subPackages = "cmd/thanos";