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

Fix aggregation of additional action metrics #22348

Open
wants to merge 4 commits into
base: 5.x-dev
Choose a base branch
from
Open

Conversation

sgiehl
Copy link
Member

@sgiehl sgiehl commented Jun 27, 2024

Description:

Some plugins like PagePerformance or Bandwidth are adding additional metrics to the action reports. Some of those metrics need to be aggregated using min, max or avg aggregation.

As those column aggregation where not correctly set for the datatables, they were by default aggregated by summing the values up. This resulted in incorrect values.

fixes #22350

Review

@sgiehl sgiehl added this to the 5.2.0 milestone Jun 28, 2024
@sgiehl sgiehl added Bug For errors / faults / flaws / inconsistencies etc. Needs Review PRs that need a code review c: Data Integrity & Accuracy labels Jun 28, 2024
@sgiehl sgiehl requested a review from a team June 28, 2024 08:31
@sgiehl sgiehl marked this pull request as ready for review June 28, 2024 08:31
$newValue = $thisColumnValue;
} else {
$newValue = max($thisColumnValue, $columnToSumValue);
}
Copy link
Member Author

Choose a reason for hiding this comment

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

This was added to handle min and max values the same. Without that all max values would always be 0, even if there was not a single value tracked.

Copy link
Contributor

@rr-it rr-it Jun 30, 2024

Choose a reason for hiding this comment

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

Is the actual logic behind the code as follows?

            case 'max':
                if (!is_numeric($thisColumnValue) && !is_numeric($columnToSumValue)) {
                    $newValue = null;
                } else {
                    $newValue = max(
                        (is_numeric($thisColumnValue) ? +($thisColumnValue) : -INF),
                        (is_numeric($columnToSumValue) ? +($columnToSumValue) : -INF)
                    );
                }

Copy link
Contributor

@rr-it rr-it left a comment

Choose a reason for hiding this comment

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

Please also check implementation of min.

$newValue = $thisColumnValue;
} else {
$newValue = max($thisColumnValue, $columnToSumValue);
}
break;
case 'min':
Copy link
Contributor

@rr-it rr-it Jun 30, 2024

Choose a reason for hiding this comment

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

The implementation of min looks like it is not providing the expected result for:

  • $thisColumnValue = 0
  • $columnToSumValue = null

Current result: $newValue = null

Expected result: $newValue = 0


This might work as expected:

            case 'min':
                if (!is_numeric($thisColumnValue) && !is_numeric($columnToSumValue)) {
                    $newValue = null;
                } else {
                    $newValue = min(
                        (is_numeric($thisColumnValue) ? +($thisColumnValue) : INF),
                        (is_numeric($columnToSumValue) ? +($columnToSumValue) : INF)
                    );
                }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc. c: Data Integrity & Accuracy Needs Review PRs that need a code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Calculation of min/max performance metrics incorrect in aggregated reports
2 participants