Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE 2637] Fix jvm_memory_direct_bytes_used metrics when using jdk11+ #3252

Merged
merged 2 commits into from Jul 29, 2022

Conversation

shoothzj
Copy link
Member

Fix #2637 #3247

Motivation

The mertics about jvm_memory_direct_bytes_used is acquired by netty's PlatformDependent#DIRECT_MEMORY_COUNTER. Which can only acquired the memory used by netty.

Changes

  • use java.nio.Bits#RESERVED_MEMORY for jvm direct memory metrics.
  • add tests to ensure jvm_memory_direct_bytes_max and jvm_memory_direct_bytes_used gets value.

@shoothzj
Copy link
Member Author

rerun failure checks

Copy link
Contributor

@dlg99 dlg99 left a comment

Choose a reason for hiding this comment

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

Is there a more officially supported way of doing this?
mx bean or something like that.

E.g. I can't tell if this works in JDK 17 or the next one.

@dlg99
Copy link
Contributor

dlg99 commented Apr 29, 2022

e.g. see #3234 : "Starting from JDK17 the reflection is not allowed in the jdk internals modules"

@shoothzj shoothzj force-pushed the issue-2637 branch 3 times, most recently from 33e9b35 to 33e3e3b Compare April 29, 2022 08:30
Copy link
Contributor

@dlg99 dlg99 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@StevenLuMT StevenLuMT left a comment

Choose a reason for hiding this comment

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

nice

@zymap zymap merged commit cefe9d4 into apache:master Jul 29, 2022
zymap pushed a commit that referenced this pull request Aug 1, 2022
…1+ (#3252)

Fix #2637 #3247

### Motivation
The mertics about `jvm_memory_direct_bytes_used` is acquired by netty's `PlatformDependent#DIRECT_MEMORY_COUNTER`. Which can only acquired the memory used by netty.

### Changes
- use `java.nio.Bits#RESERVED_MEMORY` for jvm direct memory metrics.
- add tests to ensure `jvm_memory_direct_bytes_max` and `jvm_memory_direct_bytes_used` gets value.

(cherry picked from commit cefe9d4)
hangc0276 pushed a commit to hangc0276/bookkeeper that referenced this pull request Nov 7, 2022
…1+ (apache#3252)

Fix apache#2637 apache#3247

### Motivation
The mertics about `jvm_memory_direct_bytes_used` is acquired by netty's `PlatformDependent#DIRECT_MEMORY_COUNTER`. Which can only acquired the memory used by netty.

### Changes
- use `java.nio.Bits#RESERVED_MEMORY` for jvm direct memory metrics.
- add tests to ensure `jvm_memory_direct_bytes_max` and `jvm_memory_direct_bytes_used` gets value.

(cherry picked from commit cefe9d4)
hangc0276 pushed a commit to hangc0276/bookkeeper that referenced this pull request Nov 7, 2022
…1+ (apache#3252)

Fix apache#2637 apache#3247

### Motivation
The mertics about `jvm_memory_direct_bytes_used` is acquired by netty's `PlatformDependent#DIRECT_MEMORY_COUNTER`. Which can only acquired the memory used by netty.

### Changes
- use `java.nio.Bits#RESERVED_MEMORY` for jvm direct memory metrics.
- add tests to ensure `jvm_memory_direct_bytes_max` and `jvm_memory_direct_bytes_used` gets value.

(cherry picked from commit cefe9d4)
@horizonzy
Copy link
Member

This may be a breaking change, after this pr. The old user who used jdk8 didn't record the direct memory metrics.

nicoloboschi pushed a commit to datastax/bookkeeper that referenced this pull request Jan 11, 2023
…1+ (apache#3252)

Fix apache#2637 apache#3247

### Motivation
The mertics about `jvm_memory_direct_bytes_used` is acquired by netty's `PlatformDependent#DIRECT_MEMORY_COUNTER`. Which can only acquired the memory used by netty.

### Changes
- use `java.nio.Bits#RESERVED_MEMORY` for jvm direct memory metrics.
- add tests to ensure `jvm_memory_direct_bytes_max` and `jvm_memory_direct_bytes_used` gets value.

(cherry picked from commit cefe9d4)
(cherry picked from commit 523ffcf)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The metrics about jvm_memory_direct_bytes_used
6 participants