-
Notifications
You must be signed in to change notification settings - Fork 966
Emit Netty event loop metrics provided by MicroMeter #6290
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
base: main
Are you sure you want to change the base?
Conversation
|
I am figuring out the ICLA thing with my company. Will report back as soon as I have signed the ICLA. |
minwoox
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically, looks good. Left a few suggestions. 👍
| return result; | ||
| } | ||
|
|
||
| @Deprecated // use the same metric with micrometer namespace instead |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add @Deprecated to the class. 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Woud you also deprecate MoreMeterBinders.eventLoopMetrics() that takes name and meterIdPrefix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not deprecate the whole class because it emits a metric (num event loop workers) which is not available in Micrometer right now. We will continue using it until we are able to add that metric in Micrometer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not deprecate the whole class because it emits a metric (num event loop workers) which is not available in Micrometer right now
What do you think of first adding the metric to Micrometer first before proceeding with this PR?
I think the direction of this PR will be clearer if we can consider NettyEventExecutorMetrics as a replacement of MoreMeterBinders.eventLoopMetrics.
Also, it would be nice if the meter name prefix can also be specified like ExecutorServiceMetrics does - especially given that thread names are not necessarily unique. It can also allow users to group armeria related metrics easily depending on the prefix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think of first adding the metric to Micrometer first before proceeding with this PR?
I think the direction of this PR will be clearer if we can consider NettyEventExecutorMetrics as a replacement of MoreMeterBinders.eventLoopMetrics.
I agree with you. Initially, I thought users could simply count the number of event loops using a count query with the name tag,
but since there's some additional calculation involved, we probably do need to add the metric as well.
Also, it would be nice if the meter name prefix can also be specified like ExecutorServiceMetrics does - especially given that thread names are not necessarily unique. It can also allow users to group armeria related metrics easily depending on the prefix.
I thought the current approach was fine because I personally recommend using only a single event loop group.
However, there are cases where users can't unify event loop groups — for example, when using Armeria with Lettuce.
So, let's ask the Micrometer team if it's possible to customize the meter name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I will get that done.
This reverts commit d3f8740.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6290 +/- ##
============================================
+ Coverage 74.46% 74.55% +0.08%
- Complexity 22234 22423 +189
============================================
Files 1963 1987 +24
Lines 82437 82998 +561
Branches 10764 10779 +15
============================================
+ Hits 61385 61877 +492
- Misses 15918 15956 +38
- Partials 5134 5165 +31 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| final EventLoopGroup testGroup = EventLoopGroups.newEventLoopGroup(1); | ||
|
|
||
| try { | ||
| CommonPools.bindEventLoopMetricsForWorkerGroup(testGroup); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that 1) Flags.meterRegistry is a static variable and 2) the jvm is forked for every gradle module I can imagine this test affecting other tests within the core module.
What do you think of adding a second parameter MeterRegistry for testing purposes? (i.e. using new SimpleMeterRegistry())
| return result; | ||
| } | ||
|
|
||
| @Deprecated // use the same metric with micrometer namespace instead |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not deprecate the whole class because it emits a metric (num event loop workers) which is not available in Micrometer right now
What do you think of first adding the metric to Micrometer first before proceeding with this PR?
I think the direction of this PR will be clearer if we can consider NettyEventExecutorMetrics as a replacement of MoreMeterBinders.eventLoopMetrics.
Also, it would be nice if the meter name prefix can also be specified like ExecutorServiceMetrics does - especially given that thread names are not necessarily unique. It can also allow users to group armeria related metrics easily depending on the prefix.
Motivation:
Use Micrometer out-of-the-box provided netty metrics.
Modifications:
Result:
netty.eventexecutor.tasks.pending