Repository navigation
feat(metrics): read the PostHog metrics3 schema - #5
Merged
Merged
Conversation
Point the posthog layout at metric_series3 and metric_attributes3, add a metric_names3 table for metric name discovery, and serve label names and values for exact metric and service matchers from the attribute rollup instead of a series scan. The local schema script creates the new tables and their materialized views next to the existing ones. Generated-By: PostHog Desktop Task-Id: 97479d3a-d4b3-4b04-bd98-ee9f723c6c31
frankh
marked this pull request as ready for review
September 15, 2026 13:12
Generated-By: PostHog Desktop Task-Id: 77a7e513-a8ea-4899-b570-8ba1bfad35f5
Read metric_attributes3 for label names and values when every matcher is an exact __name__ or service_name match, guarded by CH_ATTRIBUTE_TABLE_HAS_METRIC_NAME for the legacy table. Resource attributes now take precedence over metric attributes in the Prometheus label set, and the README documents that and the 256 character limit. Generated-By: PostHog Desktop Task-Id: 97479d3a-d4b3-4b04-bd98-ee9f723c6c31
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.
Why
Snuffle must read the metadata tables added in PostHog/posthog#100839, so metric name and label discovery no longer scans each series.
Changes
metric_series3,metric_attributes3, andmetric_names3. Add the tables and their materialized views to the local schema script.metric_names3. Label names and values readmetric_attributes3, also when every matcher is an exact__name__orservice_namematch. Other matchers still read the series table.CH_ATTRIBUTE_TABLE_HAS_METRIC_NAMEand accept an emptyCH_METRIC_NAMES_TABLE, so the previous tables stay readable before the backfill completes.How did you test this code?
make lintandmake testpass.make integration-testpasses with bothCH_SCHEMA_LAYOUT=posthogandCH_SCHEMA_LAYOUT=current. The e2e test covers exact metric and service filters, map label filters, attribute precedence, and reads from the previous tables.Created with PostHog Desktop