Created
April 1, 2013 05:38
-
-
Save Arnonrgo/5283401 to your computer and use it in GitHub Desktop.
copy of https://github.com/codahale/metrics/blob/master/metrics-jersey/src/test/java/com/yammer/metrics/jersey/tests/resources/InstrumentedResource.java for illustration purposed in a blog post
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.yammer.metrics.jersey.tests.resources; | |
import com.yammer.metrics.annotation.ExceptionMetered; | |
import com.yammer.metrics.annotation.Metered; | |
import com.yammer.metrics.annotation.Timed; | |
import javax.ws.rs.*; | |
import javax.ws.rs.core.MediaType; | |
import java.io.IOException; | |
@Path("/") | |
@Produces(MediaType.TEXT_PLAIN) | |
public class InstrumentedResource { | |
@GET | |
@Timed | |
@Path("/timed") | |
public String timed() { | |
return "yay"; | |
} | |
@GET | |
@Metered | |
@Path("/metered") | |
public String metered() { | |
return "woo"; | |
} | |
@GET | |
@ExceptionMetered(cause = IOException.class) | |
@Path("/exception-metered") | |
public String exceptionMetered(@QueryParam("splode") @DefaultValue("false") boolean splode) throws IOException { | |
if (splode) { | |
throw new IOException("AUGH"); | |
} | |
return "fuh"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment