feat(eap): Allow arrays to be queried from EAP#7551
Merged
phacops merged 19 commits intoDec 2, 2025
Conversation
Comment on lines
+488
to
492
| attributes_array = _process_arrays(arrays) | ||
| for key, value in attributes_array.items(): | ||
| add_attribute(k, v) | ||
|
|
||
| item = GetTraceResponse.Item( |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
Member
There was a problem hiding this comment.
This is a real bug, was this come across in tests?
Contributor
Author
There was a problem hiding this comment.
No, it was due to a late refactor before I commit (rename k/v to key/value) and didn't run the tests in-between.
Contributor
Author
|
Sentry needed to have some compatibility work done: getsentry/sentry#104063 |
volokluev
approved these changes
Dec 1, 2025
phacops
deleted the
pierre/eap-work-around-no-json-column-support-in-driver
branch
December 2, 2025 19:05
manessaraj
added a commit
that referenced
this pull request
Apr 27, 2026
…7898) Current implementation of arrays in TraceItemTable endpoint transforms arrays as array of strings, and then only allows `LIKE/NOT_LIKE` filter on them. With this change, arrays will preserve their original type, and client can filter EAP items by element of an array attribute. To preserve the type, array is converted to JSON string, (clickhouse-driver doesn't support Array(JSON) type, as discussed in this [PR](#7551)), and post processing of results recovers the original array by decoding JSON string. To filter, predicate maps arrays to corresponding type and use array exists with element filter. Example Clickhouse query is: ``` SELECT ( cast(lower(leftPad(hex(item_id), if( greater(length(hex(item_id)), 16), 32, 16), '0')), 'String' ) AS `sentry.item_id_TYPE_STRING` ), (toJSONString(attributes_array.`tags`::Array( JSON)) AS tags_TYPE_ARRAY ) FROM eap_items_1_local WHERE in( project_id, [1, 2, 3] ) AND equals(organization_id, 1) AND less( timestamp, toDateTime('2026-04-24 14:00:00') ) AND greaterOrEquals(timestamp, toDateTime('2026-04-24 08:00:00')) AND arrayExists(x -> equals(lower(x), lower('error')), (arrayMap(x -> coalesce( x.`String`::Nullable(String), toString(x.`Int`::Nullable(Int64)), toString(x.`Double`::Nullable(Float64)), x.`Bool`::Nullable(String)), attributes_array.`tags`::Array( JSON)) AS tags_TYPE_ARRAY__array_members ) ) AND lessOrEquals(sampling_factor, 1) AND greater(sampling_factor, 0) AND equals(item_type, 1) LIMIT 10001 OFFSET 0 ```
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.
This will allow us to return array values stored in
attributes_arraywhen fetching a trace. Support to return arrays with containing different types were added tosentry-protos(getsentry/sentry-protos#153).One caveat right now is
clickhouse-driverdoesn't support theJSONorVariantcolumn types. The workaround for this right now is to encode as JSON and send the value back to Snuba as a string.There is a PR opened which adds support but there's not a lot of activity. Perhaps we should fork
clickhouse-driverand add support for theJSONtype for a mid term solution, then upsrtream the result.