Skip to content

Conversation

@onewland
Copy link
Contributor

create schema, topic, and example for eap-items deletions

in support of https://linear.app/getsentry/issue/EAP-282/create-new-rpc-endpoint-for-deletion-from-eap-items

@onewland onewland requested review from a team as code owners September 19, 2025 20:38
@onewland onewland changed the title create LW delete eap-items schema and topic feat(eap): create LW delete eap-items schema and topic Sep 19, 2025
@onewland
Copy link
Contributor Author

@phacops asks on Slack:

can the consumers already running not connect to a different cluster and execute the delete?

I did consider this, and landed on the current approach. My reasoning was:

The only existing lightweight deletes are on the generic-events dataset. Currently, the consumer uses the storage in the CLI to decide which topic to watch, and it has no logic for filtering which messages it processes. There's a bit of logic in Snuba around mapping storages to Kafka topics:

https://github.com/getsentry/snuba/blob/f4dc3eba842c7223927309cb48c35e4975b0392e/snuba/web/bulk_delete_query.py#L103-L123

https://github.com/getsentry/snuba/blob/config%2Fallow-items-delete-by-trace-id/snuba/cli/lw_deletions_consumer.py/#L122

I'm assuming that over the medium term (after migrating issue occurrences) we can expect that all lightweight deletions will happen on eap_items, and that we can remove most of this mapping code, and at that time it will be preferable to land all traffic on an eap_items named topic. My thought was that keeping code logic the same means less uncertainty about bad behavior.

Two alternatives, which could make sense, are:

  • bringing up a second consumer and changing the consumer logic a bit to filter out messages not related to the storage that brought it up
  • changing the consumer logic to allow for deletes from any storage or from multiple storages

For either of those we could keep the topic name as-is, though as I said it seems to me like we're assuming that the only pre-items use case is going to go away in not that much time.

do we have to create a new topic or a new schema?

If we want to just reuse the original schema and make it more flexible, I'm fine with making that change. The schema isn't that important for us (since it's all internal to Snuba)

@onewland onewland merged commit 8b14b37 into main Sep 22, 2025
18 checks passed
@onewland onewland deleted the create-lw-delete-eap-items-topic branch September 22, 2025 20:57
onewland added a commit to getsentry/snuba that referenced this pull request Sep 24, 2025
Provide mechanism for lightweight deletes API to handle eap_items.


https://linear.app/getsentry/issue/EAP-283/enable-eap-items-storage-to-delete-by-trace-id

Depends on getsentry/sentry-kafka-schemas#438

Tested a delete locally by:
- setting is_enabled on the storage deletion_settings to 1 
- running `curl -H "Content-Type: application/json" -X DELETE
http://localhost:1218/eap_items -d "@test-delete.json"`

test-delete.json contents:
```
{
    "query": {
        "columns": {
            "project_id": [1],
            "trace_id": ["85cc9542-ef90-4282-917e-5659721fb940"]
        }
    }
}
```

Before and after delete:
```
66bbc2e1b854 :) select trace_id, count() from eap_items_1_local where trace_id='85cc9542-ef90-4282-917e-5659721fb940' group by trace_id

SELECT
    trace_id,
    count()
FROM eap_items_1_local
WHERE trace_id = '85cc9542-ef90-4282-917e-5659721fb940'
GROUP BY trace_id

Query id: f68fc09c-57df-4a53-99b8-e5653800c78a

   ┌─trace_id─────────────────────────────┬─count()─┐
1. │ 85cc9542-ef90-4282-917e-5659721fb940 │       1 │
   └──────────────────────────────────────┴─────────┘

1 row in set. Elapsed: 0.007 sec.

66bbc2e1b854 :) select trace_id, count() from eap_items_1_local where trace_id='85cc9542-ef90-4282-917e-5659721fb940' group by trace_id

SELECT
    trace_id,
    count()
FROM eap_items_1_local
WHERE trace_id = '85cc9542-ef90-4282-917e-5659721fb940'
GROUP BY trace_id

Query id: dec2a45e-1e72-4a3e-a7da-63552141fe37

Ok.

0 rows in set. Elapsed: 0.008 sec.
```
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