com.espertech.esper.epl.metric
Class MetricReportingServiceImpl

java.lang.Object
  extended by com.espertech.esper.epl.metric.MetricReportingServiceImpl
All Implemented Interfaces:
StatementLifecycleObserver, MetricEventRouter, MetricReportingService, MetricReportingServiceSPI

public class MetricReportingServiceImpl
extends java.lang.Object
implements MetricReportingServiceSPI, MetricEventRouter, StatementLifecycleObserver

Metrics reporting.

Reports for all statements even if not in a statement group, i.e. statement in default group.


Constructor Summary
MetricReportingServiceImpl(ConfigurationMetricsReporting specification, java.lang.String engineUri)
          Ctor.
 
Method Summary
 void accountOutput(StatementMetricHandle handle, int numIStream, int numRStream)
          Account for statement output row counting.
 void accountTime(StatementMetricHandle metricsHandle, long deltaCPU, long deltaWall, int numInputEvents)
          Account for statement CPU and wall time.
 void addStatementResultListener(StatementResultListener listener)
          Add stmt result listener.
 void destroy()
          Destroy the service.
 StatementMetricHandle getStatementHandle(java.lang.String statementId, java.lang.String statementName)
          Returns for a new statement a handle for later accounting.
 java.util.concurrent.CopyOnWriteArraySet<StatementResultListener> getStatementOutputHooks()
          Returns output hooks.
 void observe(StatementLifecycleEvent theEvent)
          Observer statement state changes.
 void processTimeEvent(long timeEventTime)
          Indicates current engine time.
 void removeStatementResultListener(StatementResultListener listener)
          Remove stmt result listener.
 void route(MetricEvent metricEvent)
          Process metric event.
 void setContext(EPRuntime runtime, EPServicesContext servicesContext)
          Sets runtime and services.
 void setMetricsReportingDisabled()
          Disables metrics reporting globally.
 void setMetricsReportingEnabled()
          Enables metrics reporting globally.
 void setMetricsReportingInterval(java.lang.String stmtGroupName, long newInterval)
          Change the reporting interval for the given statement group name.
 void setMetricsReportingStmtDisabled(java.lang.String statementName)
          Disable metrics reporting for statement.
 void setMetricsReportingStmtEnabled(java.lang.String statementName)
          Enable metrics reporting for statement.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MetricReportingServiceImpl

public MetricReportingServiceImpl(ConfigurationMetricsReporting specification,
                                  java.lang.String engineUri)
Ctor.

Parameters:
specification - configuration
engineUri - engine URI
Method Detail

addStatementResultListener

public void addStatementResultListener(StatementResultListener listener)
Description copied from interface: MetricReportingServiceSPI
Add stmt result listener.

Specified by:
addStatementResultListener in interface MetricReportingServiceSPI
Parameters:
listener - to add

removeStatementResultListener

public void removeStatementResultListener(StatementResultListener listener)
Description copied from interface: MetricReportingServiceSPI
Remove stmt result listener.

Specified by:
removeStatementResultListener in interface MetricReportingServiceSPI
Parameters:
listener - to remove

getStatementOutputHooks

public java.util.concurrent.CopyOnWriteArraySet<StatementResultListener> getStatementOutputHooks()
Description copied from interface: MetricReportingServiceSPI
Returns output hooks.

Specified by:
getStatementOutputHooks in interface MetricReportingServiceSPI
Returns:
hooks.

setContext

public void setContext(EPRuntime runtime,
                       EPServicesContext servicesContext)
Description copied from interface: MetricReportingService
Sets runtime and services.

Specified by:
setContext in interface MetricReportingService
Parameters:
runtime - runtime
servicesContext - services

processTimeEvent

public void processTimeEvent(long timeEventTime)
Description copied from interface: MetricReportingService
Indicates current engine time.

Specified by:
processTimeEvent in interface MetricReportingService
Parameters:
timeEventTime - engine time

destroy

public void destroy()
Description copied from interface: MetricReportingService
Destroy the service.

Specified by:
destroy in interface MetricReportingService

route

public void route(MetricEvent metricEvent)
Description copied from interface: MetricEventRouter
Process metric event.

Specified by:
route in interface MetricEventRouter
Parameters:
metricEvent - metric event to process

accountTime

public void accountTime(StatementMetricHandle metricsHandle,
                        long deltaCPU,
                        long deltaWall,
                        int numInputEvents)
Description copied from interface: MetricReportingService
Account for statement CPU and wall time.

Specified by:
accountTime in interface MetricReportingService
Parameters:
metricsHandle - statement handle
deltaCPU - cpu time nsec
deltaWall - wall time nsec

accountOutput

public void accountOutput(StatementMetricHandle handle,
                          int numIStream,
                          int numRStream)
Description copied from interface: MetricReportingService
Account for statement output row counting.

Specified by:
accountOutput in interface MetricReportingService
Parameters:
handle - statement handle
numIStream - number of insert stream rows
numRStream - number of remove stream rows

getStatementHandle

public StatementMetricHandle getStatementHandle(java.lang.String statementId,
                                                java.lang.String statementName)
Description copied from interface: MetricReportingService
Returns for a new statement a handle for later accounting.

Specified by:
getStatementHandle in interface MetricReportingService
Parameters:
statementId - statement id
statementName - statement name
Returns:
handle

observe

public void observe(StatementLifecycleEvent theEvent)
Description copied from interface: StatementLifecycleObserver
Observer statement state changes.

Specified by:
observe in interface StatementLifecycleObserver
Parameters:
theEvent - indicates statement changed

setMetricsReportingInterval

public void setMetricsReportingInterval(java.lang.String stmtGroupName,
                                        long newInterval)
Description copied from interface: MetricReportingService
Change the reporting interval for the given statement group name.

Specified by:
setMetricsReportingInterval in interface MetricReportingService
Parameters:
stmtGroupName - group name
newInterval - new interval, or zero or negative value to disable reporting

setMetricsReportingStmtDisabled

public void setMetricsReportingStmtDisabled(java.lang.String statementName)
                                     throws ConfigurationException
Description copied from interface: MetricReportingService
Disable metrics reporting for statement.

Specified by:
setMetricsReportingStmtDisabled in interface MetricReportingService
Parameters:
statementName - statement name
Throws:
ConfigurationException

setMetricsReportingStmtEnabled

public void setMetricsReportingStmtEnabled(java.lang.String statementName)
                                    throws ConfigurationException
Description copied from interface: MetricReportingService
Enable metrics reporting for statement.

Specified by:
setMetricsReportingStmtEnabled in interface MetricReportingService
Parameters:
statementName - statement name
Throws:
ConfigurationException

setMetricsReportingEnabled

public void setMetricsReportingEnabled()
Description copied from interface: MetricReportingService
Enables metrics reporting globally.

Specified by:
setMetricsReportingEnabled in interface MetricReportingService

setMetricsReportingDisabled

public void setMetricsReportingDisabled()
Description copied from interface: MetricReportingService
Disables metrics reporting globally.

Specified by:
setMetricsReportingDisabled in interface MetricReportingService

© 2006-2015 EsperTech Inc.
All rights reserved.
Visit us at espertech.com