Files
voyager/telemetry/common.py
T
czerafa 080f10a1e0 Add telemetry framework
- Add shared telemetry module
- Add common telemetry helpers
- Ignore Python cache files
2026-07-21 11:29:25 -04:00

19 lines
432 B
Python

#!/usr/bin/env python3
from pathlib import Path
from datetime import datetime, timezone
import json
def timestamp():
return datetime.now(timezone.utc).isoformat()
def write_json(path, payload):
path = Path(path)
path.parent.mkdir(parents=True, exist_ok=True)
payload["generated_at"] = timestamp()
tmp = path.with_suffix(".tmp")
tmp.write_text(json.dumps(payload, indent=2) + "\n")
tmp.replace(path)