Prometheus time unittest
๐ท๏ธ
็พๅจใฎ unixtime ใ่ฟใใฆใใใ time() ใไฝฟใฃใใจใใฎ Prometheus Unittest ใฎๆธใๆนใงใ๏ผ
ใใใใใฎใฏ SSL ่จผๆๆธใๅใใใใชใจใใขใฉใผใใ็บ็ ดใใใใจใใๆใใจๆใใพใ๏ผ
ใใฎใขใฉใผใใฎใในใใใใใใจๆใฃใใจใ๏ผtime() ใใฉใ mock ใใใใฟใใใชใใจใ่ใใใใจๆใใพใ๏ผ
rules:
- alert: SSLCertExpiringSoon
expr: probe_ssl_earliest_cert_expiry - time() < 86400 * 3
for: 1m
็ญใใฏใ ใใใไธ่จใฎ issue ใซๆธใใฆใใใพใ๏ผeval_time ใ 0s ใฎๆ time() ใฏ 0 ใ๏ผไพใใฐ 1m ใฎๆใฏ 60 ใ่ฟใใใใซใชใฃใฆใใใใใงใ๏ผ
promtool unittests fail with rate() & time() ยท Issue #4817 ยท prometheus/prometheus
You can’t perform that action at this time. You signed in with another tab or window. You signed out in another tab orโฆ
github.com
ใจใใใใจใงใใใชๆใใซๆธใใใจๆใใพใ๏ผ
- interval: 15s
input_series:
- series: probe_ssl_earliest_cert_expiry
values: 0+0x100
alert_rule_test:
- alertname: SSLCertExpiringSoon
eval_time: 0s
exp_alerts: []
- alertname: SSLCertExpiringSoon
eval_time: 90s
exp_alerts:
- exp_labels:
severity: warning