public class SourceMetricsImpl extends Object implements PreFederatedQueryPlugin, PostFederatedQueryPlugin
CatalogProvider
and FederatedSource
Source
s. These metrics currently include the count of queries, results per query, and
exceptions per Source
.
The metrics and their associated JmxCollector
s are created when
the Source
is created and deleted when the Source
is deleted. (The associated RRD
file remains available indefinitely and accessible from the Metrics tab in the Web Admin console
unless an administrator manually deletes it).
If a Source
is renamed, i.e., its ID changed, then the Source
's existing
metrics' MBeans and JmxCollector
s are deleted and new metrics
created using the new Source
's ID. However, the RRD file for the Source
's
previous source ID remains available and accessible from the Metrics tab in the Web Admin console
unless an administrator manually deletes it.
Modifier and Type | Class and Description |
---|---|
static class |
SourceMetricsImpl.SourceMetric
Inner class POJO to maintain details of each metric for each Source.
|
Modifier and Type | Field and Description |
---|---|
static String |
COUNT_MBEAN_ATTRIBUTE_NAME |
static String |
DERIVE_DATA_SOURCE_TYPE |
static String |
EXCEPTIONS_SCOPE
Name of the JMX MBean scope for source-level metrics tracking exceptions while querying a
specific
Source |
static String |
GAUGE_DATA_SOURCE_TYPE |
static String |
MBEAN_PACKAGE_NAME
Package name for the JMX MBean where metrics for
Source s are stored. |
static String |
MEAN_MBEAN_ATTRIBUTE_NAME |
protected Map<String,SourceMetricsImpl.SourceMetric> |
metrics |
static String |
QUERIES_SCOPE
Name of the JMX MBean scope for source-level metrics tracking query count while querying a
specific
Source |
static String |
QUERIES_TOTAL_RESULTS_SCOPE
Name of the JMX MBean scope for source-level metrics tracking total results returned while
querying a specific
Source |
Constructor and Description |
---|
SourceMetricsImpl() |
Modifier and Type | Method and Description |
---|---|
void |
addingSource(Source source,
Map props)
Creates metrics for new CatalogProvider or FederatedSource when they are initially created.
|
void |
deletingSource(Source source,
Map props)
Deletes metrics for existing CatalogProvider or FederatedSource when they are deleted.
|
void |
destroy() |
List<CatalogProvider> |
getCatalogProviders() |
List<FederatedSource> |
getFederatedSources() |
protected String |
getRrdFilename(String sourceId,
String collectorName) |
void |
init() |
QueryResponse |
process(QueryResponse input)
Processes a
QueryResponse after the execution of the Federated Query . |
QueryRequest |
process(Source source,
QueryRequest input)
Processes a
QueryRequest prior to execution of the Federated Query . |
void |
setCatalogProviders(List<CatalogProvider> catalogProviders) |
void |
setFederatedSources(List<FederatedSource> federatedSources) |
void |
updateMetric(String sourceId,
String name,
int incrementAmount) |
public static final String MBEAN_PACKAGE_NAME
Source
s are stored.public static final String EXCEPTIONS_SCOPE
Source
public static final String QUERIES_SCOPE
Source
public static final String QUERIES_TOTAL_RESULTS_SCOPE
Source
public static final String DERIVE_DATA_SOURCE_TYPE
public static final String GAUGE_DATA_SOURCE_TYPE
public static final String COUNT_MBEAN_ATTRIBUTE_NAME
public static final String MEAN_MBEAN_ATTRIBUTE_NAME
protected Map<String,SourceMetricsImpl.SourceMetric> metrics
public List<CatalogProvider> getCatalogProviders()
public void setCatalogProviders(List<CatalogProvider> catalogProviders)
public List<FederatedSource> getFederatedSources()
public void setFederatedSources(List<FederatedSource> federatedSources)
public void init()
public void destroy()
public QueryRequest process(Source source, QueryRequest input) throws PluginExecutionException, StopProcessingException
PreFederatedQueryPlugin
QueryRequest
prior to execution of the Federated Query
.process
in interface PreFederatedQueryPlugin
source
- the Source
the query will be sent toinput
- the QueryRequest
to processQueryRequest
to pass to the next PreFederatedQueryPlugin
, or if this is the last PreFederatedQueryPlugin
to be
calledPluginExecutionException
- thrown when an error occurs while processing the QueryRequest
StopProcessingException
- thrown to halt processing when a critical issue occurs during
processing. This is intended to prevent other plugins from processing as well.public QueryResponse process(QueryResponse input) throws PluginExecutionException, StopProcessingException
PostFederatedQueryPlugin
QueryResponse
after the execution of the Federated Query
.process
in interface PostFederatedQueryPlugin
input
- the Federated QueryResponse
to processQueryResponse
to pass to the next PostFederatedQueryPlugin
, or if this is the last PostFederatedQueryPlugin
to be
calledPluginExecutionException
- thrown when an error occurs while processing the QueryResponse
StopProcessingException
- thrown to halt processing when a critical issue occurs during
processing. This is intended to prevent other plugins from processing as well.public void addingSource(Source source, Map props)
source
- props
- public void deletingSource(Source source, Map props)
source
- props
- This work is licensed under a Creative Commons Attribution 4.0 International License.