-
Notifications
You must be signed in to change notification settings - Fork 97
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
Appropriate handling for group by source nodes in ComputeMetricsBranchCombiner
#1212
Conversation
8339618
to
08bf20f
Compare
for_group_by_source_node
arg08bf20f
to
0ba000a
Compare
ComputeMetricsBranchCombiner
22f6a35
to
5357c8e
Compare
286da20
to
3d94c39
Compare
This test case demonstrates the bug, as you can see in CI failures for this commit. This error is only triggered in e2e tests where we ensure the ComputeMetricsBranchCombiner is used.
3d94c39
to
94248e7
Compare
@@ -293,6 +293,14 @@ def visit_compute_metrics_node(self, node: ComputeMetricsNode) -> ComputeMetrics | |||
) | |||
return ComputeMetricsBranchCombinerResult() | |||
|
|||
if self._current_left_node.for_group_by_source_node != current_right_node.for_group_by_source_node: |
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.
Can you move this check (and the above aggregated_to_elements
check) to a method in ComputeMetricsNode
similar to:
def combine(self, other: ComputeMetricsNode) -> CombinationResult
...
That should make it easier update that node in the future.
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.
Might be easier to do can_combine
instead for now.
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.
LGTM if the ComputeMetricsNode.combine
works.
Description
Jordan found a bug when using metric filters on ratio metrics in prod. The error indicates that a
ComputeMetricsNode
is being unexpectedly created withMetricSpecs
instead ofGroupByMetricSpecs
.I was able to reproduce the error in check query tests. You can see the test case & the CI failures in the first commit here. To fix that bug, I updated the
ComputeMetricsBranchCombiner
to use theComputeMetricsNode.for_group_by_source_node
param where missed. I also added a step to ensure we don't combine nodes if only one is a group by source node (since that needs to be aggregated separately before joining to the outer query).