rich7420 opened a new pull request, #10990:
URL: https://github.com/apache/ozone/pull/10990
## What changes were proposed in this pull request?
Adds a gateway-wide `pendingOperations` metric to `S3GatewayMetrics` that
tracks
the number of S3 operations currently in flight — received and being
processed
but not yet fully replied to. This mirrors the intent of the xceiver client
`pendingOps` metric (increment when an operation starts, decrement when its
response is complete), as requested in the Jira.
Details:
- **Metric type.** `pendingOperations` is a `MutableGaugeLong`, not a
counter.
A live in-flight value rises and falls, so a gauge is the correct type for
Prometheus/JMX consumers (`rate()`/`increase()` over a decreasing counter
is
meaningless). This matches the existing Ozone convention for point-in-time
"pending/current" values (for example
`SCMNodeMetrics.totalPendingContainerSlots`,
`BlockDeletingServiceMetrics.totalPendingBlockCount`). The xceiver metric
the
Jira references models the *concept*; the idiomatic type here is a gauge.
- **Instrumentation.** A new `PendingOperationsFilter` (JAX-RS `@Provider`,
auto-registered via `GatewayApplication`'s package scan) increments on the
request side and decrements on the response side. It remembers the metrics
instance on the request and decrements only that same instance, so a
request
rejected before the filter runs can never drive the gauge negative.
- **Scope.** The filter is post-matching, so it counts operations that
reached
an endpoint. Requests rejected earlier (for example by the `@PreMatching`
`AuthorizationFilter`) are not counted, since they are not operations the
gateway performs.
- **Streaming GetObject.** For a streaming `GetObject` the JAX-RS response
filter runs before the body is written, so the decrement is deferred until
the
response stream is closed (mirroring `TracingFilter`, HDDS-7064), with a
one-shot guard against double-decrement. The operation stays pending until
the
object body has finished streaming to the client.
## What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-10362
## How was this patch tested?
- New unit test `TestPendingOperationsFilter` — normal request/response
returns
to baseline, a response without a matching request is a no-op, and a
streaming
`GetObject` stays pending until stream close (and a second close does not
go
negative).
- `mvn -pl :ozone-s3gateway test
-Dtest=TestPendingOperationsFilter,TestS3GatewayMetrics`
— `TestPendingOperationsFilter` 3/3, `TestS3GatewayMetrics` 44/44.
- `checkstyle` and `rat` clean.
- Full CI on the fork: all static gates, compile (8/17/21/25), unit, and all
S3
acceptance groups (including `s3a`, which exercises `GetObject` heavily)
pass.
Two jobs were flaky/unrelated and pass on re-run:
`integration (om)`
(`TestKeyLifecycleService.testPrefixDirectoryNotExpired`,
an OM lifecycle test) and `acceptance (tools)` (a CI cache digest
mismatch).
--
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]