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

   ## What changes were proposed in this pull request?
   
   `GrpcMetricsServerRequestInterceptor.onMessage` set the `LatestRequestType` 
tag by rendering the whole request with
   `message.toString()` and parsing the first line. That costs a full text 
rendering of every `OMRequest`, and the
   parsing breaks on messages that do not start with `cmdType: ...`.
   
   Key implementation details:
   - `cmdType` is read with 
`getDescriptorForType().findFieldByName("cmdType")`, inside the existing
     `instanceof AbstractMessage` branch. The interceptor stays generic, with 
no `framework` → `interface-client`
     dependency. Messages without the field leave the tag unchanged.
   - The tag value is unchanged: for an enum field, `getField(...).toString()` 
returns the value name (`CreateKey`).
   - `GrpcMetrics.requestType` is now `volatile`: it is written without a lock 
and read in the synchronized
     `getMetrics()`.
   
   Generated-by: Claude Code (Claude Opus 4.8)
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-16742
   
   ## How was this patch tested?
   
   New `TestGrpcMetricsServerRequestInterceptor`, using 
`SCMBlockLocationRequest` (same shape as `OMRequest`: `cmdType`
   as field 1, free-text `traceID` as field 2) with mocked gRPC calls.
   
   Test findings against the previous interceptor:
   - A protobuf message without `cmdType` set the tag to a fragment of a field 
value (`"user`). Now unchanged.
   - A non-protobuf message threw `ArrayIndexOutOfBoundsException` inside the 
interceptor. Now counted as unknown.
   - A request with `:` and newlines in `traceID` reports `GetScmInfo` both 
before and after, confirming the tag value
     is unchanged.
   
   `hdds-server-framework` unit tests: 654 run, 0 failures.
   


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