OpenTelemetry Metrics
Metrics are quantitative measurements of an application, captured and aggregated at runtime in regular time intervals. This page describes how to configure the metrics support in OpenTelemetry.
Learn more about metrics in the OpenTelemetry documentation. |
Enabling/Disabling Metrics
Support for OpenTelemetry Metrics is enabled by default. You can disable it via configuration properties.
arconia:
otel:
metrics:
enabled: false
Configuration Properties
You can configure the support for OpenTelemetry Metrics via configuration properties.
Property |
Default |
Description |
|
|
Maximum number of distinct points per metric. |
|
|
Filter for which measurements can become Exemplars. Options: |
|
|
The interval between two consecutive exports of metrics. |
OpenTelemetry Environment Variables
Arconia supports the OpenTelemetry Environment Variable Specification, so you can configure the support for OpenTelemetry Metrics using environment variables as well.
This support is especially useful during deployment, where you can use the same set of standard environment variables to configure OpenTelemetry Metrics across different languages and frameworks.
OpenTelemetry Java System Properties
Arconia supports the OpenTelemetry Java System Properties in alignment with the OpenTelemetry Java SDK Autoconfigure module. So you can configure the support for OpenTelemetry Metrics using system properties as well.
This support is especially useful if you’re migrating from the OpenTelemetry-own Spring Boot Starter to Arconia OpenTelemetry, and you want to minimize the changes in your configuration. Check our migration guide for more information.
When possible, we recommend using the Arconia-specific properties instead of the OpenTelemetry Java system properties since they offer a more consistent configuration experience familiar to Spring Boot users.
Programmatic Configuration
You can further customize the auto-configured SdkMeterProvider
instance via the SdkMeterProviderBuilderCustomizer
API.
@FunctionalInterface
public interface SdkMeterProviderBuilderCustomizer {
void customize(SdkMeterProviderBuilder builder);
}
Disabling the Auto-Configuration
The auto-configuration provided by Arconia for OpenTelemetry Metrics is enabled by default, but you can disable it as explained in the Enabling/Disabling Metrics section.
If you define a custom SdkMeterProvider
bean, the auto-configuration will back off, and your custom bean will be used instead.
@Configuration(proxyBeanMethods = false)
public class MyMetricsConfiguration {
@Bean
public SdkLoggerProvider myLoggerProvider() {
...
}
}
You can also disable the auto-configuration entirely by excluding the io.arconia.opentelemetry.autoconfigure.sdk.metrics.OpenTelemetryMetricsAutoConfiguration
class from the Spring Boot auto-configuration:
spring:
autoconfigure:
exclude:
- io.arconia.opentelemetry.autoconfigure.sdk.metrics.OpenTelemetryMetricsAutoConfiguration
Exporting Metrics
By default, metrics are enabled and exported via OTLP, but you can change the type of exporter. If you set the exporter type to none
, the corresponding signal will be disabled from exporting.
Property |
Default |
Description |
|
|
The aggregation temporality to use for exporting metrics. Options: |
|
|
The aggregation strategy to use for exporting histograms. Options: |
|
|
The type of OpenTelemetry exporter to use for metrics. Options: |
For more information on exporting metrics to the console, refer to Console Exporter. |
OTLP
When metrics are exported via OTLP (default behavior), you can configure the following properties.
If a value is not provided specifically for metrics, the value configured for the general OTLP export is used, if available. See OTLP. |
Property |
Default |
Description |
|
|
Compression type to use for OTLP requests. Options: |
|
|
The maximum waiting time for the exporter to establish a connection to the endpoint. |
|
|
The endpoint to which telemetry data will be sent. |
|
- |
Additional headers to include in each request to the endpoint. |
|
|
Whether to generate metrics for the exporter itself. |
|
|
Transport protocol to use for OTLP requests. Options: |
|
|
The maximum waiting time for the exporter to send each telemetry batch. |
The default OTLP exporter uses HTTP/Protobuf. If you’d like to use gRPC, refer to OTLP gRPC. |
Micrometer Metrics Bridge
Spring libraries and many other libraries from the Java ecosystem are instrumented using Micrometer Metrics. The Arconia OpenTelemetry Spring Boot Starter provides a bridge that allows you to convert Micrometer metrics into OpenTelemetry Metrics and export them via OTLP.
Enabling/Disabling the Bridge
The bridge logic is provided by the OpenTelemetry Java Instrumentation for Micrometer and can be disabled selectively via configuration properties.
arconia:
otel:
instrumentation:
micrometer:
enabled: false
Note: Refer to the Instrumentation section for more information on how Arconia integrates the OpenTelemetry Java Instrumentation.
Configuration Properties
The Micrometer Metrics Bridge can be configured via configuration properties.
Property |
Default |
Description |
|
|
The base time unit for Micrometer metrics. |
|
|
Whether to generate gauge-based Micrometer histograms. |