Package org.apache.ofbiz.base.metrics
Class MetricsFactory
java.lang.Object
org.apache.ofbiz.base.metrics.MetricsFactory
A
Metrics
factory.-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Metrics
getInstance
(String name, int estimationSize, long estimationTime, double smoothing, double threshold) Creates aMetrics
instance.static Metrics
getInstance
(Element element) Creates aMetrics
instance based onelement
attributes.static Metrics
Returns an existingMetric
instance with the specified name.static Collection<Metrics>
Returns allMetric
instances, sorted by name.
-
Field Details
-
NULL_METRICS
A "do-nothing"Metrics
instance.
-
-
Method Details
-
getInstance
Creates aMetrics
instance based onelement
attributes. If an instance with the same name already exists, it will be returned.Element Attributes Attribute Name Requirements Description Notes 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 theMetrics
instance- Returns:
- A
Metrics
instance based onelement
attributes - Throws:
IllegalArgumentException
- ifelement
is null or if the name attribute is emptyNumberFormatException
- 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 aMetrics
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
Returns an existingMetric
instance with the specified name. Returnsnull
if the metric does not exist.- Parameters:
name
- The metric name
-
getMetrics
Returns allMetric
instances, sorted by name.
-