Repository navigation
feat(eap-items): Route indexed-column filters from options-automator config - #8515
Conversation
…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.
2c55ca9 to
a22c703
Compare
`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
MeredithAnya
left a comment
There was a problem hiding this comment.
@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
|
@MeredithAnya and I resolved it offline. I want to solve a more general problem and this PR would do that. |
…s' of github.com:getsentry/snuba into daniezzeddine/eap-797-improve-how-we-use-indexed-columns
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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.

Resolves EAP-797.
Replaces the hardcoded
indexed_namemapping andeap_items_indexed_name_start_timestampwith oneindexed_columnsoption, set per region in options-automator: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.