org.apache.lens.server.metrics
Class MetricsServiceImpl

java.lang.Object
  extended by org.apache.hive.service.AbstractService
      extended by org.apache.lens.server.metrics.MetricsServiceImpl
All Implemented Interfaces:
org.apache.hive.service.Service, MetricsService

public class MetricsServiceImpl
extends org.apache.hive.service.AbstractService
implements MetricsService

The Class MetricsServiceImpl.


Nested Class Summary
 class MetricsServiceImpl.AsyncQueryStatusListener
          The listener interface for receiving asyncQueryStatus events.
 
Nested classes/interfaces inherited from interface org.apache.hive.service.Service
org.apache.hive.service.Service.STATE
 
Field Summary
static org.apache.log4j.Logger LOG
          The Constant LOG.
 
Fields inherited from interface org.apache.lens.server.api.metrics.MetricsService
ACCEPTED_QUERIES, CANCELLED_QUERIES, FAILED_QUERIES, FINISHED_QUERIES, NAME, QUEUED_QUERIES, RUNNING_QUERIES
 
Constructor Summary
MetricsServiceImpl(String name)
          Instantiates a new metrics service impl.
 
Method Summary
 void decrCounter(Class<?> cls, String counter)
          Decrement a counter with the name costructed using given class and counter name Actual name of the counter will be

 void decrCounter(String counter)
          Decrement a counter with the given name Actual name of the counter will be

 long getCounter(Class<?> cls, String counter)
          Get current value of the counter.
 long getCounter(String counter)
          Get current value of the counter.
 long getFinishedQueries()
           
 MethodMetricsContext getMethodMetricsContext(org.glassfish.jersey.server.model.ResourceMethod method, org.glassfish.jersey.server.ContainerRequest containerRequest)
          Called by LensRequestListener in start event.
 long getQueuedQueries()
           
 long getRunningQueries()
           
 long getTotalAcceptedQueries()
           
 long getTotalCancelledQueries()
           
 long getTotalFailedQueries()
           
 long getTotalFinishedQueries()
           
 long getTotalSuccessfulQueries()
           
 void incrCounter(Class<?> cls, String counter)
          Increment a counter with the name constructed using given class and counter name Actual name of the counter will be

 void incrCounter(String counter)
          Increment a counter with the given name Actual name of the counter will be

 void init(org.apache.hadoop.hive.conf.HiveConf hiveConf)
           
 void publishReport()
          Publish report.
 void setEnableResourceMethodMetering(boolean enableResourceMethodMetering)
           
 void start()
           
 void stop()
           
 
Methods inherited from class org.apache.hive.service.AbstractService
getHiveConf, getName, getServiceState, getStartTime, register, unregister
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

public static final org.apache.log4j.Logger LOG
The Constant LOG.

Constructor Detail

MetricsServiceImpl

public MetricsServiceImpl(String name)
Instantiates a new metrics service impl.

Parameters:
name - the name
Method Detail

setEnableResourceMethodMetering

public void setEnableResourceMethodMetering(boolean enableResourceMethodMetering)

init

public void init(org.apache.hadoop.hive.conf.HiveConf hiveConf)
Specified by:
init in interface org.apache.hive.service.Service
Overrides:
init in class org.apache.hive.service.AbstractService

getMethodMetricsContext

public MethodMetricsContext getMethodMetricsContext(org.glassfish.jersey.server.model.ResourceMethod method,
                                                    org.glassfish.jersey.server.ContainerRequest containerRequest)
Called by LensRequestListener in start event. marks the method meter, starts a timer, returns timer context returned by the start timer call.

Specified by:
getMethodMetricsContext in interface MetricsService
Parameters:
method - the resource method
containerRequest - container request
Returns:
See Also:
MetricsService.getMethodMetricsContext( org.glassfish.jersey.server.model.ResourceMethod, org.glassfish.jersey.server.ContainerRequest)

start

public void start()
Specified by:
start in interface org.apache.hive.service.Service
Overrides:
start in class org.apache.hive.service.AbstractService

stop

public void stop()
Specified by:
stop in interface org.apache.hive.service.Service
Overrides:
stop in class org.apache.hive.service.AbstractService

incrCounter

public void incrCounter(String counter)
Description copied from interface: MetricsService
Increment a counter with the given name Actual name of the counter will be

MetricRegistry.name(MetricsService.class, counter)
 

Specified by:
incrCounter in interface MetricsService
Parameters:
counter - the counter

decrCounter

public void decrCounter(String counter)
Description copied from interface: MetricsService
Decrement a counter with the given name Actual name of the counter will be

MetricRegistry.name(MetricsService.class, counter)
 

Specified by:
decrCounter in interface MetricsService
Parameters:
counter - the counter

incrCounter

public void incrCounter(Class<?> cls,
                        String counter)
Description copied from interface: MetricsService
Increment a counter with the name constructed using given class and counter name Actual name of the counter will be

MetricRegistry.name(cls, counter)
 

Specified by:
incrCounter in interface MetricsService
Parameters:
cls - Class of the counter for namespacing the counter
counter - the counter

decrCounter

public void decrCounter(Class<?> cls,
                        String counter)
Description copied from interface: MetricsService
Decrement a counter with the name costructed using given class and counter name Actual name of the counter will be

MetricRegistry.name(cls, counter)
 

Specified by:
decrCounter in interface MetricsService
Parameters:
cls - Class of the counter for namespacing of counters
counter - the counter

getCounter

public long getCounter(String counter)
Description copied from interface: MetricsService
Get current value of the counter.

Specified by:
getCounter in interface MetricsService
Parameters:
counter - the counter
Returns:
the counter

getCounter

public long getCounter(Class<?> cls,
                       String counter)
Description copied from interface: MetricsService
Get current value of the counter.

Specified by:
getCounter in interface MetricsService
Parameters:
cls - the cls
counter - the counter
Returns:
the counter

getQueuedQueries

public long getQueuedQueries()
Specified by:
getQueuedQueries in interface MetricsService

getRunningQueries

public long getRunningQueries()
Specified by:
getRunningQueries in interface MetricsService

getFinishedQueries

public long getFinishedQueries()
Specified by:
getFinishedQueries in interface MetricsService

getTotalAcceptedQueries

public long getTotalAcceptedQueries()
Specified by:
getTotalAcceptedQueries in interface MetricsService

getTotalFinishedQueries

public long getTotalFinishedQueries()
Specified by:
getTotalFinishedQueries in interface MetricsService

getTotalCancelledQueries

public long getTotalCancelledQueries()
Specified by:
getTotalCancelledQueries in interface MetricsService

getTotalFailedQueries

public long getTotalFailedQueries()
Specified by:
getTotalFailedQueries in interface MetricsService

publishReport

public void publishReport()
Description copied from interface: MetricsService
Publish report.

Specified by:
publishReport in interface MetricsService

getTotalSuccessfulQueries

public long getTotalSuccessfulQueries()
Specified by:
getTotalSuccessfulQueries in interface MetricsService


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