org.apache.lens.server.api.metrics
Class MethodMetricGauge

java.lang.Object
  extended by org.apache.lens.server.api.metrics.MethodMetricGauge
All Implemented Interfaces:
MethodMetricsContext

public class MethodMetricGauge
extends Object
implements MethodMetricsContext

Holds the gauge value indicating the time taken for the method. When we have methods which can take variable time with respect to the parameters passed, the timers available in MethodMetrics (which aggregated values over all calls) does not provide information on how each call performed. Having gauge for each call will solve the purpose, which resulted in this class. The gauge added here should be created with unique name for each call so that the gauges are not lost to the latest calls.


Constructor Summary
MethodMetricGauge(com.codahale.metrics.MetricRegistry metricRegistry, String gaugeName)
          The gauge for method time.
 
Method Summary
 void markError()
          Error came.
 void markSuccess()
          Method succeeded.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MethodMetricGauge

public MethodMetricGauge(@NonNull
                         com.codahale.metrics.MetricRegistry metricRegistry,
                         @NonNull
                         String gaugeName)
The gauge for method time.

Parameters:
metricRegistry - The metric registry
gaugeName - Gauge name. It should be unique for each creation. Callers have to take care of passing unique name
Method Detail

markError

public void markError()
Description copied from interface: MethodMetricsContext
Error came. Mark it.

Specified by:
markError in interface MethodMetricsContext

markSuccess

public void markSuccess()
Description copied from interface: MethodMetricsContext
Method succeeded. mark it.

Specified by:
markSuccess in interface MethodMetricsContext


Copyright © 2014–2015 Apache Software Foundation. All rights reserved.