Class DiagTask_gauge
- All Implemented Interfaces:
com.codahale.metrics.Gauge<Double>,com.codahale.metrics.Metric,DiagTask,NBParentComponentInjection,NBCanConfigure,NBConfigModelProvider,NBConfigurable,NBLabeledElement,BiFunction<Long,Map<String, Object>, Map<String, Object>>
A diag gauge task allows you to create a source of metrics data for testing or demonstration. You can customize the function used to produce the raw values, the number of buckets to use for leavening the values over time, and the basic stat function used to summarize the buckets into an aggregate double value.
Usage Notes
The data image for the gauge summary is updated consistently with respect to monotonic (whole step) cycle values. There are a few parameters which can be adjusted in order to make the gauge data appear more realistic.- label - This determines the metric label, normally used as the metric family name. Default is the task name.
- buckets - The number of values to seed incrementally to produce a data image
- binding - The binding recipe to use to create the value stored in a bin for a given cycle
- modulo - The interval of cycle values at which a new bin value is computed and stored in a bin
- stat - The aggregate statistic to use when computing the gauge value: min, avg, or max
The buckets are updated incrementally and consistently based on the cycle value, modulated by the modulo value. When the gauge is observed, the present value of the buckets is converted to a values image and the result is summarized according to the selected stat.
Practical values should be selected with awareness of the op rate and the rate of change desired in the metrics over time. The buckets allow for the effective rate of change over cycles to be slowed, but it is recommended to keep bin counts relative low by increasing modulo instead.
Examples
Suppose you wanted to see a moving average, where a new value is presented every second. A new value every second is obviously not needed in practical scenarios, but it makes a useful basis for thinking about relative rates, since the rate limiters are specified in ops/s.
- activity rate=10 modulo=10 - a new update will be visible every second.
- activity rate=1000 modulo=1000 - a new gauge value will be visible every second.
- activity rate=1000 modulo=60000 - a new gauge value will be visible every minute.
- activity rate=100 modulo=100 buckets=50 stat=avg - a new value will be visible every second, however the rate of change will be reduced due to the large sample size.
Usage Notes
Changing the number of buckets has a different effect based on the stat. For avg, the higher the number of buckets, the smaller the standard deviation of the results. For min and max, the higher the number of buckets, the more extreme the value will become. This is true for uniform bindings and non-uniform binding functions as well, although you can tailor the shape of the sample data as you like.-
Nested Class Summary
Nested classes/interfaces inherited from interface io.nosqlbench.nb.api.labels.NBLabeledElement
NBLabeledElement.BasicLabeledElement -
Field Summary
Fields inherited from class io.nosqlbench.adapter.diag.optasks.BaseDiagTask
parentFields inherited from interface io.nosqlbench.nb.api.labels.NBLabeledElement
EMPTY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidImplementors should take care to ensure that this can be called after initial construction without unexpected interactions between construction parameters and configuration parameters.Implement this method by returning an instance ofConfigModel.getValue()Methods inherited from class io.nosqlbench.adapter.diag.optasks.BaseDiagTask
applyParentComponent, getName, getParentLabels, setLabelsFrom, setNameMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.function.BiFunction
andThenMethods inherited from interface io.nosqlbench.nb.api.labels.NBLabeledElement
descriptionMethods inherited from interface io.nosqlbench.nb.api.components.core.NBParentComponentInjection
applyParentComponent
-
Constructor Details
-
DiagTask_gauge
public DiagTask_gauge()
-
-
Method Details
-
apply
-
applyConfig
Description copied from interface:NBConfigurableImplementors should take care to ensure that this can be called after initial construction without unexpected interactions between construction parameters and configuration parameters.- Specified by:
applyConfigin interfaceNBCanConfigure- Specified by:
applyConfigin interfaceNBConfigurable- Parameters:
cfg- The configuration data to be applied to a new instance
-
getConfigModel
Description copied from interface:NBConfigurableImplement this method by returning an instance ofConfigModel. Any configuration which is provided to theNBConfigurable.applyConfig(NBConfiguration)method will be validated through this model. A configuration model is required in order to build a validated configuration from source data provided by a user.- Specified by:
getConfigModelin interfaceNBConfigModelProvider- Specified by:
getConfigModelin interfaceNBConfigurable- Returns:
- A valid configuration model for the implementing class
-
getValue
-
getLabels
- Specified by:
getLabelsin interfaceNBLabeledElement- Overrides:
getLabelsin classBaseDiagTask
-