Skip to content

Commit

Permalink
Fix input/process/output buffer usage metrics
Browse files Browse the repository at this point in the history
Refs d92c3f0
Fixes #1784
  • Loading branch information
Jochen Schalanda committed Feb 9, 2016
1 parent d451116 commit e9b2a0f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,12 @@ public OutputBuffer(MetricRegistry metricRegistry,
this.ringBufferSize = ringSize;
this.incomingMessages = metricRegistry.meter(name(OutputBuffer.class, "incomingMessages"));

safelyRegister(metricRegistry, GlobalMetricNames.OUTPUT_BUFFER_USAGE, (Gauge<Long>) this::getUsage);
safelyRegister(metricRegistry, GlobalMetricNames.OUTPUT_BUFFER_USAGE, new Gauge<Long>() {
@Override
public Long getValue() {
return OutputBuffer.this.getUsage();
}
});
safelyRegister(metricRegistry, GlobalMetricNames.OUTPUT_BUFFER_SIZE, constantGauge(ringBufferSize));

final ThreadFactory threadFactory = threadFactory(metricRegistry);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,12 @@ public InputBufferImpl(MetricRegistry metricRegistry,
ringBuffer = disruptor.start();

incomingMessages = metricRegistry.meter(name(InputBufferImpl.class, "incomingMessages"));
safelyRegister(metricRegistry, GlobalMetricNames.INPUT_BUFFER_USAGE, (Gauge<Long>) this::getUsage);
safelyRegister(metricRegistry, GlobalMetricNames.INPUT_BUFFER_USAGE, new Gauge<Long>() {
@Override
public Long getValue() {
return InputBufferImpl.this.getUsage();
}
});
safelyRegister(metricRegistry, GlobalMetricNames.INPUT_BUFFER_SIZE, constantGauge(ringBuffer.getBufferSize()));

LOG.info("Initialized {} with ring size <{}> and wait strategy <{}>, running {} parallel message handlers.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,12 @@ public ProcessBuffer(MetricRegistry metricRegistry,

final Timer parseTime = metricRegistry.timer(name(ProcessBuffer.class, "parseTime"));
final Timer decodeTime = metricRegistry.timer(name(ProcessBuffer.class, "decodeTime"));
MetricUtils.safelyRegister(metricRegistry, GlobalMetricNames.PROCESS_BUFFER_USAGE, (Gauge<Long>) this::getUsage);
MetricUtils.safelyRegister(metricRegistry, GlobalMetricNames.PROCESS_BUFFER_USAGE, new Gauge<Long>() {
@Override
public Long getValue() {
return ProcessBuffer.this.getUsage();
}
});
safelyRegister(metricRegistry, GlobalMetricNames.PROCESS_BUFFER_SIZE, constantGauge(ringBufferSize));

final WaitStrategy waitStrategy = getWaitStrategy(waitStrategyName, "processor_wait_strategy");
Expand Down

0 comments on commit e9b2a0f

Please sign in to comment.