use of com.yammer.metrics.core.MetricName in project pinot by linkedin.
the class AbstractMetrics method addCallbackGauge.
/**
* Adds a new gauge whose values are retrieved from a callback function.
*
* @param metricName The name of the metric
* @param valueCallback The callback function used to retrieve the value of the gauge
*/
public void addCallbackGauge(final String metricName, final Callable<Long> valueCallback) {
MetricsHelper.newGauge(_metricsRegistry, new MetricName(_clazz, _metricPrefix + metricName), new com.yammer.metrics.core.Gauge<Long>() {
@Override
public Long value() {
try {
return valueCallback.call();
} catch (Exception e) {
LOGGER.error("Caught exception", e);
Utils.rethrowException(e);
throw new AssertionError("Should not reach this");
}
}
});
}
use of com.yammer.metrics.core.MetricName in project pinot by linkedin.
the class AbstractMetrics method addMeteredTableValue.
/**
* Logs a value to a table-level meter.
*
* @param tableName The table name
* @param meter The meter to use
* @param unitCount The number of units to add to the meter
*/
public void addMeteredTableValue(final String tableName, final M meter, final long unitCount) {
final String fullMeterName;
String meterName = meter.getMeterName();
fullMeterName = _metricPrefix + getTableName(tableName) + "." + meterName;
final MetricName metricName = new MetricName(_clazz, fullMeterName);
MetricsHelper.newMeter(_metricsRegistry, metricName, meter.getUnit(), TimeUnit.SECONDS).mark(unitCount);
}
use of com.yammer.metrics.core.MetricName in project bagheera by mozilla-metrics.
the class HttpMetric method updateRequestMetrics.
public void updateRequestMetrics(String method, int contentSize) {
requests.mark();
throughput.mark(contentSize);
if (methods.containsKey(method)) {
methods.get(method).mark();
} else {
Meter methodMeter = Metrics.newMeter(new MetricName(DEFAULT_GROUP, DEFAULT_TYPE, this.id + ".method." + method), "requests", TimeUnit.SECONDS);
methodMeter.mark();
methods.put(method, methodMeter);
}
}
use of com.yammer.metrics.core.MetricName in project bagheera by mozilla-metrics.
the class HttpMetric method updateResponseMetrics.
public void updateResponseMetrics(int status) {
if (responseCodeCounts.containsKey(status)) {
responseCodeCounts.get(status).inc();
} else {
Counter statusCounter = Metrics.newCounter(new MetricName(DEFAULT_GROUP, DEFAULT_TYPE, this.id + ".response." + status));
statusCounter.inc();
responseCodeCounts.put(status, statusCounter);
}
}
use of com.yammer.metrics.core.MetricName in project platformlayer by platformlayer.
the class CodahaleMetricRegistry method getCounter.
@Override
public MetricMeter getCounter(MetricKey metricKey) {
MetricName metricName = toMetricName(metricKey);
String eventType = "events";
return new MetricMeterAdapter(registry.newMeter(metricName, eventType, TimeUnit.SECONDS));
}
Aggregations