Add pendingResponse to ServerMetrics - #5895
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
jrhee17
left a comment
There was a problem hiding this comment.
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.
nit; member fields/constructors can go under the static declarations
There was a problem hiding this comment.
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.
Can be private, ditto for the other ctors
| GracefulShutdownSupport(ServerMetrics serverMetrics) { | |
| private GracefulShutdownSupport(ServerMetrics serverMetrics) { |
| 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.
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.
I have changed it to the old format
|
Can you also sign the CLA? #5895 (comment) |
736963a to
e2dc69c
Compare
e2dc69c to
5964079
Compare
|
jrhee17
left a comment
There was a problem hiding this comment.
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.
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.
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.
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=transienttag forTransientService - Exclude transient requests from
activeRequests - Switch
state=pendingtostate=activeorstate=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.
Motivation:
Modifications:
Result: