mirror of
https://github.com/chatmail/relay.git
synced 2026-05-22 13:58:07 +00:00
Add nonci_accounts metric
Calculating this with PromQL is not easy due to interpolation. Also add HELP and TYPE metadata for each metric.
This commit is contained in:
@@ -40,6 +40,9 @@
|
|||||||
- DKIM-sign Content-Type and oversign all signed headers
|
- DKIM-sign Content-Type and oversign all signed headers
|
||||||
([#296](https://github.com/deltachat/chatmail/pull/296))
|
([#296](https://github.com/deltachat/chatmail/pull/296))
|
||||||
|
|
||||||
|
- Add nonci_accounts metric
|
||||||
|
([#347](https://github.com/deltachat/chatmail/pull/347))
|
||||||
|
|
||||||
## 1.3.0 - 2024-06-06
|
## 1.3.0 - 2024-06-06
|
||||||
|
|
||||||
- don't check necessary DNS records on cmdeploy init anymore
|
- don't check necessary DNS records on cmdeploy init anymore
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import sys
|
import sys
|
||||||
import time
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
@@ -16,9 +15,15 @@ def main(vmail_dir=None):
|
|||||||
if path.name[:3] in ("ci-", "ac_"):
|
if path.name[:3] in ("ci-", "ac_"):
|
||||||
ci_accounts += 1
|
ci_accounts += 1
|
||||||
|
|
||||||
timestamp = int(time.time() * 1000)
|
print("# HELP total number of accounts")
|
||||||
print(f"accounts {accounts} {timestamp}")
|
print("# TYPE accounts gauge")
|
||||||
print(f"ci_accounts {ci_accounts} {timestamp}")
|
print(f"accounts {accounts}")
|
||||||
|
print("# HELP number of CI accounts")
|
||||||
|
print("# TYPE ci_accounts gauge")
|
||||||
|
print(f"ci_accounts {ci_accounts}")
|
||||||
|
print("# HELP number of non-CI accounts")
|
||||||
|
print("# TYPE nonci_accounts gauge")
|
||||||
|
print(f"nonci_accounts {accounts - ci_accounts}")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
@@ -8,9 +8,10 @@ def test_main(tmp_path, capsys):
|
|||||||
out, _ = capsys.readouterr()
|
out, _ = capsys.readouterr()
|
||||||
d = {}
|
d = {}
|
||||||
for line in out.split("\n"):
|
for line in out.split("\n"):
|
||||||
if line.strip():
|
if line.strip() and not line.startswith("#"):
|
||||||
name, num, _ = line.split()
|
name, num = line.split()
|
||||||
d[name] = int(num)
|
d[name] = int(num)
|
||||||
|
|
||||||
assert d["accounts"] == 4
|
assert d["accounts"] == 4
|
||||||
assert d["ci_accounts"] == 3
|
assert d["ci_accounts"] == 3
|
||||||
|
assert d["nonci_accounts"] == 1
|
||||||
|
|||||||
Reference in New Issue
Block a user