Skip to content

feat(eap-items): Route indexed-column filters from options-automator config - #8515

Merged
dezzeddi merged 17 commits into
masterfrom
daniezzeddine/eap-797-improve-how-we-use-indexed-columns
Oct 8, 2026
Merged

dezzeddi merged 17 commits into
masterfrom
daniezzeddine/eap-797-improve-how-we-use-indexed-columns

Conversation

@dezzeddi

@dezzeddi dezzeddi commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

Resolves EAP-797.

Replaces the hardcoded indexed_name mapping and eap_items_indexed_name_start_timestamp with one indexed_columns option, set per region in options-automator:

indexed_columns:
  sentry.op:
    span:
      indexed_column_name: indexed_name
      indexed_start_date: "2026-07-23"

Equality/IN filters read the indexed column only when the request starts on or after indexed_start_date (00:00 UTC). Everything else, including an empty or malformed config, reads the attribute map as before.

…config

Replace the hardcoded sentry.op/sentry.metric_name -> indexed_name mapping
and the eap_items_indexed_name_start_timestamp cutoff with an indexed_columns
option, set per region in options-automator:

  {unindexed_column: {indexed_column_name, indexed_start_timestamp}}

Indexed columns can't be backfilled, so a filter only reads the indexed
column when the request starts at or after its indexed_start_timestamp, and
reads the attribute map otherwise. trace_item_filters_to_expression now takes
the request start timestamp instead of a precomputed flag.

Refs EAP-797
@linear-code

linear-code Bot commented Oct 5, 2026

Copy link
Copy Markdown

EAP-797

…m type

indexed_name holds sentry.op for spans and sentry.metric_name for metrics, so
an indexed_columns entry now carries an item_type and only applies to filters
for that item type. Other item types keep reading the attribute map, as before
the config moved to options-automator.

Also fix the time series indexed_name test config, which still used the old
shape and so never exercised the rewrite.
@dezzeddi
dezzeddi force-pushed the daniezzeddine/eap-797-improve-how-we-use-indexed-columns branch from 2c55ca9 to a22c703 Compare October 5, 2026 22:31
dezzeddi added a commit that referenced this pull request Oct 6, 2026
`get_trace_item_type_name` turns `TRACE_ITEM_TYPE_SPAN` into `span`. It
lived in `snuba/datasets/deletion_settings.py`, and `query_info.py` had
its own copy of the same prefix-stripping logic. This makes it one
shared proto helper:

Sooo I just needed similar function for a feature im
building(#8515, which will reuse the helper for
indexed-column item types) and i found 2 separate functions in code that
do the same thing. This is small refactor to move it to common protos
module so all conversions happen in same way from now on


Changes made:
- **Moved** `get_trace_item_type_name` to `snuba/protos/common.py`
without changes, and updated the import in `bulk_delete_query.py`. Its
tests moved from `tests/datasets/test_deletion_settings.py` to
`tests/protos/test_protos_common.py`.
- **`query_info.py`:** removed `_trace_item_type_name`.
`extract_query_info` now sets the `trace_item_type` tag with
`get_trace_item_type_name`, or `"none"` when the request has no `meta`.
Tag values for valid item types don't change.

---------

Co-authored-by: Claude <noreply@anthropic.com>
…config

Replace the hardcoded sentry.op/sentry.metric_name -> indexed_name mapping
and the eap_items_indexed_name_start_timestamp cutoff with an indexed_columns
option, set per region in options-automator:

  {unindexed_column: {indexed_column_name, indexed_start_timestamp}}

Indexed columns can't be backfilled, so a filter only reads the indexed
column when the request starts at or after its indexed_start_timestamp, and
reads the attribute map otherwise. trace_item_filters_to_expression now takes
the request start timestamp instead of a precomputed flag.

Refs EAP-797
…m type

indexed_name holds sentry.op for spans and sentry.metric_name for metrics, so
an indexed_columns entry now carries an item_type and only applies to filters
for that item type. Other item types keep reading the attribute map, as before
the config moved to options-automator.

Also fix the time series indexed_name test config, which still used the old
shape and so never exercised the rewrite.
…s' of github.com:getsentry/snuba into daniezzeddine/eap-797-improve-how-we-use-indexed-columns
…e/eap-797-improve-how-we-use-indexed-columns
@dezzeddi
dezzeddi marked this pull request as ready for review October 6, 2026 23:21
@dezzeddi
dezzeddi requested review from a team as code owners October 6, 2026 23:21

@pbhandari pbhandari left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM; left a few comments but they are non-blocking.

Just make sure the options-automator PR exists before you hit merge on this.

Comment thread snuba/web/rpc/common/common.py Outdated
Comment thread snuba/web/rpc/common/common.py

@MeredithAnya MeredithAnya left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dezzeddi I think this might be over complicating it a bit. There is always only ONE indexed_name for each item_type - we should be keeping _INDEXED_NAME_KEY_BY_ITEM_TYPE dict as - the option only needs to to have an item_type mapped to a specific timestamp.

And honestly we only really need an option to override it for spans - so you could probably get away with eap_items_indexed_name_start_timestamp_spans but if that is too hacky I would just stick with simplfying the option - these options should be temporary since after x amount of time we will be able to remove these

@pbhandari

Copy link
Copy Markdown
Contributor

@MeredithAnya and I resolved it offline. I want to solve a more general problem and this PR would do that.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit eda0bf6. Configure here.

Comment thread snuba/web/rpc/common/common.py Outdated
Comment thread snuba/web/rpc/common/common.py Outdated
Comment thread snuba/web/rpc/common/common.py Outdated
@dezzeddi
dezzeddi merged commit 76694f6 into master Oct 8, 2026
72 checks passed
@dezzeddi
dezzeddi deleted the daniezzeddine/eap-797-improve-how-we-use-indexed-columns branch October 8, 2026 19:07
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.

3 participants