Class 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 Summary

      Constructors 
      Constructor Description
      MetricTelemetry()
      Creates a new instance.
      MetricTelemetry​(java.lang.String name, double value)
      Creates a new instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Integer getCount()
      Gets the number of samples for this metric.
      protected MetricData getData()  
      DataPointType getKind()  
      java.lang.Double getMax()
      Gets the max value of this metric across samples.
      java.lang.String getMetricNamespace()
      Gets the namespace of the metric.
      java.lang.Double getMin()
      Gets the min value of this metric across samples.
      java.lang.String getName()
      Gets the name of the metric.
      java.lang.Double getStandardDeviation()
      Gets the standard deviation of this metric across samples.
      double getValue()
      Gets the value of the metric.
      void setCount​(java.lang.Integer count)
      Sets the number of samples for this metric.
      void setMax​(java.lang.Double value)
      Sets the max value of this metric across samples.
      void setMetricNamespace​(java.lang.String metricNamespace)
      Sets the metric namespace for the metric.
      void setMin​(java.lang.Double value)
      Sets the min value of this metric across samples.
      void setName​(java.lang.String name)
      Sets the name of the metric.
      void setStandardDeviation​(java.lang.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 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MetricTelemetry

        public MetricTelemetry​(java.lang.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:
        java.lang.IllegalArgumentException - if name is null or empty
      • MetricTelemetry

        public MetricTelemetry()
        Creates a new instance.
    • Method Detail

      • getName

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

        public void setName​(java.lang.String name)
        Sets the name of the metric. Length 1-150 characters.
        Parameters:
        name - The name of the metric.
        Throws:
        java.lang.IllegalArgumentException - if the name is null or empty.
      • getMetricNamespace

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

        public void setMetricNamespace​(java.lang.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 java.lang.Integer getCount()
        Gets the number of samples for this metric.
      • setCount

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

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

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

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

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

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

        public void setStandardDeviation​(java.lang.Double value)
        Sets the standard deviation of this metric across samples.