#!/usr/bin/env python3 """Quick backfill for April 1 gap (10:44-11:50 UTC)""" import struct import urllib.request import urllib.error import urllib.parse import json import ssl import snappy import base64 # Read credentials from environment (see .env) import os MIMIR_URL = "https://metrics.vultrlabs.com/prometheus" MIMIR_USER = os.environ.get("MIMIR_USERNAME", "REPLACE_WITH_MIMIR_USERNAME") MIMIR_PASS = os.environ.get("MIMIR_PASSWORD", "REPLACE_WITH_MIMIR_PASSWORD") M3DB_URL = "http://m3coordinator.m3db.svc.cluster.local:7201" START_TS = 1774175400 # 2026-03-22T10:30:00Z END_TS = 1774243800 # 2026-03-23T05:30:00Z STEP = "10s" METRICS = ["vllm:prompt_tokens_total", "vllm:generation_tokens_total", "DCGM_FI_DEV_GPU_UTIL"] def enc(v): b = v & 0x7f v >>= 7 r = b"" while v: r += bytes([0x80 | b]) b = v & 0x7f v >>= 7 return r + bytes([b]) def es(f, d): return enc((f<<3)|2) + enc(len(d)) + d def ed(f, v): return enc((f<<3)|1) + struct.pack(" 0: wr = b"" for s in series: labels = dict(s["metric"]) labels["cluster"] = "serverless-inference-cluster" pts = [(int(float(v[0])*1000), float(v[1])) for v in s["values"]] ts = build_ts(labels, pts) wr += enc((1<<3)|2) + enc(len(ts)) + ts if write_m3db(wr): print(f"{samples} samples written") total += samples else: print("no data") print(f"Done! Total: {total} samples")