geoprobe: add ClickHouse persistence to geoprobe-target#3434
Open
geoprobe: add ClickHouse persistence to geoprobe-target#3434
Conversation
70594de to
de03678
Compare
ben-dz
reviewed
Apr 2, 2026
| for { | ||
| select { | ||
| case <-ctx.Done(): | ||
| w.flush(context.Background()) |
Contributor
There was a problem hiding this comment.
If Clickhouse is unreachable, won't this hang indefinitely with the context.Background()? It should probably have some kind of timer, or just not flush the last 10s if we're closing the program?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves: #3405
Summary of Changes
geoprobe-target— whenCLICKHOUSE_ADDRis set, received LocationOffset measurements are buffered and batch-inserted into alocation_offsetstable with signature verification results, raw offset bytes, and structured reference arraysTestE2E_GeoprobeDiscoverywith a ClickHouse testcontainer that verifies offsets land in the table with valid signaturesRFC: RFC-16 Geolocation Verification
Diff Breakdown
Most new code is core logic (writer + migrations) and E2E verification.
Key files (click to expand)
controlplane/telemetry/internal/geoprobe/clickhouse.go— ClickhouseConfig (env var reader), connection factory, OffsetRow conversion, buffered ClickhouseWriter with 10s flush tickere2e/geoprobe_test.go— ClickHouse testcontainer helper, startGeoprobeTarget now accepts optional CH config, verifyClickhouseOffsets polls the table for valid rowscontrolplane/telemetry/internal/geoprobe/clickhouse_test.go— unit tests for OffsetRowFromLocationOffset (including TotalRttNs accumulation) and writer buffer behaviorcontrolplane/telemetry/internal/geoprobe/migrations.go— goose migration runner with embedded SQL and slog-based loggercontrolplane/telemetry/cmd/geoprobe-target/main.go— optional CH init from env, writer threaded through to handleOffsetcontrolplane/telemetry/db/clickhouse/migrations/20260401000001_location_offsets.sql— CREATE TABLE with MergeTree, 90-day TTL, structured reference arraysTesting Verification
OffsetRowFromLocationOffsetverify field mapping, TotalRttNs accumulation across references, and raw offset hex encodingClickhouseWriter.Recordconfirms buffer accumulation without a real ClickHouse connectionmake go-lintandmake go-buildpass clean