What problem does it solve?
Investigating slow queries, memory issues, and per-team query costs on PostHog's production ClickHouse clusters requires access that is gated behind SSO-authenticated Metabase instances, making ad-hoc system.query_log analysis difficult to perform securely from the repo.
Core Features & Use Cases
- SSO-Gated Authentication: Uses
hogli metabase:login to capture browser SSO cookies per region (prod-us and prod-eu), cached securely so session values never leak into agent transcripts.
- Ad-Hoc Query Execution: Discovers current ClickHouse database IDs with
hogli metabase:databases and runs SQL via hogli metabase:query, with TSV or JSON output and file saving for large result sets.
- Ready-Made Query Patterns: Includes templates for top slow queries, per-team cost summaries, and query_id lookups, plus error-handling guidance for expired cookies and timeouts.
- Use Case: An engineer notices elevated ClickHouse memory usage, runs the per-team 7-day cost summary against the EU query tier, identifies the worst-offending team, and drills into individual slow queries by query_id.
Quick Start
Ask the agent to find the slowest ClickHouse queries in the last 24 hours on the US cluster, after running hogli metabase:login --region us yourself to authenticate.