Mercurial > code > home > repos > victoriametrics
comparison tasks.py @ 67:adde35eb4773
collapse ./next to ./
author | drewp@bigasterisk.com |
---|---|
date | Fri, 03 May 2024 11:21:08 -0700 |
parents | next/tasks.py@429bfd62e6ba |
children | c5e98d891638 |
comparison
equal
deleted
inserted
replaced
66:429bfd62e6ba | 67:adde35eb4773 |
---|---|
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(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")) |