Watch
0
0
Fork
You've already forked hyperhive
0

ci runner: export its built-in metrics through the container's forwarder

This commit is contained in:
atlas 2026-11-04 22:26:54 +01:00
commit 0bc350a8a1

View file

@ -116,6 +116,22 @@ in
'';
};
extraScrapeTargets = lib.mkOption {
type = lib.types.attrsOf (lib.types.strMatching "127\\.0\\.0\\.1:[0-9]+");
default = { };
example = {
gitea-runner = "127.0.0.1:9101";
};
description = ''
Prometheus endpoints of processes in this container, scraped by the
collector and pushed to the swarm collector like its journal. The
attribute name is the scrape job, which becomes the series'
`service.name`; the value is a loopback `127.0.0.1:<port>` address, so
nothing listens outside the container. Empty: no scrape and no extra
pipeline.
'';
};
hostSecretFile = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
@ -257,6 +273,16 @@ in
exporter = "otlphttp";
attributes.container = cfg.serviceName;
})
(lib.mkIf (cfg.extraScrapeTargets != { }) {
receivers."prometheus/extra".config.scrape_configs = lib.mapAttrsToList (job: target: {
job_name = job;
static_configs = [ { targets = [ target ]; } ];
}) cfg.extraScrapeTargets;
service.pipelines."metrics/extra" = {
receivers = [ "prometheus/extra" ];
exporters = [ "otlphttp" ];
};
})
# A separate set the module system merges in: joining it to the first with
# `//` would replace the first set's whole `service` attrset.
(lib.mkIf (cfg.otlpMetricsPort != null) {