Interface MetricsConfig
- All Superinterfaces:
Prototype.Api
- All Known Implementing Classes:
MetricsConfig.BuilderBase.MetricsConfigImpl
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classFluent API builder forMetricsConfig.static classMetricsConfig.BuilderBase<BUILDER extends MetricsConfig.BuilderBase<BUILDER, PROTOTYPE>, PROTOTYPE extends MetricsConfig>Fluent API builder base forMetricsConfig. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final TimeUnitDefault JSON unit.static final StringConfig key for KPI metrics settings.static final StringThe config key containing settings for all of metrics.static final StringDeprecated, for removal: This API element is subject to removal in a future version.Core metrics ignores scope configuration, and this constant will be removed. -
Method Summary
Modifier and TypeMethodDescriptionappName()Value for the application tag to be added to each meter ID.Name for the application tag to be added to each meter ID.static MetricsConfig.Builderbuilder()Create a new fluent API builder to customize configuration.static MetricsConfig.Builderbuilder(MetricsConfig instance) Create a new fluent API builder from an existing instance.Output format for built-in meter names.config()Metrics configuration node.static MetricsConfigcreate()Create a new instance with default values.static MetricsConfigCreate a new instance from configuration.booleanenabled()Whether metrics functionality is enabled.default booleanisMeterEnabled(String name) Determines whether the meter with the specified name is enabled.default booleanisMeterEnabled(String name, String scope) Deprecated, for removal: This API element is subject to removal in a future version.default booleanisScopeEnabled(String scope) Deprecated, for removal: This API element is subject to removal in a future version.Core metrics does not apply scope filtering, and this method will be removed.Default units for timer output in JSON if not specified on a given timer.Key performance indicator metrics settings.lookupConfig(String key) Looks up a single config value within the metrics configuration by config key.booleanWhether to allow anybody to access the metrics endpoint when this config is used by a metrics observer.Metrics publishers which make the metrics data available to external systems.default booleanIndicates if publishers were specified, either by the application adding any programmatically or if the config contained thepublishersnode.booleanWhether automatic REST request metrics should be measured.roles()Role names allowed to access the metrics endpoint when this config is used by a metrics observer andpermitAll()isfalse.scoping()Deprecated, for removal: This API element is subject to removal in a future version.Core metrics ignores these settings, and this method will be removed.tags()Global tags.booleanWhether Helidon should expose meters related to virtual threads.Threshold for sampling pinned virtual threads to include in the pinned threads meter.booleanWhether to log warnings when multiple registries are created.
-
Field Details
-
METRICS_CONFIG_KEY
The config key containing settings for all of metrics.- See Also:
-
SCOPE_CONFIG_KEY
Deprecated, for removal: This API element is subject to removal in a future version.Core metrics ignores scope configuration, and this constant will be removed.Legacy scope configuration key retained for compatibility.- See Also:
-
KEY_PERFORMANCE_INDICATORS_CONFIG_KEY
Config key for KPI metrics settings.- See Also:
-
DEFAULT_JSON_UNITS_DEFAULT
Default JSON unit.
-
-
Method Details
-
builder
Create a new fluent API builder to customize configuration.- Returns:
- a new builder
-
builder
Create a new fluent API builder from an existing instance.- Parameters:
instance- an existing instance used as a base for the builder- Returns:
- a builder based on an instance
-
create
Create a new instance from configuration.- Parameters:
config- used to configure the new instance- Returns:
- a new instance configured from configuration
-
create
-
lookupConfig
-
publishersConfigured
default boolean publishersConfigured()Indicates if publishers were specified, either by the application adding any programmatically or if the config contained thepublishersnode.- Returns:
- true if publishers were assigned or configured, false otherwise
-
isScopeEnabled
Deprecated, for removal: This API element is subject to removal in a future version.Core metrics does not apply scope filtering, and this method will be removed.Always returnstruebecause core metrics does not apply scope filtering.- Parameters:
scope- ignored; must not benull- Returns:
- true
-
isMeterEnabled
Determines whether the meter with the specified name is enabled.- Parameters:
name- meter name- Returns:
- whether the meter is enabled
-
isMeterEnabled
@Deprecated(forRemoval=true, since="27.0.0") default boolean isMeterEnabled(String name, String scope) Deprecated, for removal: This API element is subject to removal in a future version.UseisMeterEnabled(String). Scope is ignored and this method will be removed.Determines whether the meter with the specified name is enabled, ignoring the scope.- Parameters:
name- meter namescope- ignored; must not benull- Returns:
- whether the meter is enabled
-
enabled
boolean enabled()Whether metrics functionality is enabled.- Returns:
- if metrics are configured to be enabled
-
permitAll
boolean permitAll()Whether to allow anybody to access the metrics endpoint when this config is used by a metrics observer. This setting has no effect in the top-levelmetricsconfig which controls the shared registry.- Returns:
- whether to permit access to the observer's metrics endpoint to anybody, defaults to
true - See Also:
-
roles
Role names allowed to access the metrics endpoint when this config is used by a metrics observer andpermitAll()isfalse. This setting has no effect in the top-levelmetricsconfig which controls the shared registry.- Returns:
- allowed role names
-
keyPerformanceIndicatorMetricsConfig
KeyPerformanceIndicatorMetricsConfig keyPerformanceIndicatorMetricsConfig()Key performance indicator metrics settings.- Returns:
- key performance indicator metrics settings
-
tags
-
appName
-
appTagName
-
scoping
Deprecated, for removal: This API element is subject to removal in a future version.Core metrics ignores these settings, and this method will be removed.Returns scope settings retained for compatibility; core metrics ignores them.- Returns:
- configured scope settings
-
restRequestEnabled
boolean restRequestEnabled()Whether automatic REST request metrics should be measured.- Returns:
- true/false
-
virtualThreadsEnabled
boolean virtualThreadsEnabled()Whether Helidon should expose meters related to virtual threads.- Returns:
- true to include meters related to virtual threads
-
virtualThreadsPinnedThreshold
Duration virtualThreadsPinnedThreshold()Threshold for sampling pinned virtual threads to include in the pinned threads meter.- Returns:
- threshold used to filter virtual thread pinning events
-
config
-
builtInMeterNameFormat
BuiltInMeterNameFormat builtInMeterNameFormat()Output format for built-in meter names.BuiltInMeterNameFormat.SNAKEselects "snake_case" which does not conform to the MicroProfile Metrics specification.- Returns:
- the output format for built-in meter names
-
jsonUnitsDefault
Default units for timer output in JSON if not specified on a given timer.If the configuration key is absent, the Helidon JSON output uses
TimeUnit.SECONDS. If the configuration key is present, Helidon formats each timer using that timer's specific units (if set) and the config value otherwise.- Returns:
- default
TimeUnitto use for JSON timer output
-
warnOnMultipleRegistries
boolean warnOnMultipleRegistries()Whether to log warnings when multiple registries are created.By far most applications use a single meter registry, but certain app or library programming errors can cause Helidon to create more than one. By default, Helidon logs warning messages for each additional meter registry created. This setting allows users with apps that need multiple meter registries to suppress those warnings.
- Returns:
- whether to log warnings upon creation of multiple meter registries
-
publishers
List<MetricsPublisher> publishers()Metrics publishers which make the metrics data available to external systems. Helidon's Micrometer-based metrics provider includes publishers with the config keysprometheus(inferred by default) andotlp. See the config reference entries forio.helidon.metrics.providers.micrometer.PrometheusPublisherandio.helidon.metrics.providers.micrometer.OtlpPublisher.- Returns:
- metrics publishers
-