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

Use ranking query in custom dimensions archiver #17396

Merged
merged 13 commits into from Mar 29, 2021

Conversation

diosmosis
Copy link
Member

Description:

As title. There might be a random test failure since RankingQuery doesn't apply ordering (probably a good thing).

Review

  • Functional review done
  • Potential edge cases thought about (behavior of the code with strange input, with strange internal state or possible interactions with other Matomo subsystems)
  • Usability review done (is anything maybe unclear or think about anything that would cause people to reach out to support)
  • Security review done see checklist
  • Code review done
  • Tests were added if useful/possible
  • Reviewed for breaking changes
  • Developer changelog updated if needed
  • Documentation added if needed
  • Existing documentation updated if needed

@diosmosis diosmosis added the Needs Review PRs that need a code review label Mar 26, 2021
@diosmosis diosmosis added this to the 4.3.0 milestone Mar 26, 2021
Copy link
Member

@sgiehl sgiehl left a comment

Choose a reason for hiding this comment

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

There are also some tests failing that don't look random

core/API/DocumentationGenerator.php Outdated Show resolved Hide resolved
core/DataAccess/LogAggregator.php Show resolved Hide resolved
plugins/CustomDimensions/Archiver.php Outdated Show resolved Hide resolved
core/DataAccess/LogAggregator.php Outdated Show resolved Hide resolved
@sgiehl sgiehl removed the Needs Review PRs that need a code review label Mar 26, 2021
@@ -1075,6 +1087,17 @@ public function queryConversionsByDimension($dimensions = array(), $where = fals
$orderBy = false;
$query = $this->generateQuery($select, $from, $where, $groupBy, $orderBy);

if (!empty($rankingQuery)) {
$sumColumns = array_keys($availableMetrics);
$rankingQuery->addColumn($sumColumns, 'sum');
Copy link
Member

Choose a reason for hiding this comment

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

@diosmosis can we assume that it is always a sum? or is it maybe also sometimes min, max, etc?

Copy link
Member Author

Choose a reason for hiding this comment

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

missed this 👍

{
$configGeneral = Config::getInstance()->General;
$configLimit = $configGeneral['archiving_ranking_query_row_limit'];
$limit = $configLimit == 0 ? 0 : max(
Copy link
Member

Choose a reason for hiding this comment

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

I suppose this looks good. Was wondering if the 50K ranking query limit could cause issues since we technically allow 1000 root tables and 1000 entries per subtable by default. I'm assuming this will limit the number of results shown quite a bit but that's kind of also the point of this ranking query?

For the ranking query limit would maybe do something like

$this->rankingQueryLimit = max(configLimit, 10 * $this->maximumRowsInDataTableLevelZero);

just in case someone has a high datatable_archiving_maximum_rows_custom_dimensions set and so you can still get different results per subtable but I think also not really needed.

I'm not entirely sure what the report groups by though and how the subtables are created so could also just leave as is.

Copy link
Member Author

Choose a reason for hiding this comment

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

subtables are urls, so it makes sense 👍

@diosmosis diosmosis merged commit 2edd9db into 4.x-dev Mar 29, 2021
@diosmosis diosmosis deleted the custom-dim-ranking-query branch March 29, 2021 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants