yandrey321 opened a new pull request, #11498:
URL: https://github.com/apache/ozone/pull/11498
## What changes were proposed in this pull request?
Every gRPC call updates `GrpcMetrics.grpcQueueTime` and
`GrpcMetrics.grpcProcessingTime` through
`GrpcMetricsServerRequestInterceptor`. Both are Hadoop `MutableRate`s, and
`MutableStat.add` is `synchronized`,
so concurrent gRPC calls contend on the same monitor just to record their
latency. This is the same contention
HDDS-16304 removed from `RpcMetrics`.
This PR replaces both counters with `ConcurrentMutableRate`, the lock-free
drop-in that HDDS-16304 already uses.
- The two fields drop `@Metric` and become `final ConcurrentMutableRate`,
created in the constructor. They take the
names the `@Metric` factory used to derive from the field names
(`GrpcQueueTime`, `GrpcProcessingTime`), with
`extended = false`, so the emitted metrics are still `GrpcQueueTimeNumOps`
/ `GrpcQueueTimeAvgTime` and
`GrpcProcessingTimeNumOps` / `GrpcProcessingTimeAvgTime`, with no
Stdev/Min/Max added.
- `GrpcMetrics` already implements `MetricsSource` and owns `getMetrics()`.
It now snapshots the two rates into the
same `grpc` record as the registry metrics. Unlike `RpcMetrics`, no
hybrid-source wiring is needed.
- The package-private getters `getGrpcQueueTime()` /
`getGrpcProcessingTime()` now return
`ConcurrentMutableRate`. They have no callers outside the class.
- The `MutableCounterLong` fields, the `MutableQuantiles` arrays and the
separate `LatestRequestType` tag record are
unchanged.
Generated-by: Claude Code (Claude Opus 5.5)
## What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-16740
## How was this patch tested?
The new unit test `TestGrpcMetrics` reads the emitted records through
`MetricsCollectorImpl`, the same way
`TestRpcMetrics` does. It checks:
- the rate names, values and sample counts, and that the rates are not
extended;
- that the rates are emitted in the `grpc` record next to the counters and
quantiles, with `LatestRequestType`
still in its own record;
- that 14 threads x 1000 concurrent adds are all counted.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]