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.x Make RegistryFactory and its getInstance and getRegistry methods public #8175

Merged
merged 2 commits into from Dec 21, 2023

Conversation

tjquinno
Copy link
Member

@tjquinno tjquinno commented Dec 20, 2023

Description

Resolves #8161

In 3.x, the RegistryFactory class was public in the metrics API module and usable from both SE and MP. It had public methods getInstance() and getRegistry() and was injectable.

In 4.x, we moved it to MP because it no longer applied in SE with the new neutral metrics API. At that time, I also made the class package-private because RegistryFactory only had a role in MP metrics now, and I anticipated that users would @Inject MetricRegistry rather than work with the RegistryFactory.

The 4.x doc still referred to RegistryFactory and, in fact, it is still a valid use case to either @Inject the RegistryFactory or retrieve it programmatically using a static method so as to invoke its getRegistry method to locate a MetricRegistry programmatically. As we found out in our internal Slack channel, users had used these approaches in 3.x and we broke their code by removing this capability.

Restoring these features, essentially to how they worked in 3.x, enlarges our surface area only very slightly as compared to 4.0.1 and allows existing user code to continue to work with only a change in import statements (because RegistryFactory is in a different package in 4.x).

This PR does the following:

  1. Make RegistryFactory and its getInstance() and getRegistry(String) methods public.
    1. Change the return type of getRegistry from Registry (a package-private class) to MetricRegistry (an MP metrics interface which Registry implements).
    2. Add a package-private method registry(String) to RegistryFactory which returns a Registry for use by our own methods in the package.
  2. Update the MP metrics doc to clarify and show how to get and use a RegistryFactory instance.

Documentation

Changes included in the PR.

…ic as in 3.x; update the MP metrics doc to clarify

Signed-off-by: Tim Quinn <tim.quinn@oracle.com>
Signed-off-by: Tim Quinn <tim.quinn@oracle.com>
@tjquinno tjquinno added this to the 4.0.3 milestone Dec 20, 2023
@tjquinno tjquinno self-assigned this Dec 20, 2023
@oracle-contributor-agreement oracle-contributor-agreement bot added OCA Verified All contributors have signed the Oracle Contributor Agreement. labels Dec 20, 2023
Copy link
Contributor

@ljamen ljamen left a comment

Choose a reason for hiding this comment

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

Small doc updates - LGTM.

@ljamen ljamen merged commit 68de0bb into helidon-io:main Dec 21, 2023
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4.x MP metrics doc refers to RegistryFactory which is package private in 4.x
2 participants