Skip to content
This repository has been archived by the owner on Jan 18, 2018. It is now read-only.

jeluard/metrics-perf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

An extension to Yammer Metrics exposing meters as Hotspot perf counters

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages