Class MetricsFactory

    • Field Detail

      • NULL_METRICS

        public static final Metrics NULL_METRICS
        A "do-nothing" Metrics instance.
    • Method Detail

      • getInstance

        public static Metrics getInstance​(Element element)
        Creates a Metrics instance based on element attributes. If an instance with the same name already exists, it will be returned.
        Element Attributes
        Attribute NameRequirementsDescriptionNotes
        name Required The metric name.  
        estimation-size Optional Positive integer number of events to include in the metrics calculation. Defaults to "100".
        estimation-time Optional Positive integer number of milliseconds to include in the metrics calculation. Defaults to "1000".
        smoothing Optional Smoothing factor - used to smooth the differences between calculations. A value of "1" disables smoothing. Defaults to "0.7".
        threshold Optional The metric threshold. The meaning of the threshold is determined by client code. Defaults to "0.0".
        Parameters:
        element - The element whose attributes will be used to create the Metrics instance
        Returns:
        A Metrics instance based on element attributes
        Throws:
        IllegalArgumentException - if element is null or if the name attribute is empty
        NumberFormatException - if any of the numeric attribute values are unparsable
      • getInstance

        public static Metrics getInstance​(String name,
                                          int estimationSize,
                                          long estimationTime,
                                          double smoothing,
                                          double threshold)
        Creates a Metrics instance. If an instance with the same name already exists, it will be returned.
        Parameters:
        name - The metric name.
        estimationSize - Positive integer number of events to include in the metrics calculation.
        estimationTime - Positive integer number of milliseconds to include in the metrics calculation.
        smoothing - Smoothing factor - used to smooth the differences between calculations.
        Returns:
        A Metrics instance
      • getMetric

        public static Metrics getMetric​(String name)
        Returns an existing Metric instance with the specified name. Returns null if the metric does not exist.
        Parameters:
        name - The metric name
      • getMetrics

        public static Collection<Metrics> getMetrics()
        Returns all Metric instances, sorted by name.