feat(eap): Read TraceItemAttributeNames exclusively from co-occurring v2 - #8314
Open
phacops wants to merge 1 commit into
Open
feat(eap): Read TraceItemAttributeNames exclusively from co-occurring v2#8314phacops wants to merge 1 commit into
phacops wants to merge 1 commit into
Conversation
Always query eap_item_co_occurring_attrs_v2. Drop the rollout flag, date-window fallback to v1, and last_seen degrade path.
Comment on lines
241
to
247
|
|
||
| -- Default ordering (order_by unset or COLUMN_NAME): distinct keys by name | ||
| SELECT distinct(arrayJoin(arrayFilter(attr -> ((NOT has(['test_tag_1_0'], attr.2)) AND startsWith(attr.2, 'test_')), arrayMap(x -> ('TYPE_STRING', x), attributes_string)))) AS attr_key | ||
| FROM eap_item_co_occurring_attrs_1_local | ||
| FROM eap_item_co_occurring_attrs_2_local | ||
| WHERE (item_type = 1) AND (project_id IN [1]) AND (organization_id = 1) AND (date < toDateTime(toDate('2025-03-17', 'Universal'))) AND (date >= toDateTime(toDate('2025-03-10', 'Universal'))) | ||
|
|
||
| -- This is a faster way of looking up whether all attributes co-exist, it uses an array of hashes. This avoids string equality comparisons |
Contributor
There was a problem hiding this comment.
Bug: Queries for co-occurring attributes before 2026-07-29 will return incomplete data because the fallback to the v1 table was removed, and the v2 table was not backfilled.
Severity: CRITICAL
Suggested Fix
Reinstate the date-gated fallback logic. Queries with a start date before the co_occurring_attrs_v2_start_timestamp should be directed to the v1 table to ensure historical data remains accessible. Alternatively, perform a one-time backfill of the v2 table with data from the v1 table.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: snuba/web/rpc/v1/endpoint_trace_item_attribute_names.py#L241-L247
Potential issue: The code removes the fallback logic that queries an older `v1` table
for historical data. It now exclusively queries a `v2` table
(`eap_item_co_occurring_attrs_v2`) which was created on 2026-07-29 and was not
backfilled. As a result, any query for co-occurring attribute names with a date range
before this creation date will target a table that has no data for that period. This
will cause the endpoint to silently return empty or incomplete results for historical
queries, even though the data exists in the now-inaccessible `v1` table.
Did we get this right? 👍 / 👎 to inform future reviews.
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.
EndpointTraceItemAttributeNamesalways readseap_item_co_occurring_attrs_v2. Follow-up to #8239 / #7801.Drops:
use_co_occurring_attrs_v2andco_occurring_attrs_v2_start_timestampselection.py(flag + Monday date-window fallback to v1)attribute_names_order_by_degradedv1 storage and MV stay populated; they are no longer queried.
Risk: v2 was created 2026-07-29 with no backfill. Requests whose weekly
datebucket is before 2026-07-27 will miss keys that only exist on v1.Verified: 175 tests in
test_endpoint_trace_item_attribute_names.py,_v2.py, and the source contract suite.Legal Boilerplate
Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.