getsentry / getsentry/sentry

Make `error.mechanism.code` queryable

Open
#45,760 2 comments 3 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
44.8k
Forks
4.9k
Avg merge
1d 5h
Merged PRs (30d)
624

Description

### Problem Statement

We'd like to query errors that have an `error.mechanism.code`.

This is part of the `data` field in the [event protocol](https://develop.sentry.dev/sdk/event-payloads/types/#mechanism).
The full structure of the error in the JSON is `event.exception.values[n].mechanism.data["code"]`

The Flutter and PHP SDKs set it already.

### Solution Brainstorm

That requires indexing this field in Snuba since [only a few fields of the mechanism are indexed](https://github.com/getsentry/snuba/blob/92def7f336905b5b172fbf052c9f8bc1f5e83522/snuba/datasets/configuration/events/entities/events.yaml#L109-L117) such as `type` and `handled` but not the `data`.

After doing the Snuba migration and indexation, we'd need to change this on Sentry itself, the backend, and the frontend part.

Backend:
https://github.com/getsentry/sentry/blob/master/src/sentry/rules/conditions/event_attribute.py
https://github.com/getsentry/sentry/blob/master/src/sentry/snuba/events.py (the indexed column goes here)

Frontend:
https://github.com/getsentry/sentry/blob/master/static/app/utils/fields/index.ts

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.