fix(trino): observe shared pools through their live instances - #1222
Conversation
A shared-pool cell has no fixed coordinator, but its console observer and usage collector were built from the cell's CoordinatorURL, which is empty. Every pooled org read as unavailable with no advertised connection, and Trino usage on the pool was never collected (#1216). The pool observer lists the pool's instances from the config store on each call and asks every instance that can hold queries on its own Service, declaring the Gateway's forwarded HTTPS hop and mapping the forwarded nextUri back onto the plain Service. Queries and nodes are unioned across members; one unreachable member does not hide the others. Closes #1216. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Nic9bR3LPTRLk56ntJ4M5Z
Test Impact PlanDeterministic summary of how this PR changes tests, CI runners, and coverage-risk signals. Summary
Signals
Coverage risk: neutral or increased No coverage-reduction warnings detected. |
bill-ph
left a comment
There was a problem hiding this comment.
Approval: no P0 blocker found.
Non-blocking metering caveat: trinoPoolObserver.Queries returns partial results with a nil error whenever at least one member responds. The usage collector treats nil error as a complete snapshot, while Trino retains terminal query records only in coordinator memory. If a member remains unreachable beyond that retention window, its completed-query usage can be silently missed. Please consider surfacing partial collection (for example via a metric or warning) so this limitation is observable.
The pool-member client confines continuation requests to the same service, and the fan-out, wiring, tests, and e2e assertion are directly scoped to shared-pool observation. No overengineering or scope creep found. CI still had unit tests, build, and Go analysis pending at review time.
— Robo Bill
Problem
A shared-pool Trino cell has no fixed coordinator. Its console observer and usage collector were still built from the cell's
CoordinatorURL, which is empty for a pool (#1216). Three effects:available: falsewithconnection: null, so the tenant host is never advertised.unsupported protocol scheme ""every 10 seconds, and Trino usage on the pool is never metered.This blocks moving orgs onto the prod pool, which is the next step for PostHog's own org.
Change
trino_pool_observer.go: aTrinoCoordinatorClientfor pools.admin.NewTrinoPoolMemberClient: the observer client for one pool member.X-Forwarded-Proto: https,X-Forwarded-Port: 443), as the operator's probes do.nextUri(https://<svc>:443/...) back onto the plain Service. Continuations to another host or a non-statement path are refused.Tests
trino_shared_pool_activeharness assertion gains an[observer]stage. The org must readavailable: trueand advertise a connection host.go test -tags kubernetes ./controlplane/ ./controlplane/admin/andjust test-trino-adminpass locally.golangci-lintisn't installed locally, so I'm relying on CI for it.Docs:
docs/trino-cells.mdandCLAUDE.md(Trino cell views).Closes #1216.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Nic9bR3LPTRLk56ntJ4M5Z