Skip to content

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

Merged
arteam merged 1 commit into
dropwizard:4.0-developmentfrom
dennyac:add-response-metered-annotation-40
Sep 15, 2017
Merged

Add ResponseMetered annotation for Jersey Resource (4.0-development)#1186
arteam merged 1 commit into
dropwizard:4.0-developmentfrom
dennyac:add-response-metered-annotation-40

Conversation

@dennyac

@dennyac dennyac commented Sep 8, 2017

Copy link
Copy Markdown
Contributor

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

dennyac commented Sep 8, 2017

Copy link
Copy Markdown
Contributor Author

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
arteam pushed a commit that referenced this pull request Sep 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants