yandrey321 opened a new pull request, #11554:
URL: https://github.com/apache/ozone/pull/11554

   ## What changes were proposed in this pull request?
   
   `GrpcQueueTime*` and `GrpcProcessingTime*` did not show the latency of 
individual OM gRPC calls. There were three
   bugs in `GrpcMetricsServerRequestInterceptor`, fixed together:
   
   - **Shared timestamps.** The receive, start and end times were fields of the 
single interceptor that serves every
     call, so concurrent calls overwrote each other's values. Now 
`receivedTime` is local to `interceptCall`,
     `startTime` is a field of the call's own listener, and `endTime` is local 
to `onComplete`. gRPC runs one call's
     listener callbacks one at a time, so no synchronization is needed.
   - **`int` truncation.** The nanosecond deltas were cast to `int`, which 
overflows after about 2.1 s.
     `addGrpcQueueTime` and `addGrpcProcessingTime` now take `long`.
   - **Units.** The values are nanoseconds, but were labeled as milliseconds. 
They stay in nanoseconds, to keep
     sub-millisecond resolution for OM calls. The descriptions now say 
nanoseconds, and the private `*MillisQuantiles`
     fields are renamed to `*NanosQuantiles`.
   
   Emitted metric names do not change. Their values do, because each call now 
records its own correct times.
   
   A call that completes without receiving a message now records nothing. With 
per-call fields, it would otherwise
   record a queue time computed from a start time of 0.
   
   Generated-by: Claude Code (claude-opus-5-5)
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-16741
   
   ## How was this patch tested?
   
   New tests in `TestGrpcMetricsServerRequestInterceptor`. A package-private 
constructor takes the clock, so the tests
   control every timestamp:
   - `testInterleavedCallsRecordTheirOwnTimes`: the callbacks of two calls are 
interleaved, and each call records its
     own queue and processing time.
   - `testTimesAboveIntRangeAreNotTruncated`: 3 s and 5 s are recorded 
unchanged.
   - `testCallWithoutMessageRecordsNoTimes`.
   
   The first two fail on the old code: shared fields and `int` casts. 
`TestGrpcMetrics` and the existing interceptor
   tests pass, and `ozone-manager` (which uses the interceptor) compiles. 
Checkstyle and PMD are clean.
   
   


-- 
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]

Reply via email to