Package com.yahoo.jdisc.test
Class MockMetric
java.lang.Object
com.yahoo.jdisc.test.MockMetric
- All Implemented Interfaces:
Metric
Metric implementation for tests.
- Author:
- jonmv
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.yahoo.jdisc.Metric
Metric.Context
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(String key, Number val, Metric.Context ctx) Add to a metric value.createContext
(Map<String, ?> properties) Creates aMetricConsumer
-specificMetric.Context
object that encapsulates the given properties.metrics()
void
set
(String key, Number val, Metric.Context ctx) Set a metric value.toString()
-
Constructor Details
-
MockMetric
public MockMetric()
-
-
Method Details
-
set
Description copied from interface:Metric
Set a metric value. This is typically used with histogram-type metrics. -
add
Description copied from interface:Metric
Add to a metric value. This is typically used with counter-type metrics. -
createContext
Description copied from interface:Metric
Creates aMetricConsumer
-specificMetric.Context
object that encapsulates the given properties. The returned Context object should be passed along every future call toMetric.set(String, Number, Context)
andMetric.add(String, Number, Context)
where the properties match those given here.- Specified by:
createContext
in interfaceMetric
- Parameters:
properties
- the properties to incorporate in the context- Returns:
- the created context
-
metrics
-
toString
-