Mercurial > code > home > repos > victoriametrics
comparison next/tasks.py @ 62:8134cd480817
make next/ a complete standalone setup dir- no deps on ./
author | drewp@bigasterisk.com |
---|---|
date | Thu, 02 May 2024 20:33:29 -0700 |
parents | |
children | def1aa2bfa3f |
comparison
equal
deleted
inserted
replaced
61:fb0519859645 | 62:8134cd480817 |
---|---|
1 from pathlib import Path | |
2 | |
3 import yaml | |
4 from invoke import task | |
5 from kubernetes import config | |
6 | |
7 import alert_rules | |
8 from k8s_ops import firstPodName, refreshPodCmaps, replaceCmap | |
9 | |
10 config.load_kube_config() | |
11 | |
12 | |
13 def scrapeConfig(fn): | |
14 return yaml.load(open(fn), yaml.FullLoader) | |
15 | |
16 | |
17 @task | |
18 def push_config_2024(ctx): | |
19 # plan: | |
20 # every discovered service may: | |
21 # - be described here as a forever retention - ignore the discovery | |
22 # - be blocked here as a no-metrics service - ignore the discovery | |
23 # - be scraped as 'recent', with possible overrides of port/path | |
24 # all per-node metrics shall be 'recent' (oops, not smartctl!) | |
25 map: dict[str, object] = { | |
26 'rules': alert_rules.allRules(ctx), | |
27 } | |
28 top = Path('build/scrape_config') | |
29 for p in top.glob('**/*.yaml'): | |
30 map[str(p.relative_to(top))] = scrapeConfig(p) | |
31 replaceCmap("next-victoriametrics-config", map) | |
32 refreshPodCmaps(firstPodName("app=next-victoriametrics-forever-vmagent")) | |
33 refreshPodCmaps(firstPodName("app=next-victoriametrics-recent-vmagent")) |