Last active
June 9, 2017 02:05
-
-
Save johann8384/9934eee058610ec7dc6b282d76cee5dc to your computer and use it in GitHub Desktop.
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
/* | |
* Set Meters for Important Events | |
*/ | |
Metrics.markMeter(Metrics.name("requests", "ended")); | |
/* | |
* Counters are simple, you can inc/dec them. | |
*/ | |
Metrics.incCounter(Metrics.name("metricstats", tenantId, "valid")); | |
/* | |
* Creates the timer context and starts it, then call stop to stop it. | |
*/ | |
Metrics.getTimerContext(Metric.name("discoverobjects", "total")); | |
Metrics.getTimerContext(Metric.name("discoverobjects", "total")).stop(); | |
/* | |
* Register a gauge by passing an atomiclong/integer which will be reported | |
*/ | |
AtomicLong numberOfItems = new AtomicLong(); | |
numberOfItems.incrementAndGet(); | |
Metrics.registerGauge(Metric.name("numberofitems", "total"), numberOfItems); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment