[ISSUE #8354] Make prometheus client optional in nacos-client SDK#15212
Open
EvanYao826 wants to merge 1 commit into
Open
[ISSUE #8354] Make prometheus client optional in nacos-client SDK#15212EvanYao826 wants to merge 1 commit into
EvanYao826 wants to merge 1 commit into
Conversation
|
Thanks for your this PR. 🙏 感谢您提交的PR。 🙏 |
|
| Commit | Author | |
|---|---|---|
df384a6 |
EvanYao826 | evanyao826@gmail.com |
How to fix:
- Add your commit email to your GitHub account: https://github.com/settings/emails
- Or update your local git config to use an email already linked to GitHub:
git config user.name "Your GitHub Username" git config user.email "your-github-email@example.com" - Amend your commits and force-push:
git rebase -i HEAD~1 # mark commits as "edit" and amend author git push --force-with-lease
This check will re-run automatically after you push.
Author
|
I have read the CLA Document and I hereby sign the CLA |
- Mark io.prometheus:simpleclient as <optional>true</optional> - Refactor MetricsMonitor with runtime prometheus detection and no-op fallback - Extract prometheus API calls into PrometheusMetricsHelper - Replace direct Histogram.Child usage in MetricsHttpAgent with MetricsTimer interface - Update all callers to use simplified API Assisted-by: Hermes Agent
df384a6 to
61ddbc3
Compare
KomachiSion
approved these changes
May 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes #8354: Make the nacos-client SDK lighter by making the prometheus dependency optional.
Problem
nacos-clienthas a hard dependency onio.prometheus:simpleclient. Users who don't need metrics monitoring still pull in this dependency, which adds to the SDK footprint and can cause version conflicts.Solution
io.prometheus:simpleclientas<optional>true</optional>inclient/pom.xmlMetricsMonitorto detect prometheus availability at runtime viaClass.forName(). When prometheus is not on the classpath, all monitoring operations become no-ops.PrometheusMetricsHelper(only loaded when prometheus is available)Histogram.Childusage inMetricsHttpAgentwith aMetricsTimerinterfaceClientWorker,ServiceInfoHolder,NamingGrpcClientProxy) to use the new simplified APIChanges
client/pom.xml<optional>true</optional>to prometheus dependencyMetricsMonitor.javaPrometheusMetricsHelper.javaMetricsHttpAgent.javaMetricsTimerinstead of directHistogram.ChildClientWorker.javarecordListenConfigCount()ServiceInfoHolder.javarecordServiceInfoMapSize()NamingGrpcClientProxy.javarecordNamingRequestFailed()Backward Compatibility
ClassNotFoundExceptionAssisted-by: Hermes Agent