{"action":"created","issue":{"url":"https://api.github.com/repos/dropwizard/metrics/issues/1153","repository_url":"https://api.github.com/repos/dropwizard/metrics","labels_url":"https://api.github.com/repos/dropwizard/metrics/issues/1153/labels{/name}","comments_url":"https://api.github.com/repos/dropwizard/metrics/issues/1153/comments","events_url":"https://api.github.com/repos/dropwizard/metrics/issues/1153/events","html_url":"https://github.com/dropwizard/metrics/issues/1153","id":239432863,"number":1153,"title":"Multiple @ExceptionMetered annotations on the same method?","user":{"login":"dougbacelar","id":9267678,"avatar_url":"https://avatars0.githubusercontent.com/u/9267678?v=3","gravatar_id":"","url":"https://api.github.com/users/dougbacelar","html_url":"https://github.com/dougbacelar","followers_url":"https://api.github.com/users/dougbacelar/followers","following_url":"https://api.github.com/users/dougbacelar/following{/other_user}","gists_url":"https://api.github.com/users/dougbacelar/gists{/gist_id}","starred_url":"https://api.github.com/users/dougbacelar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dougbacelar/subscriptions","organizations_url":"https://api.github.com/users/dougbacelar/orgs","repos_url":"https://api.github.com/users/dougbacelar/repos","events_url":"https://api.github.com/users/dougbacelar/events{/privacy}","received_events_url":"https://api.github.com/users/dougbacelar/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-06-29T10:24:23Z","updated_at":"2017-06-29T19:10:55Z","closed_at":null,"body":"I have a controller that can throw two different exceptions.\r\n\r\n**Groovy code:**\r\n\r\n\r\n    ResponseEntity<Response> testController(@RequestParam(value = 'test', required = true) String test) throws Exception {\r\n\r\n        if(validationError()){\r\n            throw new ValidationException ('failed to validate request')\r\n        }\r\n        //more code\r\n        if(resourceNotFound()){\r\n            throw new ResourceNotFoundException('could not find any results for the given parameter')\r\n        }\r\n    }\r\n\r\n\r\nI want to keep metrics for both of these exceptions separately. As one is a `ValidationException` and the other a `ResourceNotFoundException`, there would not be much point to let the annotation group them together...\r\n\r\nI am able to store one of them with the following code:\r\n`@ExceptionMetered(name = \"ResourceNotFoundException\", absolute = true, cause = ResourceNotFoundException)`\r\n\r\nHowever if I try to add another  `@ExceptionMetered` annotation to the same method I get an error as the annotation is not Repeatable.\r\n\r\nI also tried to create a new method that will throw the validation exception and annotate this new method with the `@ExceptionMetered` instead. \r\n\r\nHowever this does not work either, the first exception is recorded fine but the second is always 0, doesn't matter how many times I trigger it.\r\n\r\n**Question: How to keep track of multiple exceptions separately? Is this just not possible?**\r\n\r\nThank you!\r\n"},"comment":{"url":"https://api.github.com/repos/dropwizard/metrics/issues/comments/312070752","html_url":"https://github.com/dropwizard/metrics/issues/1153#issuecomment-312070752","issue_url":"https://api.github.com/repos/dropwizard/metrics/issues/1153","id":312070752,"user":{"login":"ryanrupp","id":3022260,"avatar_url":"https://avatars2.githubusercontent.com/u/3022260?v=3","gravatar_id":"","url":"https://api.github.com/users/ryanrupp","html_url":"https://github.com/ryanrupp","followers_url":"https://api.github.com/users/ryanrupp/followers","following_url":"https://api.github.com/users/ryanrupp/following{/other_user}","gists_url":"https://api.github.com/users/ryanrupp/gists{/gist_id}","starred_url":"https://api.github.com/users/ryanrupp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryanrupp/subscriptions","organizations_url":"https://api.github.com/users/ryanrupp/orgs","repos_url":"https://api.github.com/users/ryanrupp/repos","events_url":"https://api.github.com/users/ryanrupp/events{/privacy}","received_events_url":"https://api.github.com/users/ryanrupp/received_events","type":"User","site_admin":false},"created_at":"2017-06-29T19:10:55Z","updated_at":"2017-06-29T19:10:55Z","body":"That works! I wasn't sure if you needed the exception counts to be sliced by the controller that caused them or not."}}
{"actor":{"display_login":"ryanrupp"}}