monitoring: expose jetson scrape line length
This commit is contained in:
parent
a7f3d49fea
commit
dfb295e5f0
@ -17,7 +17,7 @@ spec:
|
||||
annotations:
|
||||
prometheus.io/scrape: "true"
|
||||
prometheus.io/port: "9100"
|
||||
monitoring.bstein.dev/restart-rev: "5"
|
||||
monitoring.bstein.dev/restart-rev: "6"
|
||||
spec:
|
||||
serviceAccountName: default
|
||||
hostPID: true
|
||||
|
||||
@ -14,6 +14,7 @@ BASE_METRICS = {
|
||||
"ram_used_mb": 0.0,
|
||||
"ram_total_mb": 0.0,
|
||||
"power_5v_in_mw": 0.0,
|
||||
"log_line_len": 0.0,
|
||||
"last_scrape_ts": 0.0,
|
||||
}
|
||||
|
||||
@ -33,7 +34,7 @@ def parse_line(line: str) -> dict:
|
||||
if m:
|
||||
updates["ram_used_mb"] = float(m.group(1))
|
||||
updates["ram_total_mb"] = float(m.group(2))
|
||||
m = re.search(r"(?:POM_5V_IN|VDD_IN)\\s+(\\d+)/(\\d+)", line)
|
||||
m = re.search(r"(?:POM_5V_IN|VDD_IN)\\s+(\\d+)(?:mW)?/(\\d+)(?:mW)?", line)
|
||||
if m:
|
||||
updates["power_5v_in_mw"] = float(m.group(1))
|
||||
return updates
|
||||
@ -66,6 +67,7 @@ class Handler(http.server.BaseHTTPRequestHandler):
|
||||
line = read_latest_line()
|
||||
if line:
|
||||
metrics.update(parse_line(line))
|
||||
metrics["log_line_len"] = float(len(line))
|
||||
metrics["last_scrape_ts"] = time()
|
||||
out = []
|
||||
label = f'{{node="{NODE_NAME}"}}'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user