Skip to content

Instantly share code, notes, and snippets.

@Arnonrgo
Created April 1, 2013 05:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Arnonrgo/5283401 to your computer and use it in GitHub Desktop.
Save Arnonrgo/5283401 to your computer and use it in GitHub Desktop.
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