[studio] feat: expose gRPC client connection diagnostics in proxy GrpcChannelManager#10611
Open
btlqql wants to merge 1 commit into
Open
[studio] feat: expose gRPC client connection diagnostics in proxy GrpcChannelManager#10611btlqql wants to merge 1 commit into
btlqql wants to merge 1 commit into
Conversation
…cChannelManager GrpcChannelManager is the proxy-side source of truth for connected gRPC clients (clientIdChannelMap) and for pending relay response futures (resultNonceFutureMap), yet it exposed no way to observe either. Without read-only accessors, client connection management and runtime diagnosis are impossible for the Studio management platform and admin tooling. Add three read-only diagnostic methods. They are purely additive and do not change any gRPC/proto API or protocol contract, honoring the Track 2 "discuss before changing the protocol" guideline from issue apache#10600: - getChannelCount(): number of active gRPC client channels - getActiveClientIdSet(): unmodifiable snapshot of connected client ids - getPendingResponseFutureCount(): number of pending relay futures These form the foundation for the client-connection-management and runtime diagnostic capabilities highlighted by Track 2 of the RocketMQ Studio call for contributors. Add GrpcChannelManagerTest covering channel create/get/remove, idempotent creation, active-client-id snapshot and unmodifiable semantics, and pending response-future accounting. Relates to apache#10600 Signed-off-by: btlqql <2977859784@qq.com>
RockteMQ-AI
approved these changes
Jul 12, 2026
RockteMQ-AI
left a comment
Contributor
There was a problem hiding this comment.
Review by github-manager-bot
Summary
Adds three read-only diagnostic methods to GrpcChannelManager (getChannelCount, getActiveClientIdSet, getPendingResponseFutureCount) to support the RocketMQ Studio Track 2 client connection observability goal. Purely additive, no protocol changes.
Findings
- [Info]
GrpcChannelManager.java:83—getActiveClientIdSet()correctly creates a defensive copy vianew HashSet<>(keySet())before wrapping inunmodifiableSet. Thread-safe snapshot for diagnostic use. - [Info]
GrpcChannelManager.java:77,87—.size()onConcurrentHashMapreturns a weakly-consistent count, which is appropriate for diagnostics (no locking overhead). - [Info]
GrpcChannelManagerTest.java— Good test coverage: idempotent creation, snapshot independence, unmodifiable enforcement (UnsupportedOperationException), and future accounting. Tests follow existing patterns (InitConfigTest, JUnit 4 + Mockito).
Suggestions
- [Info] Consider adding brief Javadoc to the three new public methods explaining their diagnostic purpose and thread-safety guarantees (weakly-consistent for counts, snapshot for client IDs). This helps future consumers understand the semantics without reading the implementation.
Verdict
Clean, well-tested, purely additive change. LGTM.
Automated review by github-manager-bot
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.
[studio] feat: expose gRPC client connection diagnostics in proxy GrpcChannelManager
Relates to #10600 (RocketMQ Studio: AI-Native Management Platform — Track 2: Proxy Admin management capability upgrade).
Background
GrpcChannelManageris the proxy-side source of truth for connected gRPCclients (
clientIdChannelMap) and for pending relay response futures(
resultNonceFutureMap). Until now it exposed no way to observe either,which makes client connection management and runtime diagnosis impossible for
the Studio management platform and for admin/diagnostic tooling — the exact
capabilities called out by Track 2 of issue #10600 ("client connection
management and runtime diagnostic capabilities").
What this PR does
Adds three read-only, purely additive diagnostic methods to
org.apache.rocketmq.proxy.grpc.v2.channel.GrpcChannelManager:getChannelCount()getActiveClientIdSet()getPendingResponseFutureCount()These methods do not alter any gRPC/proto API or protocol contract, so they
respect the Track 2 guideline that protocol/interface changes must be discussed
in an issue first. They are the foundation on which the Studio platform and
admin tooling can build standardized client-connection observation.
Why no protocol change here
Issue #10600 explicitly requires that Track 2 protocol/admin interface changes
be discussed and reach community consensus before code is submitted. This PR
intentionally avoids touching the proxy admin gRPC contract; it only opens up
read-only access to existing in-memory state so it can be consumed later by the
standardized admin layer once that design is agreed upon.
Tests
Adds
GrpcChannelManagerTest(extendsInitConfigTest, JUnit 4 + Mockito),mirroring the existing
GrpcClientChannelTest, covering:getChannelCounttrackinggetActiveClientIdSet()returns an unmodifiable snapshot (independent oflater channel removal)
getPendingResponseFutureCount()accounting throughaddResponseFuture/getAndRemoveResponseFuture@AfterSelf-check
[studio]