-
Notifications
You must be signed in to change notification settings - Fork 921
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
Add pendingResponse to ServerMetrics #5895
base: main
Are you sure you want to change the base?
Conversation
4d5d2e8
to
d376d4b
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5895 +/- ##
============================================
- Coverage 74.66% 74.66% -0.01%
- Complexity 21681 21704 +23
============================================
Files 1896 1897 +1
Lines 80320 80391 +71
Branches 10548 10553 +5
============================================
+ Hits 59974 60023 +49
- Misses 15318 15339 +21
- Partials 5028 5029 +1 ☔ View full report in Codecov by Sentry. |
d376d4b
to
736963a
Compare
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.
Only left nit comments, basically looks good to me 👍
private final ServerMetrics serverMetrics; | ||
|
||
/** | ||
* Creates a new instance. | ||
*/ | ||
GracefulShutdownSupport(ServerMetrics serverMetrics) { | ||
this.serverMetrics = serverMetrics; | ||
} |
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.
nit; member fields/constructors can go under the static declarations
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 have made the corrections! I will be more careful with the order next time
/** | ||
* Creates a new instance. | ||
*/ | ||
GracefulShutdownSupport(ServerMetrics serverMetrics) { |
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.
Can be private, ditto for the other ctors
GracefulShutdownSupport(ServerMetrics serverMetrics) { | |
private GracefulShutdownSupport(ServerMetrics serverMetrics) { |
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 have changed it to private
@@ -174,6 +190,10 @@ public void bindTo(MeterRegistry meterRegistry) { | |||
meterRegistry.gauge(allRequestsMeterName, | |||
ImmutableList.of(Tag.of("protocol", "http1.websocket"), Tag.of("state", "active")), | |||
activeHttp1WebSocketRequests); | |||
// pending non-transient responses | |||
meterRegistry.gauge(allRequestsMeterName, |
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.
Question) Can we keep the old format (armeria.server.pending.responses
) so that metric name related breaking changes aren't made?
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 have changed it to the old format
Can you also sign the CLA? #5895 (comment) |
736963a
to
e2dc69c
Compare
e2dc69c
to
5964079
Compare
|
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.
Added a minor commit, let me know if anything doesn't make sense. Thanks @EunJungYoo 🙇 👍
void increasePendingResponses() { | ||
pendingResponses.increment(); | ||
} | ||
|
||
void decreasePendingResponses() { | ||
pendingResponses.decrement(); | ||
} |
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.
The number of pendingResponses
seems the same as activeRequests
. If so, we don't need to record the same value twice in different places.
Should we remove inc()
and dec()
in GracefulShutdownSupport
and use activeRequests()
for "armeria.server.pending.responses"
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.
There was a previous mention of the difference between pendingResponses and activeRequests. If we were to merge them, additional modifications might be necessary. Would it be better to merge them?
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.
The current changes are a clean-up but do not provide additional benefits to users.
I prefer to add metrics for transient requests in ServerMetrics
- Expose a meter with
state=transient
tag forTransientService
- Exclude transient requests from
activeRequests
- Switch
state=pending
tostate=active
orstate=transient
- Add useful methods
public long transientHttp1Requests() { return transientHttp1Requests.longValue(); } public long transientHttp2Requests() { return transientHttp2Requests.longValue(); } public long transientRequests() { return transientHttp1Requests() + transientHttp2Requests(); } public long allRequests() { return pendingRequests() + activeRequests() + transientRequests(); }
After those changes, pendingResponses
will be the same as activeRequests
.
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.
@ikhoon That's a good suggestion. 👍
Motivation:
Modifications:
Result: