Skip to content

Conversation

Donnerbart
Copy link
Contributor

Partially fixes #2884
Alternative to #2912

See #2912 (comment)

@Copilot Copilot AI review requested due to automatic review settings August 27, 2025 16:15
@openshift-ci openshift-ci bot requested review from csviri and xstefank August 27, 2025 16:15
Copilot

This comment was marked as outdated.

@Donnerbart Donnerbart force-pushed the improvement/2884-add-aggregate-metrics branch from f36afa7 to 2528836 Compare August 27, 2025 16:23
@Donnerbart Donnerbart requested a review from Copilot August 27, 2025 16:24
Copilot

This comment was marked as outdated.

@Donnerbart Donnerbart force-pushed the improvement/2884-add-aggregate-metrics branch from 2528836 to e80267d Compare August 27, 2025 16:27
@Donnerbart Donnerbart requested a review from Copilot August 27, 2025 16:27
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces an AggregatedMetrics class that implements the composite pattern to aggregate multiple Metrics implementations, allowing simultaneous collection of metrics data by different monitoring systems.

Key changes:

  • New AggregatedMetrics class that delegates calls to multiple metrics instances
  • Special handling for timeControllerExecution() which only delegates to the first metrics instance
  • Comprehensive test suite with 100% coverage of the new functionality

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
AggregatedMetrics.java Core implementation of the composite metrics aggregator with delegation logic
AggregatedMetricsTest.java Complete test suite covering constructor validation, method delegation, and special cases
pom.xml Added mockito-core test dependency for unit testing

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@Donnerbart
Copy link
Contributor Author

The new class should probably go into the same package as the Metrics interface. It has nothing to do with the concrete MicroMeter implementation. Will update the PR tomorrow.

* All method calls are delegated to each metrics instance in the list in the order they were
* provided to the constructor.
*
* <p><strong>Important:</strong> The {@link #timeControllerExecution(ControllerExecution)} method
Copy link
Collaborator

Choose a reason for hiding this comment

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

Good point. I forgot about that when I suggested this design! 😓

Copy link
Collaborator

@xstefank xstefank left a comment

Choose a reason for hiding this comment

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

LGTM

@csviri
Copy link
Collaborator

csviri commented Aug 28, 2025

Hi @Donnerbart loogks, great, would be better if you could target next branch, for the next minor version. Maybe also to mention this addon on docs (here https://javaoperatorsdk.io/docs/documentation/observability/ ). otherwise great, thank you

@Donnerbart Donnerbart force-pushed the improvement/2884-add-aggregate-metrics branch from e80267d to 255ef8a Compare August 28, 2025 08:59
@Donnerbart Donnerbart changed the base branch from main to next August 28, 2025 09:00
@Donnerbart Donnerbart force-pushed the improvement/2884-add-aggregate-metrics branch 2 times, most recently from 425634c to 3e80997 Compare August 28, 2025 09:01
…tions

Signed-off-by: David Sondermann <david.sondermann@hivemq.com>
@Donnerbart Donnerbart force-pushed the improvement/2884-add-aggregate-metrics branch from 3e80997 to ac8e46e Compare August 28, 2025 09:04
Signed-off-by: David Sondermann <david.sondermann@hivemq.com>
@Donnerbart
Copy link
Contributor Author

  • Moved the class into the io.javaoperatorsdk.operator.api.monitoring package.
  • Changed the target branch to next.
  • Added and improved the documentation.

@csviri csviri merged commit a86fc2c into operator-framework:next Aug 28, 2025
25 checks passed
@Donnerbart Donnerbart deleted the improvement/2884-add-aggregate-metrics branch August 28, 2025 11:24
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.

Custom bootstrap and CR lifecycle management
4 participants