#!/usr/bin/env python3 """ Massive backfill: March 12 - April 1, 2026 Writes ONLY to 'default' namespace (raw data) Overlapping chunks - no gaps! """ import struct import urllib.request import urllib.error import urllib.parse import json import ssl import snappy import base64 import time # 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" # March 12 to April 1 (full range) START_TS = 1773273600 # March 12 00:00 UTC END_TS = 1775052000 # April 1 14:00 UTC CHUNK_HOURS = 4 # 4-hour chunks OVERLAP_MINUTES = 30 # 30-min overlap between chunks 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("