Skip to content

Instantly share code, notes, and snippets.

@monkey-codes
Created June 4, 2018 01:43
Show Gist options
  • Select an option

  • Save monkey-codes/8bf33c4d905ae4da45a6a6212b8da550 to your computer and use it in GitHub Desktop.

Select an option

Save monkey-codes/8bf33c4d905ae4da45a6a6212b8da550 to your computer and use it in GitHub Desktop.
@Override
T read() {
namespace.push("read")
def timer = metricRegistry.timer(namespace.name()).time()
try {
T result = delegate.read()
if (result != null) timer.stop()
result
} catch (all) {
metricRegistry.counter("${namespace}.error").inc()
throw all
} finally {
namespace.pop()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment