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.
|
java.util.function.Function<HttpRequest,Iterable<io.micrometer.core.instrument.Tag>> |
getClientRequestTagsProvider() |
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()
Deprecated.
|
VertxPrometheusOptions |
getPrometheusOptions()
Get the specific options for Prometheus reporting.
|
String |
getRegistryName()
Get the metrics registry name set in these options
|
java.util.function.Function<HttpRequest,Iterable<io.micrometer.core.instrument.Tag>> |
getRequestsTagsProvider()
Deprecated.
use
getServerRequestTagsProvider instead |
java.util.function.Function<HttpRequest,Iterable<io.micrometer.core.instrument.Tag>> |
getServerRequestTagsProvider() |
boolean |
isJvmMetricsEnabled() |
boolean |
isMetricsCategoryDisabled(MetricsDomain metricsDomain)
Is the given metrics category disabled?
|
boolean |
isMetricsCategoryDisabled(String category)
Is the given metrics category disabled?
|
MicrometerMetricsOptions |
setClientRequestTagsProvider(java.util.function.Function<HttpRequest,Iterable<io.micrometer.core.instrument.Tag>> clientRequestTagsProvider)
Sets a custom tags provider for HTTP client requests.
|
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)
Deprecated.
instead use
MicrometerMetricsFactory(MeterRegistry) |
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.
|
MicrometerMetricsOptions |
setRequestsTagsProvider(java.util.function.Function<HttpRequest,Iterable<io.micrometer.core.instrument.Tag>> serverRequestTagsProvider)
Deprecated.
use
setServerRequestTagsProvider instead |
MicrometerMetricsOptions |
setServerRequestTagsProvider(java.util.function.Function<HttpRequest,Iterable<io.micrometer.core.instrument.Tag>> serverRequestTagsProvider)
Sets a custom tags provider for HTTP server requests.
|
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 match@Deprecated public io.micrometer.core.instrument.MeterRegistry getMicrometerRegistry()
setMicrometerRegistry(MeterRegistry)
@Deprecated public MicrometerMetricsOptions setMicrometerRegistry(io.micrometer.core.instrument.MeterRegistry micrometerRegistry)
MicrometerMetricsFactory(MeterRegistry)
public 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.@Deprecated public java.util.function.Function<HttpRequest,Iterable<io.micrometer.core.instrument.Tag>> getRequestsTagsProvider()
getServerRequestTagsProvider
instead@Deprecated public MicrometerMetricsOptions setRequestsTagsProvider(java.util.function.Function<HttpRequest,Iterable<io.micrometer.core.instrument.Tag>> serverRequestTagsProvider)
setServerRequestTagsProvider
insteadHttpRequest
object processed through the metrics SPI.serverRequestTagsProvider
- an object implementing the CustomTagsProvider
interface for HttpRequest
.public java.util.function.Function<HttpRequest,Iterable<io.micrometer.core.instrument.Tag>> getServerRequestTagsProvider()
public MicrometerMetricsOptions setServerRequestTagsProvider(java.util.function.Function<HttpRequest,Iterable<io.micrometer.core.instrument.Tag>> serverRequestTagsProvider)
HttpRequest
object processed through the metrics SPI.serverRequestTagsProvider
- an object that returns an iterable of Tag
for a HttpRequest
.public java.util.function.Function<HttpRequest,Iterable<io.micrometer.core.instrument.Tag>> getClientRequestTagsProvider()
public MicrometerMetricsOptions setClientRequestTagsProvider(java.util.function.Function<HttpRequest,Iterable<io.micrometer.core.instrument.Tag>> clientRequestTagsProvider)
HttpRequest
object processed through the metrics SPI.clientRequestTagsProvider
- an object that returns an iterable of Tag
for a HttpRequest
.Copyright © 2024 Eclipse. All rights reserved.