zhaohai666 opened a new pull request, #10703:
URL: https://github.com/apache/rocketmq/pull/10703
# PR Description: RIP-2 Proxy Admin Interface - PR#2 gRPC Service
Implementation & Startup Integration
## Background
This is the second atomic PR within the RIP-2 (Proxy Admin Interface)
feature sequence. It relies on the protobuf definition and serialization
foundation delivered in PR #1, implementing the core gRPC service handlers and
integrating the Proxy Admin service into the Proxy’s full startup/shutdown
lifecycle.
## Design Overview
### 1. Core gRPC Service Layer
- **ProxyAdminBindableService**
Implements `io.grpc.BindableService`, responsible for registering the
Proxy Admin gRPC service on an independent dedicated port. Isolated from
data-plane gRPC to eliminate cross-business resource contention.
- **ProxyAdminGrpcService**
Core implementation of all RPC endpoints defined in proto. Delegates
business logic to underlying modules including client service, route service
and diagnostics service. Uniformly handles input request validation,
exception-to-`AdminCode` error mapping, and final response construction.
- **ProxyAdminMetricsManager**
Independent metrics collector exclusively for admin API traffic. Tracks
request counters, latency histograms and error ratios, all exposed through the
unified Prometheus monitoring endpoint.
### 2. Proxy Startup Lifecycle Integration
- **ProxyStartup (modified)**
Adds conditional initialization logic for the admin service controlled by
switch config. The admin service runs on an isolated Netty server instance with
a separate listening port (default: 8081).
- **ProxyConfig (modified)**
Introduces brand-new configuration items for the admin module: enable
toggle, listening port, business thread pool size, and authentication mode.
### 3. Constant Updates
- **GrpcConstants (modified)**
Extends gRPC metadata constant definitions for admin-specific
authentication headers and distributed tracing headers.
- **ProxyMetricsManager (modified)**
Provides unified registration entry for admin module metrics to the global
metrics framework.
## Changed & New File Scope
| File Path | File Type | Change Type | Brief Description |
| ---- | ---- | ---- | ---- |
| `ProxyAdminBindableService.java` | Java Source | New | gRPC service bind &
registration logic |
| `ProxyAdminGrpcService.java` | Java Source | New | Full implementation of
all admin RPC handlers |
| `ProxyAdminMetricsManager.java` | Java Source | New | Dedicated metrics
collector for admin operations |
| `ProxyStartup.java` | Java Source | Modified | Add admin service bootstrap
logic (+116 lines) |
| `ProxyConfig.java` | Java Source | Modified | Introduce admin service
configuration fields (+98 lines) |
| `GrpcConstants.java` | Java Source | Modified | Append admin auth &
tracing metadata constants |
| `ProxyMetricsManager.java` | Java Source | Modified | Extend metrics
registration entry for admin module |
| `ProxyStartupTest.java` | Test Source | New | Unit tests covering admin
service startup/shutdown lifecycle |
| `ProxyAdminBindableServiceTest.java` | Test Source | New | Validation for
gRPC service binding logic |
| `ProxyAdminGrpcServiceTest.java` | Test Source | New | Full unit tests for
all RPC handlers with mocked downstream dependencies (1060 lines) |
| `ProxyAdminMetricsManagerTest.java` | Test Source | New | Verify counter &
histogram metrics collection and reporting |
Total: 11 files changed, +2959 lines of code added
## Dependencies
Depends on PR #1 (RIP-2 Proto Definition & Serialization Foundation) which
provides the proto schema, marshaller and converter infrastructure.
## Test Coverage & Validation
1. RPC Handler Unit Tests
All admin RPC endpoints covered; downstream business services mocked to
isolate handler logic, verify parameter validation and error conversion paths.
2. Startup Lifecycle Tests
Validate complete admin service workflow: initialization → start
listening → graceful shutdown, controlled by configuration enable flag.
3. Metrics Collection Tests
Confirm all required counters and latency histograms are registered
correctly, and metric values are recorded as expected during API invocations.
## Development Branch
`feature/rip-2-pr2-grpc-service-startup`
## Related Tracking
RIP-2: Proxy Admin Interface
This PR is Step 2 / 6 of the full Proxy Admin feature implementation
sequence.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]