1 { config, lib, pkgs, options, ... }:
4 cfg = config.services.prometheus.exporters.buildkite-agent;
16 tokenPath = mkOption {
17 type = types.nullOr types.path;
18 apply = final: if final == null then null else toString final;
20 The token from your Buildkite "Agents" page.
22 A run-time path to the token file, which is supposed to be provisioned
31 How often to update metrics.
36 default = "https://agent.buildkite.com/v3";
38 The Buildkite Agent API endpoint.
42 type = with types; nullOr (listOf str);
44 example = literalExpression ''[ "my-queue1" "my-queue2" ]'';
46 Which specific queues to process.
53 queues = concatStringsSep " " (map (q: "-queue ${q}") cfg.queues);
56 export BUILDKITE_AGENT_TOKEN="$(cat ${toString cfg.tokenPath})"
57 exec ${pkgs.buildkite-agent-metrics}/bin/buildkite-agent-metrics \
59 -interval ${cfg.interval} \
60 -endpoint ${cfg.endpoint} \
61 ${optionalString (cfg.queues != null) queues} \
62 -prometheus-addr "${cfg.listenAddress}:${toString cfg.port}" ${concatStringsSep " " cfg.extraFlags}
66 RuntimeDirectory = "buildkite-agent-metrics";