Skip to content

Commit

Permalink
Fix various errors in writing metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
ajsquared committed Jul 20, 2015
1 parent 1d1ab23 commit 81beec4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,15 @@ private void recordStats() {
recordMemoryUsage("nonheap.total", nonHeap, metrics);

for (GarbageCollectorMXBean gcMXBean : gcMXBeans) {
metrics.put("gc." + gcMXBean.getName() + ".count", gcMXBean.getCollectionCount());
String gcName = gcMXBean.getName().replace(" ", "_");
metrics.put("gc." + gcName + ".count", gcMXBean.getCollectionCount());

final long time = gcMXBean.getCollectionTime();
final long prevTime = gcTimes.get(gcMXBean).get();
final long runtime = time - prevTime;

metrics.put("gc." + gcMXBean.getName() + ".time", time);
metrics.put("gc." + gcMXBean.getName() + ".runtime", runtime);
metrics.put("gc." + gcName + ".time", time);
metrics.put("gc." + gcName + ".runtime", runtime);

if (runtime > 0) gcTimes.get(gcMXBean).set(time);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public void recordGaugeValue(String key, long value) {
public void recordGaugeValues(Map<String, Long> gauges) {
long time = System.currentTimeMillis();
BatchPoints batchPoints = BatchPoints.database(database)
.time(time, TimeUnit.MILLISECONDS)
.build();
for (Map.Entry<String, Long> gauge: gauges.entrySet()) {
batchPoints.point(constructPoint(time, gauge.getKey(), gauge.getValue()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ $(document).ready(function() {

var memoryMetrics = [{metric:'init', alias:'Initial'},{metric:'committed', alias:'Committed'},{metric:'max', alias:'Maximum'},{metric:'used', alias:'Used'}];
var finalizeMetrics = [{metric: finalizePrefix, alias: 'Objects Pending Finalization'}];
var gcCountMetrics = [{metric:'PS MarkSweep.count', alias:'PS MarkSweep'},{metric:'PS Scavenge.count', alias:'PS Scavenge'}];
var gcTimeMetrics = [{metric:'PS MarkSweep.time', alias:'PS MarkSweep'},{metric:'PS Scavenge.time', alias:'PS Scavenge'}];
var gcRuntimeMetrics = [{metric:'PS MarkSweep.runtime', alias:'PS MarkSweep'},{metric:'PS Scavenge.runtime', alias:'PS Scavenge'}];
var gcCountMetrics = [{metric:'PS_MarkSweep.count', alias:'PS_MarkSweep'},{metric:'PS_Scavenge.count', alias:'PS_Scavenge'}];
var gcTimeMetrics = [{metric:'PS_MarkSweep.time', alias:'PS_MarkSweep'},{metric:'PS_Scavenge.time', alias:'PS_Scavenge'}];
var gcRuntimeMetrics = [{metric:'PS_MarkSweep.runtime', alias:'PS_MarkSweep'},{metric:'PS_Scavenge.runtime', alias:'PS_Scavenge'}];

$("#toc ul").append('<li class=toc-h2><a href=/cpu/' + user + '/' + job + '/' + flow + '/' + stage + '/' + phase + '/' + cpuPrefix + ' target=_blank>Flame Graph</a></li>');
$('#toc').affix({
Expand Down

0 comments on commit 81beec4

Please sign in to comment.