/** * Logs the timing for a global timer */ public void addTimedValue(T timer, final long duration, final TimeUnit timeUnit) { final String fullTimerName = _metricPrefix + timer.getTimerName(); addValueToTimer(fullTimerName, duration, timeUnit); }
/** * Creates a new {@link AggregatedCounter} and registers it under the given metric name. * * @param metricName the name of the metric * @return a new {@link AggregatedCounter} */ public AggregatedCounter newAggregatedCounter(MetricName metricName) { return getOrAdd(metricName, new AggregatedCounter()); }
/** * Creates a new {@link AggregatedLongGauge} and registers it under the given metric name. * * @param metricName the name of the metric * @return a new {@link AggregatedLongGauge} */ public <T extends Number, V extends Gauge<T>> AggregatedLongGauge<T, V> newAggregatedLongGauge( MetricName metricName) { return getOrAdd(metricName, new AggregatedLongGauge<T, V>()); } }
/** * Creates a new {@link AggregatedHistogram} and registers it under the given metric name. * * @param metricName the name of the metric * @return a new {@link AggregatedHistogram} */ public <T extends Sampling> AggregatedHistogram<T> newAggregatedHistogram(MetricName metricName) { return getOrAdd(metricName, new AggregatedHistogram<T>()); }
public com.yammer.metrics.core.Meter getMeteredTableValue(final String tableName, final M meter) { final String fullMeterName; String meterName = meter.getMeterName(); fullMeterName = _metricPrefix + getTableName(tableName) + "." + meterName; final MetricName metricName = new MetricName(_clazz, fullMeterName); return MetricsHelper.newMeter(_metricsRegistry, metricName, meter.getUnit(), TimeUnit.SECONDS); }
/** * Remove AggregatedTransportClientMetrics to aggregated metrics * @param metric metric to be be removed */ public void removeTransportClientMetrics(AggregatedTransportClientMetrics metric) { _requestsSent.remove(metric.getRequestsSent()); _bytesSent.remove(metric.getBytesSent()); _bytesReceived.remove(metric.getBytesReceived()); _errors.remove(metric.getErrors()); _connectMsGauge.remove(metric.getConnectMsGauge()); _sendRequestMsHistogram.remove(metric.getSendRequestMsHistogram()); _responseLatencyMsHistogram.remove(metric.getResponseLatencyMsHistogram()); }
/** * Logs the timing of a query phase. * * @param request The broker request associated with this query * @param phase The query phase for which to log time * @param duration The duration that the phase execution took to complete * @param timeUnit The time unit of the duration */ public void addPhaseTiming(BrokerRequest request, QP phase, long duration, TimeUnit timeUnit) { String fullTimerName = buildMetricName(request, phase.getQueryPhaseName()); addValueToTimer(fullTimerName, duration, timeUnit); }
/** * Logs the timing for a table * * @param tableName The table associated with this timer * @param timer The name of timer * @param duration The log time duration time value * @param timeUnit The log time duration time unit */ public void addTimedTableValue(final String tableName, T timer, final long duration, final TimeUnit timeUnit) { final String fullTimerName = _metricPrefix + getTableName(tableName) + "." + timer.getTimerName(); addValueToTimer(fullTimerName, duration, timeUnit); }
public void addPhaseTiming(String tableName, QP phase, long duration, TimeUnit timeUnit) { String fullTimerName = _metricPrefix + getTableName(tableName) + "." + phase.getQueryPhaseName(); addValueToTimer(fullTimerName, duration, timeUnit); }
/** * Sets the value of a table gauge. * * @param tableName The table name * @param gauge The gauge to use * @param value The value to set the gauge to */ public void setValueOfTableGauge(final String tableName, final G gauge, final long value) { final String fullGaugeName; String gaugeName = gauge.getGaugeName(); fullGaugeName = gaugeName + "." + getTableName(tableName); setValueOfGauge(value, fullGaugeName); }
/** * Updates the missing segment count gauge. * * @param resource The resource for which the gauge is updated * @param missingSegmentCount The number of missing segments */ public void updateMissingSegmentCountGauge(final String resource, final int missingSegmentCount) { final String fullGaugeName = makeGaugeName(resource, "missingSegmentCount"); makeGauge(fullGaugeName, makeMetricName(fullGaugeName), _storedValueGaugeFactory, missingSegmentCount); }
/** * Sets the value of a global gauge. * * @param gauge The gauge to use * @param value The value to set the gauge to */ public void setValueOfGlobalGauge(final G gauge, final long value) { final String gaugeName = gauge.getGaugeName(); setValueOfGauge(value, gaugeName); }
/** * Creates a new {@link AggregatedMeter} and registers it under the given metric name. * * @param metricName the name of the metric * @return a new {@link AggregatedMeter} */ public <T extends Metered & Stoppable> AggregatedMeter<T> newAggregatedMeter(MetricName metricName) { return getOrAdd(metricName, new AggregatedMeter<T>()); }
@Override public Snapshot getSnapshot() { refreshIfElapsed(); return _snapshot; }
@Override public double fifteenMinuteRate() { refreshIfElapsed(); return _fifteenMinRate; }
/** * Returns the counter's current value. * * @return the counter's current value */ public long count() { refreshIfElapsed(); return _count; }
/** * Remove NettyClientMetrics to aggregated metrics * @param metric metric to be be removed */ public void removeTransportClientMetrics(NettyClientMetrics metric) { _requestsSent.remove(metric.getRequestsSent()); _bytesSent.remove(metric.getBytesSent()); _bytesReceived.remove(metric.getBytesReceived()); _errors.remove(metric.getErrors()); _connectMsGauge.remove(metric.getConnectMsGauge()); _sendRequestMsHistogram.remove(metric.getSendRequestMsHistogram()); _responseLatencyMsHistogram.remove(metric.getResponseLatencyMsHistogram()); }
/** * Sets the value of a custom global gauge. * * @param suffix The suffix to attach to the gauge name * @param gauge The gauge to use * @param value The value to set the gauge to */ public void setValueOfGlobalGauge(final G gauge, final String suffix, final long value) { final String fullGaugeName; String gaugeName = gauge.getGaugeName(); fullGaugeName = gaugeName + "." + suffix; setValueOfGauge(value, fullGaugeName); }
@Override public double min() { refreshIfElapsed(); return _min; }
@Override public double stdDev() { refreshIfElapsed(); return _stdDev; }