mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 12:29:19 -08:00
feat(monitoring): prometheus ingest labels
This commit is contained in:
parent
bb371d19d3
commit
a20ed52cfc
2 changed files with 18 additions and 2 deletions
|
|
@ -7,10 +7,13 @@ let
|
|||
};
|
||||
};
|
||||
serviceModule = {
|
||||
system,
|
||||
config,
|
||||
gensokyo-zone,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (gensokyo-zone.lib) mapOptionDefaults;
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.modules) mkOptionDefault;
|
||||
inherit (lib.attrsets) attrNames filterAttrs;
|
||||
|
|
@ -24,7 +27,6 @@ let
|
|||
};
|
||||
labels = mkOption {
|
||||
type = attrsOf str;
|
||||
default = {};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
@ -35,7 +37,15 @@ let
|
|||
};
|
||||
};
|
||||
config.prometheus = {
|
||||
exporter.ports = mkOptionDefault (attrNames exporterPorts);
|
||||
exporter = {
|
||||
ports = mkOptionDefault (attrNames exporterPorts);
|
||||
labels = mapOptionDefaults {
|
||||
gensokyo_exports_service = config.name;
|
||||
gensokyo_exports_id = config.id;
|
||||
gensokyo_system = system.name;
|
||||
gensokyo_host = system.access.fqdn;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
|
|
|
|||
|
|
@ -58,8 +58,11 @@
|
|||
};
|
||||
};
|
||||
serviceModule = {
|
||||
system,
|
||||
config,
|
||||
name,
|
||||
machine,
|
||||
gensokyo-zone,
|
||||
...
|
||||
}: {
|
||||
options = with lib.types; {
|
||||
|
|
@ -76,6 +79,7 @@
|
|||
type = attrsOf (submoduleWith {
|
||||
modules = [portModule];
|
||||
specialArgs = {
|
||||
inherit gensokyo-zone machine system;
|
||||
service = config;
|
||||
};
|
||||
});
|
||||
|
|
@ -155,7 +159,9 @@ in {
|
|||
type = attrsOf (submoduleWith {
|
||||
modules = [serviceModule];
|
||||
specialArgs = {
|
||||
inherit gensokyo-zone;
|
||||
machine = name;
|
||||
system = config;
|
||||
systemConfig = config;
|
||||
};
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue