Created
July 17, 2015 12:28
-
-
Save splatch/97445758438d92af8da8 to your computer and use it in GitHub Desktop.
Gather metrics using codahale stuff
This file contains 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
Counter failCounter = new Counter(); | |
Counter successCounter = new Counter(); | |
Timer timer = new Timer(); | |
@Override | |
public Y transform(X x) { | |
Timer.Context time = timer.time(); | |
try { | |
Y transform = delegate.transform(x); | |
successCounter.inc(); | |
return transform; | |
} catch (Exception e) { | |
failCounter.inc(); | |
throw e; | |
} finally { | |
time.stop(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment