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

4.1.5: Initialize distribution customizations even before config is applied #9564

Merged
merged 1 commit into from
Dec 4, 2024

Conversation

barchetta
Copy link
Member

Backport #9547 to Helidon 4.1.5

Description

Resolves #9546

We added a new data structure, DistributionCustomizations, in Helidon 4.1.4 to support an enhancement in MP metrics 5.1 to allow configuration of percentiles, buckets, etc.

Under normal conditions, the Helidon MP metrics CDI extension invokes this type's init method with an MP config object to prepare the various customizations and all is well.

A user wrote a test that used MP metrics (a timer specifically) but did not mark the test with @HelidonTest so the initialization described above did not occur. That caused an NPE.

We have also since had a report of this happening in an app, in which a CDI extension attempts to register a timer before the metrics CDI extension has prepared metrics properly. As with the test use case above, this means metrics tries to use the instance field before it has been set.

This PR modifies the DistributionCustomizations class to initialize the static (non-final) instance variable at load-time without using config. This resolves the problem the user encountered with the test.

Subsequently the metrics CDI extension overwrites that initial value with one derived from configuration.

Documentation

No impact.

…elidon-io#9547)

* Initialize distribution customizations even before config is applied

* Improve comment
@barchetta barchetta added metrics backport Issues that are merged into a single branch, but missing in either master or previous release 4.x Version 4.x labels Dec 4, 2024
@barchetta barchetta added this to the 4.1.5 milestone Dec 4, 2024
@barchetta barchetta requested a review from tjquinno December 4, 2024 22:36
@barchetta barchetta self-assigned this Dec 4, 2024
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Dec 4, 2024
@barchetta barchetta mentioned this pull request Dec 4, 2024
16 tasks
@barchetta barchetta merged commit 2e4fd31 into helidon-io:helidon-4.1.x Dec 4, 2024
44 checks passed
@barchetta barchetta deleted the 4.1.5-9547-backport branch December 4, 2024 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.x Version 4.x backport Issues that are merged into a single branch, but missing in either master or previous release metrics OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants