-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
wip(eap): http response rate function #85662
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is ✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## master #85662 +/- ##
===========================================
+ Coverage 42.22% 87.89% +45.67%
===========================================
Files 9665 9695 +30
Lines 548129 549723 +1594
Branches 21345 21345
===========================================
+ Hits 231453 483190 +251737
+ Misses 316366 66223 -250143
Partials 310 310 |
if function in self.definitions.functions: | ||
function_definition = self.definitions.functions[function] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In a future refactor, we can rename self.definitions.functions
to self.definitions.aggregates
@wmak I addressed your comments! Lmk if that works for you! |
|
||
|
||
@dataclass | ||
class FormulaDefinition: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we have this inherit from FunctionDefinition
so we're not repeating everything?
@@ -324,7 +327,7 @@ def resolve_virtual_context_term( | |||
self, | |||
term: str, | |||
raw_value: str | list[str], | |||
resolved_column: ResolvedColumn, | |||
resolved_column: ResolvedColumn | ResolvedFormula | ResolvedFormula, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this intentional? VCCs should only apply to Resolved Columns
@@ -468,7 +471,7 @@ def resolve_aggregate_term( | |||
|
|||
def _resolve_search_value( | |||
self, | |||
column: ResolvedColumn, | |||
column: ResolvedColumn | ResolvedFormula, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another one, is this intentional? We don't resolve search values for formulas do we?
@@ -386,6 +402,65 @@ def count_processor(count_value: int | None) -> int: | |||
return count_value | |||
|
|||
|
|||
def http_response_rate(arg: str) -> Column.BinaryFormula: | |||
|
|||
if not arg.isdigit(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: why not just check that arg is in a list of the strings of 1-5, then you can cast safely without concern?
op=ComparisonFilter.OP_IN, | ||
value=AttributeValue( | ||
val_str_array=StrArray( | ||
values=response_codes, # |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
values=response_codes, # | |
values=response_codes, |
ArgumentDefinition( | ||
argument_types={ | ||
"string" | ||
}, # TODO - this should be an integer, but `resolve_attribute` returns a string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think instead of leaving this as a todo we need to add a way to define arguments that aren't just attributes, so that SearchResolver.resolve_aggregate
knows to cast a user input, which probably would clean up the definition of http_response_rate
for you too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall in the right direction, I'm mostly concerned that we're sorta hacking the argument resolution currently.
👍 thanks for the review, I don't mind spending some more time getting the args working properly in this PR |
Work for #81750
http_response_rate
function, which is used in insights