Skip to content

telemetry: add cloud_region_latency table and carry cloud identity on records - #4319

Draft
thijsvanemmerik wants to merge 1 commit into
tve/cloud-latency-08-live-probe-selectionfrom
tve/cloud-latency-09-record-identity-and-table
Draft

thijsvanemmerik wants to merge 1 commit into
tve/cloud-latency-08-live-probe-selectionfrom
tve/cloud-latency-09-record-identity-and-table

Conversation

@thijsvanemmerik

Copy link
Copy Markdown
Contributor

Part of measuring latency between AWS regions with the internet latency collector. Those samples
have nowhere to land and no way to say which cloud and which probe they came from.

This adds the ClickHouse table cloud_region_latency as a goose migration, and an optional Cloud
field on the exporter record holding source cloud, target cloud, probe ID, packets sent and packets
received.

The sort key is worth reading closely, because ClickHouse cannot reorder it once the table exists;
changing it later means a new table and a backfill. It is (event_ts, origin_cloud, origin_region, target_cloud, target_region, data_provider, probe_id). It leads with time because reads filter on
time, matching the two latency tables already in production. probe_id is in it so two probes
sampling the same region pair in the same second stay two rows instead of one being merged away by
the ReplacingMergeTree. A test inserts that pair, runs OPTIMIZE TABLE ... FINAL and asserts both
survive; another confirms a re-export of one probe's same sample still collapses to one row.

The record field is a pointer and is nil on every path that exists today, so Record.Validate()
ignores it and nothing behaves differently. Merging creates an empty table that nothing writes to
yet.

Test: go test ./controlplane/internet-latency-collector/internal/exporter/ -run Record and
go test ./telemetry/migrations/ -run TestCloudRegionLatency. The migration test starts a real
ClickHouse container, so it needs Docker.

… records

The exporter record gains an optional Cloud field naming the origin and target
cloud, their regions and the probe that produced the sample. It is nil-able, so
Record.Validate is unchanged and the rewards-bearing ledger exporter never reads
it; a consumer that needs it validates the field itself and treats nil as an
error rather than dereferencing it.

The ClickHouse table sorts by time first, matching the two production latency
tables, because most reads filter on time only. probe_id is in the sort key so a
sample stays attributable to its probe and ReplacingMergeTree does not merge it
away. ClickHouse cannot reorder a sort key afterwards.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant