Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
An extension to Yammer Metrics exposing meters as Hotspot perf counters
Java
Branch: master
Failed to load latest commit information.
src/main/java/com/github/jeluard/metrics/perf Added Histogram/Metered support.
.gitignore initial commit
README.md
pom.xml [maven-release-plugin] prepare for next development iteration

README.md

metrics-perf is a tiny extension to yammer's metrics library exporting all metrics as Hotspot perf counters.

You can safely use this on a non-Hotspot VM as all Hotspot specific calls are done via reflection (i.e. no static import) and only executed if a compliant VM is detected.

Usage

To export all your metrics simply add this code:

final PerfReporter reporter = new PerfReporter(Metrics.defaultRegistry());
reporter.start(1, TimeUnit.SECONDS);

All perf counters values will then be updated every seconds.

Maven dependency

Add following dependency to your pom.xml:

...
  <dependency>
    <groupId>com.github.jeluard</groupId>
    <artifactId>metrics-perf</artifactId>
    <version>0.9</version>
  </dependency>
...

Visualizing

Perf counters can be visualized by mainly 2 tools: VisualVM and jstat.

Using VisualVM

VisualVM can visualize perf counters via the tracer plugin.

Tracer plugin

Using JStat

jstat is a command line tool allowing to track perf counter values.

List all perf counters:

jstat -J-Djstat.showUnsupported=true -list <vmid>

List all exported metrics:

jstat -J-Djstat.showUnsupported=true -snap -name metric.\* <vmid>

Print current value of a particular metric:

jstat -J-Djstat.showUnsupported=true -snap -name metric.metric-name.15min-rate <vmid>

Sample value of a specific metric every 1 second:

jstat -J-Djstat.showUnsupported=true  -name metric.metric-name.15min-rate <vmid> 1s

You can find all jstat options (including non-documented) by browsing its source code.

Something went wrong with that request. Please try again.