Skip to content

HDDS-15931. Remove usage of internal netty metrics#10846

Open
rich7420 wants to merge 1 commit into
apache:masterfrom
rich7420:HDDS-15931
Open

HDDS-15931. Remove usage of internal netty metrics#10846
rich7420 wants to merge 1 commit into
apache:masterfrom
rich7420:HDDS-15931

Conversation

@rich7420

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

It would be better to not use netty internal maxDirectMemory and usedDirectMemory in NettyMetrics#getMetrics.

usedDirectMemory can be replaced by netty public api. For example:

public long getUsedDirectMemory() {
ByteBufAllocator allocator = ByteBufAllocator.DEFAULT;
if (allocator instanceof ByteBufAllocatorMetricProvider)

{ ByteBufAllocatorMetric metric = ((ByteBufAllocatorMetricProvider) allocator).metric(); return metric.usedDirectMemory(); }

return -1L;
}

maxDirectMemory depends on system property and jvm setting.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-15931

How was this patch tested?

https://github.com/rich7420/ozone/actions/runs/29946173218

Replace the internal PlatformDependent.usedDirectMemory/maxDirectMemory
calls in NettyMetrics with public API. usedDirectMemory now reads the
default ByteBufAllocator's metric; maxDirectMemory mirrors Netty's
resolution order (io.netty.maxDirectMemory property, then
-XX:MaxDirectMemorySize, then max heap) using only public API and is
resolved once and cached. Add TestNettyMetrics.
Copilot AI review requested due to automatic review settings July 23, 2026 08:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@rich7420

Copy link
Copy Markdown
Contributor Author

cc @chungen0126

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants