public class ESMetricsCollector extends Object implements XMetricsCollector
Constructor and Description |
---|
ESMetricsCollector(ESStatisticsPublisher esStatisticsPublisher) |
Modifier and Type | Method and Description |
---|---|
void |
addCompletedTemplate(MetricsTemplate metricsTemplate) |
void |
addToMetricsWindow(MetricsTemplate metricsTemplate)
Add given primary and secondary
MetricsTemplate objects to the metrics template map in the metrics engine |
void |
computeStream(MetricsStream metricsStream,
MetricsStreamNames.MetricsRecordType type,
String templateType,
MetricsStreamNames.StreamCreationType streamCreationType,
String entityId,
String projectID,
String projectVersion,
String flowID,
Map<String,String> additionalProps)
Handles the stream creation logic related to elasticsearch metrics collecting process
|
void |
decrement(String entityId,
int stream)
Decrements the given counter type stream of the entity with the given entityId
|
void |
decrementCounterMap(String entityId,
int stream,
String key)
Decrements the counter map record value for the given key of the entity which is given by the entityId
and the stream which is given by the stream
|
void |
destroy()
Cleans out the resources used by the metrics engine and destroys the engine
|
void |
generateRecords()
Generates statistic records which are collected by the metrics engine.
|
int |
getMetricsReportGenerationTimePeriod() |
int |
getMetricsTemplateSyncTimePeriod() |
String |
getNodeName() |
long |
getPrimaryTemplateLifeTime() |
void |
increment(String entityId,
int stream)
Increments the given counter type stream of the entity with the given entityId
|
void |
incrementCounterMap(String entityId,
int stream,
String key)
Increments the counter map record value for the given key of the entity which is given by the entityId
and the stream which is given by the streamId
|
void |
init(String nodeName,
String confDir)
Initializes the metrics collector by creating the default metrics templates such as SystemMetrics
|
void |
reportGauge(String entityId,
int stream,
double gaugeValue)
Increments the gauge counter of the entity which is given by the entityId and the stream which is given
|
void |
setCustomFields(Map<String,String> customFields) |
void |
setMetricsReportGenerationTimePeriod(int metricsReportGenerationTimePeriod) |
void |
setMetricsTemplateSyncTimePeriod(int metricsTemplateSyncTimePeriod) |
void |
setPrimaryMetricsTemplateValidTime(int primaryMetricsTemplateValidTime) |
void |
setStatisticsPublisher(XStatisticsPublisher statisticsPublisher) |
void |
shiftMetricsWindow()
Syncs primary
MetricsTemplate and secondary MetricsTemplate based on the expire time of the
primary metrics template of each entity type. |
void |
submitTask(Runnable task) |
public ESMetricsCollector(ESStatisticsPublisher esStatisticsPublisher)
public void init(String nodeName, String confDir)
init
in interface XMetricsCollector
nodeName
- the name of the node to be used for the initializationconfDir
- the configuration directory path of the serverpublic void addToMetricsWindow(MetricsTemplate metricsTemplate)
MetricsTemplate
objects to the metrics template map in the metrics engineaddToMetricsWindow
in interface XMetricsCollector
metricsTemplate
- the metrics template object to add to the metrics windowpublic void destroy()
XMetricsCollector
destroy
in interface XMetricsCollector
public void increment(String entityId, int stream)
increment
in interface XMetricsCollector
entityId
- the id of the metrics entity to identity the metrics template to increment the counter valuestream
- the name of the stream to identify the counter in the above metrics entitypublic void decrement(String entityId, int stream)
decrement
in interface XMetricsCollector
entityId
- the id of the metrics entity to identity the metrics template to decrement the counter valuestream
- the name of the stream to identify the counter in the above metrics entitypublic void reportGauge(String entityId, int stream, double gaugeValue)
reportGauge
in interface XMetricsCollector
entityId
- the id of the metrics entity to identity the metrics template to do the decrement of the gauge
recordstream
- the name of the stream to identify the counter in the above metrics entitygaugeValue
- the value to be added to gaugepublic void incrementCounterMap(String entityId, int stream, String key)
incrementCounterMap
in interface XMetricsCollector
entityId
- the id of the metrics entity to identity the metrics template to do the increment of the map
counter valuestream
- the name of the stream to identify the map counter in the above metrics entitykey
- the key of the map entry to be incrementedpublic void decrementCounterMap(String entityId, int stream, String key)
decrementCounterMap
in interface XMetricsCollector
entityId
- the id of the metrics entity to identity the metrics template to do the decrement of the map
counter recordstream
- the name of the stream to identify the map counter in the above metrics entitykey
- the key of the map entry to be decrementedpublic void generateRecords()
generateRecords
in interface XMetricsCollector
public void shiftMetricsWindow()
MetricsTemplate
and secondary MetricsTemplate
based on the expire time of the
primary metrics template of each entity type. If the current primary metrics template is expired this will
swap primary and secondary metrics templates for this entity typeshiftMetricsWindow
in interface XMetricsCollector
public void computeStream(MetricsStream metricsStream, MetricsStreamNames.MetricsRecordType type, String templateType, MetricsStreamNames.StreamCreationType streamCreationType, String entityId, String projectID, String projectVersion, String flowID, Map<String,String> additionalProps)
computeStream
in interface XMetricsCollector
metricsStream
- the metrics stream created for the given metrics stream nametype
- the type of the metrics recordtemplateType
- the type of the metrics template which belongs this metrics streamstreamCreationType
- the type of the stream creation to indicate whether this is a normal metrics stream
or a system stream or a global streamentityId
- the id of the metrics entity which belongs this metrics streamprojectID
- the name of the project to which the metrics entity of this metrics stream belongsprojectVersion
- the version of the project to which the metrics entity of this metrics stream belongsflowID
- the ID of the integration flow to which the metrics entity of this metrics stream belongsadditionalProps
- additional properties to be added to metrics recordpublic void addCompletedTemplate(MetricsTemplate metricsTemplate)
addCompletedTemplate
in interface XMetricsCollector
public void submitTask(Runnable task)
submitTask
in interface XMetricsCollector
public long getPrimaryTemplateLifeTime()
getPrimaryTemplateLifeTime
in interface XMetricsCollector
public int getMetricsReportGenerationTimePeriod()
getMetricsReportGenerationTimePeriod
in interface XMetricsCollector
public int getMetricsTemplateSyncTimePeriod()
getMetricsTemplateSyncTimePeriod
in interface XMetricsCollector
public String getNodeName()
getNodeName
in interface XMetricsCollector
public void setStatisticsPublisher(XStatisticsPublisher statisticsPublisher)
setStatisticsPublisher
in interface XMetricsCollector
public void setPrimaryMetricsTemplateValidTime(int primaryMetricsTemplateValidTime)
public void setMetricsReportGenerationTimePeriod(int metricsReportGenerationTimePeriod)
public void setMetricsTemplateSyncTimePeriod(int metricsTemplateSyncTimePeriod)
Copyright © 2016–2019 AdroitLogic. All rights reserved.