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

Add ResponseMetered annotation for Jersey Resource (4.0-development) #1186

Merged

Conversation

@dennyac
Copy link
Contributor

@dennyac dennyac commented Sep 8, 2017

For Dropwizard services, we currently have metrics for response rates by HTTP status code (1xx, 2xx, 3xx, 4xx, 5xx) captured at Jetty . There have been use cases where it would be helpful to have it on a Jersey Resource method/class level. To achieve that, I've added @ResponseMetered annotation which will add meters for 1xx/2xx/3xx/4xx/5xx responses. I've reused the logic from com.codahale.metrics.jetty9.InstrumentedHandler to capture the metrics.

I hope you find this helpful and I'm open to suggestions/feedback. Thanks!

This is based of #1185 for the 4.0-development branch

@Path("/")
@Produces(MediaType.TEXT_PLAIN)
public class InstrumentedResource {
    @GET
    @ResponseMetered
    @Path("/responseMeteredEndpoint")
    public Response responseMeteredEndpoint() {
        return Response.ok().build();
    }
}
@dennyac
Copy link
Contributor Author

@dennyac dennyac commented Sep 8, 2017

Hi @arteam @jplock , just created the ResponseMetered annotation for 4.0-development.

@dennyac dennyac changed the title Add ResponseMetered annotation for 4.0-development Add ResponseMetered annotation for Jersey Resource (4.0-development) Sep 8, 2017
@arteam arteam merged commit bfc8a8a into dropwizard:4.0-development Sep 15, 2017
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
arteam added a commit that referenced this pull request Sep 15, 2017
Closes #1186
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants