Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(eap-spans): implement time_spent_percentage #88117

Conversation

DominikB2014
Copy link
Contributor

@DominikB2014 DominikB2014 requested a review from a team as a code owner March 27, 2025 17:27
@DominikB2014 DominikB2014 requested review from Copilot and removed request for a team March 27, 2025 17:27
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Mar 27, 2025
@DominikB2014 DominikB2014 requested review from a team and removed request for Copilot March 27, 2025 17:28
Copy link

codecov bot commented Mar 27, 2025

Codecov Report

Attention: Patch coverage is 94.73684% with 1 line in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/sentry/search/eap/spans/formulas.py 88.88% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           master   #88117       +/-   ##
===========================================
+ Coverage   42.15%   87.72%   +45.56%     
===========================================
  Files        9962     9994       +32     
  Lines      564080   565788     +1708     
  Branches    22269    22269               
===========================================
+ Hits       237807   496353   +258546     
+ Misses     325851    69013   -256838     
  Partials      422      422               

@DominikB2014 DominikB2014 requested a review from wmak March 31, 2025 17:06
@@ -235,6 +235,8 @@ class FunctionDefinition:
extrapolation: bool = True
# Processor is the function run in the post process step to transform a row into the final result
processor: Callable[[Any], Any] | None = None
# returns true if the function should be enabled for the given request else returns false with a reason why it is not enabled
check_if_enabled: Callable[[SnubaParams], tuple[bool, str]] | None = None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we follow the pattern from QueryBuilders?

  1. Add private here
  2. In the SearchResolverConfig add a functions_acl
  3. Table queries get SearchResolverConfig(functions_acl=["time_spent_percentage"])

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that suggestion, makes more sense to gate this at the time of the resolver instantiation versus in the resolver as we know if it will be a timeseries request by that point

Copy link
Member

@wmak wmak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After thinking about it, lets move from check_if_enabled to a function_acl in a follow up, the rest of this seems reasonable to me

@DominikB2014 DominikB2014 merged commit fea615e into master Mar 31, 2025
48 checks passed
@DominikB2014 DominikB2014 deleted the dominikbuszowiecki/dain-89-implement-time_spent_percentage-function branch March 31, 2025 17:58
DominikB2014 added a commit that referenced this pull request Apr 1, 2025
Add `functions_acl` and replace `FunctionDefinition.check_if_enabled` as
discussed in #88117
andrewshie-sentry pushed a commit that referenced this pull request Apr 8, 2025
Add `functions_acl` and replace `FunctionDefinition.check_if_enabled` as
discussed in #88117
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants