-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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 response code meters for ResponseMetered annotation #3043
Add response code meters for ResponseMetered annotation #3043
Conversation
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.
@dennyac Thanks for your contribution! It looks good in general.
Could you please make this change backward-compatible and optional by adding a flag to the ResponseMetered
annotation which controls whether the detailed, the "coarse" (2xx, etc.), or both styles status codes are recorded?
Maybe an enum would make sense here: COARSE
(default), DETAILED
, and ALL
(because BOTH
might not be true anymore if another mode was added 😅).
@joschi - That makes sense. I'll incorporate that feedback. Thanks! |
b53546a
to
a945082
Compare
@joschi - I've pushed changes based on your feedback. Please review when you get time. Also, let me know if I should add this functionality to metrics-jersey3 and metrics-jersey31 modules as well (in a separate PR or the same PR) |
Happy New Year @joschi !! Bumping this PR for review when you have time. |
...est/java/com/codahale/metrics/jersey2/SingletonMetricsResponseMeteredPerClassJerseyTest.java
Outdated
Show resolved
Hide resolved
...est/java/com/codahale/metrics/jersey2/SingletonMetricsResponseMeteredPerClassJerseyTest.java
Outdated
Show resolved
Hide resolved
...est/java/com/codahale/metrics/jersey2/SingletonMetricsResponseMeteredPerClassJerseyTest.java
Outdated
Show resolved
Hide resolved
...rc/main/java/com/codahale/metrics/jersey2/InstrumentedResourceMethodApplicationListener.java
Outdated
Show resolved
Hide resolved
Thanks for the review @joschi !! Addressed your comments. |
@dennyac Thanks a lot for your contribution and the changes you've made to this PR! 😄
If you want to invest the time into creating PRs for these I'll happily review and merge them. 😉 |
@joschi - Thanks for taking the time to review the PRs. I'll create PRs for metrics-jersey3 and metrics-jersey31 |
This change set adds configurable individual response code meters in Jetty 9.x. This change is backwards compatible and the default behavior will only include the existing 1xx/2xx/3xx/4xx/5xx meters. Refs #3043
Currently the ResponseMetered annotation gives us top level 1xx/2xx/3xx/4xx/5xx meters. We have many use cases where we care about specific response codes like 401/503 and end up manually instrumenting code to create these meters. This PR adds meters for individual response codes in addition to the 1xx/2xx/3xx/4xx/5xx meters in the ResponseMetered annotation.
Hoping others find this useful and I'm open to suggestions/feedback.
Happy to add this functionality to metrics-jersey3 and metrics-jersey31 as well if this approach is acceptable. Can also create a PR to add individual response code meters to the jetty InstrumentedHandler