Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the connection-accounting and metric-reporting changes.
No open issues 🎉
What changed in this PR
This PR fixes connection accounting in OM’s S3 gRPC server so connections that terminate before becoming ready do not drive the open-connection metric below zero.
Changes:
- Skip decrementing the connection count when termination attributes are null.
- Change
NumOpenClientConnectionsto a gauge for correct Prometheus reporting. - Add regression tests for early termination, the normal connection lifecycle, and the metric type.
| File | Description |
|---|---|
hadoop-hdds/framework/src/test/java/org/apache/hadoop/ozone/grpc/metrics/TestGrpcMetrics.java |
Tests gauge publication and connection lifecycle accounting. |
hadoop-hdds/framework/src/main/java/org/apache/hadoop/ozone/grpc/metrics/GrpcMetricsServerTransportFilter.java |
Guards decrements against termination before readiness. |
hadoop-hdds/framework/src/main/java/org/apache/hadoop/ozone/grpc/metrics/GrpcMetrics.java |
Uses MutableGaugeLong for the active connection count. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
OM's S3 gRPC server counts active client connections through a transport filter. A TCP health check, port scan, or failed TLS handshake can terminate before the transport becomes ready. The filter previously decremented the connection count anyway, which caused
NumOpenClientConnectionsto become negative.This change decrements the count only when
transportTerminatedreceives non-null attributes. It also changesNumOpenClientConnectionsfromMutableCounterLongtoMutableGaugeLong, so Prometheus exports it as a gauge rather than a counter. Regression tests cover both termination-before-ready and the normal ready-to-terminated lifecycle.What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-17888
How was this patch tested?
mvn -pl :hdds-server-framework -am test \ -Dtest=TestGrpcMetrics \ -Dsurefire.failIfNoSpecifiedTests=false \ -DskipShade -DskipRecon