Class MicrometerMetricsOptions
java.lang.Object
io.vertx.core.metrics.MetricsOptions
io.vertx.micrometer.MicrometerMetricsOptions
Vert.x micrometer configuration.
It is required to set either influxDbOptions, prometheusOptions or jmxMetricsOptions
(or, programmatically, micrometerRegistry) in order to actually report metrics.
- Author:
- Joel Takvorian
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanWhether JVM metrics should be collected by default = false.Default label match for public http server: exclude remote labelstatic final booleanDeprecated, for removal: This API element is subject to removal in a future version.as of 5.1, this is no longer used since Vert.x 5.0static final MetricsNamingDefault metrics naming = Vert.x 4 namingstatic final booleanWhether Netty metrics should be collected by default = false.static final StringDefault registry name is 'default'Fields inherited from class MetricsOptions
DEFAULT_METRICS_ENABLED -
Constructor Summary
ConstructorsConstructorDescriptionCreates default options for Micrometer metrics.Creates new options object for Micrometer metrics fromjsoninput.Creates new options object for Micrometer metrics, which is a copy ofother. -
Method Summary
Modifier and TypeMethodDescriptionaddDisabledMetricsCategory(MetricsDomain metricsDomain) Set metric that will not be registered.addDisabledMetricsCategory(String category) Set metric that will not be registered.addLabelMatch(Match match) Add a rule for label matching.Add a labels to enable.Function<HttpRequest, Iterable<io.micrometer.core.instrument.Tag>> Get the specific options for InfluxDB reporting.Get the specific options for JMX reporting.MetricsNamingis a structure that holds names of all metrics, each one can be changed individually.Get the specific options for Prometheus reporting.Get the metrics registry name set in these optionsFunction<HttpRequest, Iterable<io.micrometer.core.instrument.Tag>> booleanbooleanDeprecated, for removal: This API element is subject to removal in a future version.as of 5.1, this is no longer used since Vert.x 5.0booleanisMetricsCategoryDisabled(MetricsDomain metricsDomain) Is the given metrics category disabled?booleanisMetricsCategoryDisabled(String category) Is the given metrics category disabled?booleansetClientRequestTagsProvider(Function<HttpRequest, Iterable<io.micrometer.core.instrument.Tag>> clientRequestTagsProvider) Sets a custom tags provider for HTTP client requests.setDisabledMetricsCategories(Set<String> disabledMetricsCategories) Sets metrics types that are disabled.setEnabled(boolean enable) Set whether metrics will be enabled on the Vert.x instance.setInfluxDbOptions(VertxInfluxDbOptions influxDbOptions) Set InfluxDB options.setJmxMetricsOptions(VertxJmxMetricsOptions jmxMetricsOptions) Set JMX metrics options.setJvmMetricsEnabled(boolean jvmMetricsEnabled) Whether JVM metrics should be collected.setLabelMatches(List<Match> matches) Set a list of rules for label matching.Sets enabled labels.setMeterCacheEnabled(boolean meterCacheEnabled) Deprecated, for removal: This API element is subject to removal in a future version.as of 5.1, this is no longer used since Vert.x 5.0setMetricsNaming(MetricsNaming metricsNaming) MetricsNamingis a structure that holds names of all metrics, each one can be changed individually.setNettyMetricsEnabled(boolean nettyMetricsEnabled) Whether Netty metrics should be collected.setPrometheusOptions(VertxPrometheusOptions prometheusOptions) Set Prometheus options.setRegistryName(String registryName) Set a name for the metrics registry, so that a new registry will be created and associated with this name.setServerRequestTagsProvider(Function<HttpRequest, Iterable<io.micrometer.core.instrument.Tag>> serverRequestTagsProvider) Sets a custom tags provider for HTTP server requests.toJson()Methods inherited from class MetricsOptions
isEnabled, toString
-
Field Details
-
DEFAULT_REGISTRY_NAME
-
DEFAULT_LABELS
-
DEFAULT_JVM_METRICS_ENABLED
public static final boolean DEFAULT_JVM_METRICS_ENABLEDWhether JVM metrics should be collected by default = false.- See Also:
-
DEFAULT_NETTY_METRICS_ENABLED
public static final boolean DEFAULT_NETTY_METRICS_ENABLEDWhether Netty metrics should be collected by default = false.- See Also:
-
DEFAULT_METRICS_NAMING
Default metrics naming = Vert.x 4 naming -
DEFAULT_METER_CACHED_ENABLED
Deprecated, for removal: This API element is subject to removal in a future version.as of 5.1, this is no longer used since Vert.x 5.0Whether a meter cache should be enabled by default = true.- See Also:
-
-
Constructor Details
-
MicrometerMetricsOptions
public MicrometerMetricsOptions()Creates default options for Micrometer metrics. -
MicrometerMetricsOptions
Creates new options object for Micrometer metrics, which is a copy ofother. -
MicrometerMetricsOptions
Creates new options object for Micrometer metrics fromjsoninput.
-
-
Method Details
-
toJson
- Overrides:
toJsonin classMetricsOptions- Returns:
- a JSON representation of these options
-
setEnabled
Set whether metrics will be enabled on the Vert.x instance. Metrics are not enabled by default.- Overrides:
setEnabledin classMetricsOptions- Parameters:
enable- true if metrics enabled, or false if not.- Returns:
- a reference to this, so the API can be used fluently
-
getDisabledMetricsCategories
-
setDisabledMetricsCategories
Sets metrics types that are disabled.- Parameters:
disabledMetricsCategories- to specify the set of metrics types to be disabled.- Returns:
- a reference to this, so that the API can be used fluently
-
addDisabledMetricsCategory
Set metric that will not be registered. Schedulers will check the setdisabledMetricsCategorieswhen registering metrics suppliers- Parameters:
metricsDomain- the type of metrics- Returns:
- a reference to this, so that the API can be used fluently
-
addDisabledMetricsCategory
Set metric that will not be registered. Schedulers will check the setdisabledMetricsCategorieswhen registering metrics suppliers- Parameters:
category- the type of metrics- Returns:
- a reference to this, so that the API can be used fluently
-
isMetricsCategoryDisabled
Is the given metrics category disabled?- Returns:
trueif it is disabled
-
isMetricsCategoryDisabled
Is the given metrics category disabled?- Returns:
trueif it is disabled
-
getRegistryName
Get the metrics registry name set in these options -
setRegistryName
Set a name for the metrics registry, so that a new registry will be created and associated with this name. IfregistryNameis not provided (or null), a default registry will be used. If the same name is given to several Vert.x instances (within the same JVM), they will share the same registry.- Parameters:
registryName- a name to uniquely identify this registry
-
getLabels
-
setLabels
Sets enabled labels. These labels can be fine-tuned later on using Micrometer's Meter filters (see http://micrometer.io/docs/concepts#_meter_filters)- Parameters:
labels- the set of enabled labels - this set will replace any previously enabled labels, including the default ones- Returns:
- a reference to this, so that the API can be used fluently
-
addLabels
Add a labels to enable. These labels can be fine-tuned later on using Micrometer's Meter filters (see http://micrometer.io/docs/concepts#_meter_filters)- Parameters:
labels- the labels to enable- Returns:
- a reference to this, so that the API can be used fluently
-
getLabelMatches
-
setLabelMatches
Set a list of rules for label matching.- Parameters:
matches- the new list of rules- Returns:
- a reference to this, so the API can be used fluently
-
addLabelMatch
Add a rule for label matching.- Parameters:
match- the label match- Returns:
- a reference to this, so the API can be used fluently
-
getInfluxDbOptions
Get the specific options for InfluxDB reporting. -
setInfluxDbOptions
Set InfluxDB options. Setting a registry backend option is mandatory in order to effectively report metrics.- Parameters:
influxDbOptions- backend options for InfluxDB
-
getPrometheusOptions
Get the specific options for Prometheus reporting. -
setPrometheusOptions
Set Prometheus options. Setting a registry backend option is mandatory in order to effectively report metrics.- Parameters:
prometheusOptions- backend options for Prometheus
-
getJmxMetricsOptions
Get the specific options for JMX reporting. -
setJmxMetricsOptions
Set JMX metrics options. Setting a registry backend option is mandatory in order to effectively report metrics.- Parameters:
jmxMetricsOptions- backend options for JMX reporting
-
isJvmMetricsEnabled
public boolean isJvmMetricsEnabled()- Returns:
trueif JVM metrics should be collected,falseotherwise
-
setJvmMetricsEnabled
Whether JVM metrics should be collected. Defaults tofalse.- Parameters:
jvmMetricsEnabled-trueto collect JVM metrics,falseotherwise. Defaults tofalse.- Returns:
- a reference to this, so the API can be used fluently
-
isNettyMetricsEnabled
public boolean isNettyMetricsEnabled()- Returns:
trueif Netty metrics should be collected,falseotherwise
-
setNettyMetricsEnabled
Whether Netty metrics should be collected. Defaults tofalse.- Parameters:
nettyMetricsEnabled-trueto collect Netty metrics,falseotherwise. Defaults tofalse.- Returns:
- a reference to this, so the API can be used fluently
-
getMetricsNaming
MetricsNamingis a structure that holds names of all metrics, each one can be changed individually.- Returns:
- the configured
MetricsNamingobject (defaults to Vert.x names).
-
setMetricsNaming
MetricsNamingis a structure that holds names of all metrics, each one can be changed individually. For instance, to retrieve compatibility with the names used in Vert.x 3.x, usesetMetricsNaming(MetricsNaming.v3Names())- Parameters:
metricsNaming- aMetricsNamingobject.- Returns:
- a reference to this, so the API can be used fluently
-
getServerRequestTagsProvider
public Function<HttpRequest, Iterable<io.micrometer.core.instrument.Tag>> getServerRequestTagsProvider()- Returns:
- an optional custom tags provider for HTTP server requests
-
setServerRequestTagsProvider
public MicrometerMetricsOptions setServerRequestTagsProvider(Function<HttpRequest, Iterable<io.micrometer.core.instrument.Tag>> serverRequestTagsProvider) Sets a custom tags provider for HTTP server requests. Allows to generate custom tags for everyHttpRequestobject processed through the metrics SPI.- Parameters:
serverRequestTagsProvider- an object that returns an iterable ofTagfor aHttpRequest.- Returns:
- a reference to this, so that the API can be used fluently
-
getClientRequestTagsProvider
public Function<HttpRequest, Iterable<io.micrometer.core.instrument.Tag>> getClientRequestTagsProvider()- Returns:
- an optional custom tags provider for HTTP client requests
-
setClientRequestTagsProvider
public MicrometerMetricsOptions setClientRequestTagsProvider(Function<HttpRequest, Iterable<io.micrometer.core.instrument.Tag>> clientRequestTagsProvider) Sets a custom tags provider for HTTP client requests. Allows to generate custom tags for everyHttpRequestobject processed through the metrics SPI.- Parameters:
clientRequestTagsProvider- an object that returns an iterable ofTagfor aHttpRequest.- Returns:
- a reference to this, so that the API can be used fluently
-
isMeterCacheEnabled
Deprecated, for removal: This API element is subject to removal in a future version.as of 5.1, this is no longer used since Vert.x 5.0- Returns:
trueif a meter cache should be enabled,falseotherwise
-
setMeterCacheEnabled
@Deprecated(forRemoval=true) public MicrometerMetricsOptions setMeterCacheEnabled(boolean meterCacheEnabled) Deprecated, for removal: This API element is subject to removal in a future version.as of 5.1, this is no longer used since Vert.x 5.0Whether a meter cache should be enabled. Defaults totrue.- Parameters:
meterCacheEnabled-trueto enable a meter cache,falseotherwise. Defaults totrue.- Returns:
- a reference to this, so the API can be used fluently
-