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

Register the allocator memory metric polled gauge only once #1084

Merged

Conversation

jfernandez
Copy link
Contributor

We previously registered a polled gauge for each port. If you register a polled gauge multiple times with the same id, then it will sum the corresponding values. This was causing our memory metrics to report x N as the actual value (where N is number of ports).

All channels should be sharing the same allocator instance, so we only need to register the gauge once. Querying this metric also acquires a lock on each arena.


// All channels should share a single ByteBufAllocator instance.
// Add metrics to monitor that allocator's memory usage.
if (!allBindFutures.isEmpty()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this conditional be inverted?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We want to check here that the allbindFutures list is not empty because in line 201 we fetch the first entry. The conditional looks correct to me.

Copy link
Contributor

@carl-mastrangelo carl-mastrangelo left a comment

Choose a reason for hiding this comment

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

LGTM

@jfernandez jfernandez merged commit e266f19 into Netflix:master Aug 9, 2021
@jfernandez jfernandez deleted the jfernandez/fix-allocator-metrics branch August 9, 2021 20:29
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.

None yet

2 participants