Class MetricTelemetry
java.lang.Object
com.microsoft.applicationinsights.telemetry.BaseTelemetry
com.microsoft.applicationinsights.telemetry.MetricTelemetry
- All Implemented Interfaces:
Telemetry
Telemetry type used to track metrics sent to Azure Application Insights.
This represents a Measurement, if only Name and Value are set. If Count, Min, Max or Standard
Deviation are set, this represents an Aggregation; a sampled set of points summarized by these
statistic fields. In an Aggregation metric, the value, i.e. getValue()
, represents the
sum of sampled data points.
-
Constructor Summary
ConstructorDescriptionCreates a new instance.MetricTelemetry
(String name, double value) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptiongetCount()
Gets the number of samples for this metric.protected MetricData
getData()
getKind()
getMax()
Gets the max value of this metric across samples.Gets the namespace of the metric.getMin()
Gets the min value of this metric across samples.getName()
Gets the name of the metric.Gets the standard deviation of this metric across samples.double
getValue()
Gets the value of the metric.void
Sets the number of samples for this metric.void
Sets the max value of this metric across samples.void
setMetricNamespace
(String metricNamespace) Sets the metric namespace for the metric.void
Sets the min value of this metric across samples.void
Sets the name of the metric.void
setStandardDeviation
(Double value) Sets the standard deviation of this metric across samples.void
setValue
(double value) Sets The value of the metric.Methods inherited from class com.microsoft.applicationinsights.telemetry.BaseTelemetry
getContext, getProperties, getTimestamp, initialize, setTimestamp
-
Constructor Details
-
MetricTelemetry
Creates a new instance.- Parameters:
name
- The name of the metric. Length 1-150 characters.value
- The value of the metric.- Throws:
IllegalArgumentException
- if name is null or empty
-
MetricTelemetry
public MetricTelemetry()Creates a new instance.
-
-
Method Details
-
getName
Gets the name of the metric. -
setName
Sets the name of the metric. Length 1-150 characters.- Parameters:
name
- The name of the metric.- Throws:
IllegalArgumentException
- if the name is null or empty.
-
getMetricNamespace
Gets the namespace of the metric. -
setMetricNamespace
Sets the metric namespace for the metric. This is optional.- Parameters:
metricNamespace
- The metric namespace for the metric.
-
getValue
public double getValue()Gets the value of the metric. Represents the sum of data points if this metric is an Aggregation. -
setValue
public void setValue(double value) Sets The value of the metric. -
getCount
Gets the number of samples for this metric. -
setCount
Sets the number of samples for this metric.- Parameters:
count
- Number of samples greater than or equal to 1
-
getMin
Gets the min value of this metric across samples. -
setMin
Sets the min value of this metric across samples. -
getMax
Gets the max value of this metric across samples. -
setMax
Sets the max value of this metric across samples. -
getStandardDeviation
Gets the standard deviation of this metric across samples. -
setStandardDeviation
Sets the standard deviation of this metric across samples. -
getKind
-
getData
- Specified by:
getData
in classBaseTelemetry
-