ci runner: export its built-in metrics through the container's forwarder
This commit is contained in:
parent
528c4476cb
commit
0bc350a8a1
1 changed files with 78 additions and 0 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue