Felix-Gong opened a new pull request, #11475: URL: https://github.com/apache/rocketmq/pull/11475
Fixes #11474 The proxy ships an OpenTelemetry pipeline (`ProxyMetricsManager`, both local and cluster mode) whose only instrument is the `rocketmq_proxy_up` gauge: call rate, latency and error rate of the admin gRPC server — the surface every ops tool talks to — are invisible. This PR makes the control plane observable through the pipeline that already exists, with no proto change and no new dependency. What lands: - **Two instruments**, registered through the existing `initMetrics` so both init paths (`initLocalMode` and cluster `start()`) get them: `rocketmq_proxy_admin_calls_total` (counter) and `rocketmq_proxy_admin_rt` (histogram, `milliseconds`), labeled `method` + `invocation_status` on top of the usual node/cluster/`proxy_mode` attributes from `newAttributesBuilder()`. - **`ProxyAdminMetricsInterceptor`** on the admin server: wraps `close(Status)` and records the terminal code (`OK`, `PERMISSION_DENIED`, `INTERNAL`, ...) exactly once per call — a client cancel reaching the listener first wins the `AtomicBoolean` race, so a handler that closes afterwards cannot double-count. Cancelled-without-close calls are not dropped either. - **Ordering**: registered after `ProxyAdminAuthInterceptor` in `configInterceptor(...)`. gRPC executes interceptors in reverse registration order, so metrics is the outer wrapper and counts calls the auth interceptor rejects — precisely where failures would show up first. `GlobalExceptionInterceptor` sits outside and closes the call it holds directly (bypassing the `close` wrapper), so listener callbacks that throw are recorded before the exception is rethrown to it — service-side INTERNAL failures are not a blind spot. - **One-line hardening**: `LABEL_MAP` becomes a `ConcurrentHashMap`. Admin call recording now reads it on request threads while `start()` populates it (in cluster mode the gRPC servers are appended to the start list before the metrics manager), which the pre-existing `HashMap` does not support. - **Disabled-safe by construction**: instruments default to `NopLongCounter`/`NopLongHistogram` (the broker's idiom), so metrics disabled or a call served before manager start is a free no-op instead of an NPE. Evidence: - `ProxyAdminMetricsInterceptorTest` 7/7: OK and PERMISSION_DENIED recorded through `close`, cancel/close dedup in both orders, delegate `close` still propagated, builtin method without a bare name records the full name, service exceptions recorded as `INTERNAL` (and `StatusRuntimeException` codes preserved) and rethrown. - `ProxyAdminCallMetricsTest` 4/4: record pre-init lands in Nops, `initLocalMode` swaps in real instruments, `DISABLE` keeps Nops, and an end-to-end pull through a test `MetricReader` asserts the exported names (`rocketmq_proxy_admin_calls_total`, `rocketmq_proxy_admin_rt`), the `method`/`invocation_status` label values and the recorded count/latency. - `GrpcServerInterceptorOrderTest`: extended with the two-post-interceptor relative order this PR depends on (auth registered first, metrics second → metrics executes outermost), so a re-registration cannot silently stop counting rejected calls. - Full `proxy` module: **465 tests green** on JDK 11 with checkstyle (validate) and spotbugs (compile) enabled — the same gates `mvn package` runs in CI. Zero new spotbugs findings, `misspell -error` clean. Coordination with open work: - **#10603** (RIP-2 client-admin endpoint) shares the neighborhood: its `ProxyStartup` import hunk is adjacent to this PR's import line (trivial both-keep merge), its `ProxyMetricsConstant`/`ProxyMetricsManager` entries carry no content change, and its `ClientAdminMetricsRecorder` instruments the new endpoint at service level — orthogonal to this wire-level interceptor, and calls to that endpoint would still flow through it. - **#11194 / #10903** edit `start()`'s label/header parsing — untouched regions in this PR. Both add a `ProxyMetricsManagerTest`, which is why this PR deliberately names its test `ProxyAdminCallMetricsTest`. - **#11363** touches the admin interceptor this PR registers next to; no shared lines. -- 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]
