Chung-En Lee created HDDS-15931:
-----------------------------------

             Summary: Remove usage of internal netty metrics
                 Key: HDDS-15931
                 URL: https://issues.apache.org/jira/browse/HDDS-15931
             Project: Apache Ozone
          Issue Type: Sub-task
            Reporter: Chung-En Lee


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; // 或使用專案中自訂的 Allocator
if (allocator instanceof ByteBufAllocatorMetricProvider) {
ByteBufAllocatorMetric metric = ((ByteBufAllocatorMetricProvider) 
allocator).metric();
return metric.usedDirectMemory(); // 公開 API
}
return -1L;
}
```

`maxDirectMemory` depends on system property and jvm setting.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to