public class MicrometerMetricsOptions extends MetricsOptions
It is required to set either influxDbOptions
, prometheusOptions
or jmxMetricsOptions
(or, programmatically, micrometerRegistry
) in order to actually report metrics.
Modifier and Type | Field and Description |
---|---|
static boolean |
DEFAULT_JVM_METRICS_ENABLED
Whether JVM metrics should be collected by default = false.
|
static List<Label> |
DEFAULT_LABELS
Default label match for public http server: exclude remote label
|
static MetricsNaming |
DEFAULT_METRICS_NAMING
Default metrics naming = Vert.x 4 naming
|
static String |
DEFAULT_REGISTRY_NAME
Default registry name is 'default'
|
DEFAULT_METRICS_ENABLED
Constructor and Description |
---|
MicrometerMetricsOptions()
Creates default options for Micrometer metrics.
|
MicrometerMetricsOptions(JsonObject json)
Creates new options object for Micrometer metrics from
json input. |
MicrometerMetricsOptions(MicrometerMetricsOptions other)
Creates new options object for Micrometer metrics, which is a copy of
other . |
Modifier and Type | Method and Description |
---|---|
MicrometerMetricsOptions |
addDisabledMetricsCategory(MetricsDomain metricsDomain)
Set metric that will not be registered.
|
MicrometerMetricsOptions |
addDisabledMetricsCategory(String category)
Set metric that will not be registered.
|
MicrometerMetricsOptions |
addLabelMatch(Match match)
Add a rule for label matching.
|
MicrometerMetricsOptions |
addLabels(Label... labels)
Add a labels to enable.
|
Set<String> |
getDisabledMetricsCategories() |
VertxInfluxDbOptions |
getInfluxDbOptions()
Get the specific options for InfluxDB reporting.
|
VertxJmxMetricsOptions |
getJmxMetricsOptions()
Get the specific options for JMX reporting.
|
List<Match> |
getLabelMatches() |
Set<Label> |
getLabels() |
MetricsNaming |
getMetricsNaming()
MetricsNaming is a structure that holds names of all metrics, each one can be changed individually. |
io.micrometer.core.instrument.MeterRegistry |
getMicrometerRegistry()
Get the Micrometer MeterRegistry to be used by Vert.x, that has been previously set programmatically
|
VertxPrometheusOptions |
getPrometheusOptions()
Get the specific options for Prometheus reporting.
|
String |
getRegistryName()
Get the metrics registry name set in these options
|
boolean |
isJvmMetricsEnabled() |
boolean |
isMetricsCategoryDisabled(MetricsDomain metricsDomain)
Is the given metrics category disabled?
|
boolean |
isMetricsCategoryDisabled(String category)
Is the given metrics category disabled?
|
MicrometerMetricsOptions |
setDisabledMetricsCategories(Set<String> disabledMetricsCategories)
Sets metrics types that are disabled.
|
MicrometerMetricsOptions |
setEnabled(boolean enable)
Set whether metrics will be enabled on the Vert.x instance.
|
MicrometerMetricsOptions |
setFactory(VertxMetricsFactory factory)
Programmatically set the metrics factory to be used when metrics are enabled.
|
MicrometerMetricsOptions |
setInfluxDbOptions(VertxInfluxDbOptions influxDbOptions)
Set InfluxDB options.
|
MicrometerMetricsOptions |
setJmxMetricsOptions(VertxJmxMetricsOptions jmxMetricsOptions)
Set JMX metrics options.
|
MicrometerMetricsOptions |
setJvmMetricsEnabled(boolean jvmMetricsEnabled)
Whether JVM metrics should be collected.
|
MicrometerMetricsOptions |
setLabelMatches(List<Match> matches)
Set a list of rules for label matching.
|
MicrometerMetricsOptions |
setLabels(Set<Label> labels)
Sets enabled labels.
|
MicrometerMetricsOptions |
setMetricsNaming(MetricsNaming metricsNaming)
MetricsNaming is a structure that holds names of all metrics, each one can be changed individually. |
MicrometerMetricsOptions |
setMicrometerRegistry(io.micrometer.core.instrument.MeterRegistry micrometerRegistry)
Programmatically set the Micrometer MeterRegistry to be used by Vert.x.
|
MicrometerMetricsOptions |
setPrometheusOptions(VertxPrometheusOptions prometheusOptions)
Set Prometheus options.
|
MicrometerMetricsOptions |
setRegistryName(String registryName)
Set a name for the metrics registry, so that a new registry will be created and associated with this name.
|
JsonObject |
toJson() |
getFactory, isEnabled, toString
public static final String DEFAULT_REGISTRY_NAME
public static final List<Label> DEFAULT_LABELS
public static final boolean DEFAULT_JVM_METRICS_ENABLED
public static final MetricsNaming DEFAULT_METRICS_NAMING
public MicrometerMetricsOptions()
public MicrometerMetricsOptions(MicrometerMetricsOptions other)
other
.public MicrometerMetricsOptions(JsonObject json)
json
input.public JsonObject toJson()
toJson
in class MetricsOptions
public MicrometerMetricsOptions setEnabled(boolean enable)
setEnabled
in class MetricsOptions
enable
- true if metrics enabled, or false if not.public MicrometerMetricsOptions setFactory(VertxMetricsFactory factory)
MetricsOptions
Only valid if MetricsOptions.isEnabled()
= true.
Normally Vert.x will look on the classpath for a metrics factory implementation, but if you want to set one programmatically you can use this method.
setFactory
in class MetricsOptions
factory
- the metrics factorypublic Set<String> getDisabledMetricsCategories()
public MicrometerMetricsOptions setDisabledMetricsCategories(Set<String> disabledMetricsCategories)
disabledMetricsCategories
- to specify the set of metrics types to be disabled.public MicrometerMetricsOptions addDisabledMetricsCategory(MetricsDomain metricsDomain)
disabledMetricsCategories
when
registering metrics suppliersmetricsDomain
- the type of metricspublic MicrometerMetricsOptions addDisabledMetricsCategory(String category)
disabledMetricsCategories
when
registering metrics supplierscategory
- the type of metricspublic boolean isMetricsCategoryDisabled(MetricsDomain metricsDomain)
public boolean isMetricsCategoryDisabled(String category)
public String getRegistryName()
public MicrometerMetricsOptions setRegistryName(String registryName)
registryName
is 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.registryName
- a name to uniquely identify this registrypublic MicrometerMetricsOptions setLabels(Set<Label> labels)
labels
- the set of enabled labels - this set will replace any previously enabled labels, including the default onespublic MicrometerMetricsOptions addLabels(Label... labels)
labels
- the labels to enablepublic MicrometerMetricsOptions setLabelMatches(List<Match> matches)
matches
- the new list of rulespublic MicrometerMetricsOptions addLabelMatch(Match match)
match
- the label matchpublic io.micrometer.core.instrument.MeterRegistry getMicrometerRegistry()
public MicrometerMetricsOptions setMicrometerRegistry(io.micrometer.core.instrument.MeterRegistry micrometerRegistry)
micrometerRegistry
- the registry to usepublic VertxInfluxDbOptions getInfluxDbOptions()
public MicrometerMetricsOptions setInfluxDbOptions(VertxInfluxDbOptions influxDbOptions)
influxDbOptions
- backend options for InfluxDBpublic VertxPrometheusOptions getPrometheusOptions()
public MicrometerMetricsOptions setPrometheusOptions(VertxPrometheusOptions prometheusOptions)
prometheusOptions
- backend options for Prometheuspublic VertxJmxMetricsOptions getJmxMetricsOptions()
public MicrometerMetricsOptions setJmxMetricsOptions(VertxJmxMetricsOptions jmxMetricsOptions)
jmxMetricsOptions
- backend options for JMX reportingpublic boolean isJvmMetricsEnabled()
public MicrometerMetricsOptions setJvmMetricsEnabled(boolean jvmMetricsEnabled)
false
.jvmMetricsEnabled
- true to collect JVM metrics, false otherwise. Defaults to false
.public MetricsNaming getMetricsNaming()
MetricsNaming
is a structure that holds names of all metrics, each one can be changed individually.MetricsNaming
object (defaults to Vert.x names).public MicrometerMetricsOptions setMetricsNaming(MetricsNaming metricsNaming)
MetricsNaming
is 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, use setMetricsNaming(MetricsNaming.v3Names())
metricsNaming
- a MetricsNaming
object.Copyright © 2021 Eclipse. All rights reserved.