Class MetricStreamDefinition
- java.lang.Object
-
- com.elastisys.autoscaler.metricstreamers.influxdb.config.MetricStreamDefinition
-
public class MetricStreamDefinition extends java.lang.ObjectDescribes what query to run for this particularMetricStream.- See Also:
InfluxdbMetricStreamerConfig
-
-
Field Summary
Fields Modifier and Type Field Description static com.elastisys.scale.commons.json.types.TimeIntervalDEFAULT_QUERY_CHUNK_SIZEDefault value forqueryChunkSize.
-
Constructor Summary
Constructors Constructor Description MetricStreamDefinition(java.lang.String id, java.lang.String metricName, java.lang.String database, Query query, com.elastisys.scale.commons.json.types.TimeInterval dataSettlingTime, com.elastisys.scale.commons.json.types.TimeInterval queryChunkSize)Creates anMetricStreamDefinition.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)java.lang.StringgetDatabase()The InfluxDB database to query.com.elastisys.scale.commons.json.types.TimeIntervalgetDataSettlingTime()The minimum age of requested data points.java.lang.StringgetId()The id of the metric stream.java.lang.StringgetMetric()java.lang.StringgetMetricName()The metric name that will be assigned to theMetricValues produced by this stream.QuerygetQuery()The InfluxDBSELECTquery to be used to fetch new metrics values.com.elastisys.scale.commons.json.types.TimeIntervalgetQueryChunkSize()The maximum time period that a single query against the InfluxDB server will attempt to fetch in a single call.inthashCode()java.lang.StringtoString()voidvalidate()Checks the validity of field values.MetricStreamDefinitionwithDataSettlingTime(com.elastisys.scale.commons.json.types.TimeInterval dataSettlingTime)Creates a field-by-field copy of this object but sets a different data settling time in the returned copy.MetricStreamDefinitionwithQuery(Query query)Creates a field-by-field copy of this object but sets a different query in the returned copy.MetricStreamDefinitionwithQueryChunkSize(com.elastisys.scale.commons.json.types.TimeInterval queryChunkSize)Creates a field-by-field copy of this object but sets a different query chunk size in the returned copy.
-
-
-
Field Detail
-
DEFAULT_QUERY_CHUNK_SIZE
public static final com.elastisys.scale.commons.json.types.TimeInterval DEFAULT_QUERY_CHUNK_SIZE
Default value forqueryChunkSize.
-
-
Constructor Detail
-
MetricStreamDefinition
public MetricStreamDefinition(java.lang.String id, java.lang.String metricName, java.lang.String database, Query query, com.elastisys.scale.commons.json.types.TimeInterval dataSettlingTime, com.elastisys.scale.commons.json.types.TimeInterval queryChunkSize)Creates anMetricStreamDefinition.- Parameters:
id- The id of the metric stream. This is the id that will be used by clients wishing to subscribe to this metric stream. Required.metricName- The metric name that will be assigned to theMetricValues produced by this stream. Optional. Default:id.database- The InfluxDB database to query. An InfluxDB database acts as a container for time series data. For example,mydb. Required.query- The InfluxDBSELECTquery to be used to fetch new metrics values. Required. Note: a query should avoid filtering ontimein theWHEREclause, as selecting the approriate interval for which to fetch metrics will be handled by theInfluxdbMetricStreamer.dataSettlingTime- The minimum age of requested data points. TheMetricStreamerwill never request values newer than this from InfluxDB. This value can be regarded as the expected "settling time" of new data points. When requesting recent aggregate metric data points, there is always a risk of seeing partial/incomplete results before metric values from all sources have been registered. The data settling time is intended to give all sources a chance to report before fetching recent values. The value to set for this field depends on the reporting frequency of monitoring agents, but as a general rule-of-thumb, this value can be set to be about1.5times the length of the reporting-interval for monitoring agents. May benull.queryChunkSize- The maximum time period that a single query will attempt to fetch in a single call. A query with a longer time interval will be run incrementally, each fetching a sub-interval of this duration. This type of incremental retrieval of largeQueryResultSets limits the amount of (memory) resources involved in processing large queries. May benull. Default: .
-
-
Method Detail
-
getId
public java.lang.String getId()
The id of the metric stream. This is the id that will be used by clients wishing to subscribe to this metric stream. Required.- Returns:
-
getMetricName
public java.lang.String getMetricName()
The metric name that will be assigned to theMetricValues produced by this stream.- Returns:
-
getMetric
public java.lang.String getMetric()
-
getDatabase
public java.lang.String getDatabase()
The InfluxDB database to query. An InfluxDB database acts as a container for time series data. For example,mydb.- Returns:
-
getQuery
public Query getQuery()
The InfluxDBSELECTquery to be used to fetch new metrics values. Note: a query should avoid filtering ontimein theWHEREclause, as selecting the approriate interval for which to fetch metrics will be handled by theInfluxdbMetricStreamer.- Returns:
-
getDataSettlingTime
public com.elastisys.scale.commons.json.types.TimeInterval getDataSettlingTime()
The minimum age of requested data points. TheMetricStreamerwill never request values newer than this from InfluxDB. This value can be regarded as the expected "settling time" of new data points. When requesting recent aggregate metric data points, there is always a risk of seeing partial/incomplete results before metric values from all sources have been registered. The data settling time is intended to give all sources a chance to report before fetching recent values. The value to set for this field depends on the reporting frequency of monitoring agents, but as a general rule-of-thumb, this value can be set to be about1.5times the length of the reporting-interval for monitoring agents. May benull.- Returns:
-
getQueryChunkSize
public com.elastisys.scale.commons.json.types.TimeInterval getQueryChunkSize()
The maximum time period that a single query against the InfluxDB server will attempt to fetch in a single call. A query with a longer time interval will be run incrementally, each fetching a sub-interval of this duration. This type of incremental retrieval of largeQueryResultSets limits the amount of (memory) resources involved in processing large queries.- Returns:
-
validate
public void validate() throws java.lang.IllegalArgumentExceptionChecks the validity of field values. Throws anIllegalArgumentExceptionif necessary conditions are not satisfied.- Throws:
java.lang.IllegalArgumentException
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
withQuery
public MetricStreamDefinition withQuery(Query query)
Creates a field-by-field copy of this object but sets a different query in the returned copy.- Parameters:
query-- Returns:
-
withDataSettlingTime
public MetricStreamDefinition withDataSettlingTime(com.elastisys.scale.commons.json.types.TimeInterval dataSettlingTime)
Creates a field-by-field copy of this object but sets a different data settling time in the returned copy.- Parameters:
dataSettlingTime-- Returns:
-
withQueryChunkSize
public MetricStreamDefinition withQueryChunkSize(com.elastisys.scale.commons.json.types.TimeInterval queryChunkSize)
Creates a field-by-field copy of this object but sets a different query chunk size in the returned copy.- Parameters:
queryChunkSize-- Returns:
-
-