-
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: formula queries in EndpointTraceItemTable (#6844)
This PR implements support for formulas in the TraceItemTable endpoint. It is relevant to this ticket https://github.com/orgs/getsentry/projects/284/views/1?pane=issue&itemId=85243940&issue=getsentry%7Ceap-planning%7C27 It enables queries such as `sum(my_attribute) / count(my_attribute)` which werent possible before ## Major changes * the column to expression conversion logic used to take place [here](https://github.com/getsentry/snuba/pull/6844/files#diff-e1e06d7f875a7c2870cc11bc4301dd6ab9fba73263c76260452c0b3176f66110L141-L187) I extracted this logic into 2 separate new functions: `_get_reliability_context_columns` and `_column_to_expression`. (i.e. the logic stayed the same but its not inside these functions) * I then extended `_column_to_expression` to support formulas https://github.com/getsentry/snuba/pull/6844/files#diff-e1e06d7f875a7c2870cc11bc4301dd6ab9fba73263c76260452c0b3176f66110R180-R191 * I also had to extend the existing result conversion and order by logic to support formulas https://github.com/getsentry/snuba/pull/6844/files#diff-e1e06d7f875a7c2870cc11bc4301dd6ab9fba73263c76260452c0b3176f66110R287-R288 ## Testing I wrote 3 new tests for this feature: * one that tests a simple formula on aggregates `sum(my_attribute) / count(my_attribute)` * one that is the same as above uses extrapolation, to ensure formulas work with extrapolation. * one that tests formulas on attributes without aggregation `my_attribute + my_other_attribute` ## design decisions * reliabilities dont work with formulas, if you do a formula on extrapolated aggregates you will not get any reliability information back. This decision was made because of the increased complexity it would add to support. If needed we can implement support for this in the future. * I realized while implementing this that formulas using constants are not supported such as `my_attribute * 10` if we need support for this it must be implemented as a follow up. and will require further modification of our protobuf grammar. * it only supports spans not uptime or logs
- Loading branch information
Showing
7 changed files
with
332 additions
and
50 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.