Skip to content

fix(mbi): fix ONLY_FULL_GROUP_BY issues in Gorgone ETL Perl modules#3336

Open
vuntz wants to merge 1 commit intodevelopfrom
MON-198038-mbi-fix-group-by-gorgone
Open

fix(mbi): fix ONLY_FULL_GROUP_BY issues in Gorgone ETL Perl modules#3336
vuntz wants to merge 1 commit intodevelopfrom
MON-198038-mbi-fix-group-by-gorgone

Conversation

@vuntz
Copy link
Copy Markdown
Member

@vuntz vuntz commented Apr 20, 2026

Description

Fixes: MON-198038

The Gorgone ETL Perl modules have the same ONLY_FULL_GROUP_BY issues as the ones fixed in
centreon-modules#7716 for the centreon-modules ETL modules.

  • BIMetric.pm: add missing s.service_id to GROUP BY in insertMetricsIntoTable
  • MetricDailyValue.pm: wrap first_value, last_value, total in MAX() aggregates instead of leaving them as bare non-aggregated columns
  • Metrics.pm: wrap d.value, d2.value in MAX() instead of adding them to GROUP BY (which changed query semantics); simplify GROUP BY back to just db.id_metric

Type of change

  • Patch fixing an issue (non-breaking change)
  • New functionality (non-breaking change)
  • Breaking change (patch or feature) that might cause side effects breaking part of the Software
  • Updating documentation (missing information, typo...)

Target serie

  • 23.10.x
  • 24.04.x
  • 24.10.x
  • 25.10.x
  • master

How this pull request can be tested ?

Run MBI ETL with MySQL ONLY_FULL_GROUP_BY enabled. Verify that:

  1. Metric insertion (insertMetricsIntoTable) succeeds without SQL errors
  2. Capacity reports (getMetricCapacityValuesOnPeriod) return correct first/last values per metric
  3. First/last value computation (getFirstAndLastValues) returns one row per metric

Checklist

  • I have followed the coding style guidelines provided by Centreon
  • I have commented my code, especially new classes, functions or any legacy code modified. (docblock)
  • I have commented my code, especially hard-to-understand areas of the PR.
  • I have made corresponding changes to the documentation.
  • I have rebased my development branch on the base branch (master, maintenance).

Summary by Aikido

Security Issues: 0 Quality Issues: 0 Resolved Issues: 0

🐛 Bugfixes

  • Fixed GROUP BY by adding s.service_id to query grouping.
  • Wrapped first_value, last_value, and total columns with MAX().
  • Wrapped d.value and d2.value in MAX() and simplified GROUP BY.

More info

MON-198038

The Gorgone ETL Perl modules have the same ONLY_FULL_GROUP_BY issues
as the ones fixed in MON-196670 for the centreon-modules ETL modules.

- BIMetric.pm: add missing s.service_id to GROUP BY
- MetricDailyValue.pm: wrap first_value, last_value, total in MAX()
  instead of leaving them as bare non-aggregated columns
- Metrics.pm: wrap d.value, d2.value in MAX() instead of adding them
  to GROUP BY (which changed query semantics)
@vuntz vuntz requested a review from a team as a code owner April 20, 2026 08:07
@vuntz vuntz requested a review from lucie-tirand April 20, 2026 08:07
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 20, 2026

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one) (1)
  • coderabbit

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 1033843c-33df-4600-aa86-860d8d1b5f6e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch MON-198038-mbi-fix-group-by-gorgone

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant