Class MetricTelemetry

java.lang.Object
com.microsoft.applicationinsights.telemetry.BaseTelemetry
com.microsoft.applicationinsights.telemetry.MetricTelemetry
All Implemented Interfaces:
Telemetry

public final class MetricTelemetry extends BaseTelemetry
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 Details

    • MetricTelemetry

      public MetricTelemetry(String name, double value)
      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

      public String getName()
      Gets the name of the metric.
    • setName

      public void setName(String name)
      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

      public String getMetricNamespace()
      Gets the namespace of the metric.
    • setMetricNamespace

      public void setMetricNamespace(String metricNamespace)
      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

      public Integer getCount()
      Gets the number of samples for this metric.
    • setCount

      public void setCount(Integer count)
      Sets the number of samples for this metric.
      Parameters:
      count - Number of samples greater than or equal to 1
    • getMin

      public Double getMin()
      Gets the min value of this metric across samples.
    • setMin

      public void setMin(Double value)
      Sets the min value of this metric across samples.
    • getMax

      public Double getMax()
      Gets the max value of this metric across samples.
    • setMax

      public void setMax(Double value)
      Sets the max value of this metric across samples.
    • getStandardDeviation

      public Double getStandardDeviation()
      Gets the standard deviation of this metric across samples.
    • setStandardDeviation

      public void setStandardDeviation(Double value)
      Sets the standard deviation of this metric across samples.
    • getKind

      public DataPointType getKind()
    • getData

      protected MetricData getData()
      Specified by:
      getData in class BaseTelemetry