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. |
|
|
Whether exemplars should be enabled. |
|
|
Determines which measurements are eligible to become Exemplars. Options: |
OpenTelemetry Environment Variables
Arconia supports the OpenTelemetry Environment Variable Specification for configuring the OpenTelemetry integration. If both the OpenTelemetry Environment Variables and the Arconia configuration properties are set, the OpenTelemetry Environment Variables will take precedence.
This support is especially useful during deployment, where you can use the same set of standard environment variables to configure OpenTelemetry across different languages and frameworks.
You can disable this support by setting the arconia.otel.compatibility.environment-variable-specification configuration property to false.
Programmatic Configuration
You can further customize the auto-configured SdkMeterProvider instance via the OpenTelemetryMeterProviderBuilderCustomizer API.
@FunctionalInterface
public interface OpenTelemetryMeterProviderBuilderCustomizer {
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 SdkMeterProvider myMeterProvider() {
...
}
}
Exporting Metrics
By default, metrics are enabled and exported via OTLP, but you can change the type of exporter globally or specifically for metrics. If you set the exporter type to none, the corresponding signal will be disabled from exporting.
| If a value is not provided specifically for metrics, the value configured for the general exporter is used, if available. |
Property |
Default |
Description |
|
|
The type of OpenTelemetry exporter to use for observability signals. Options: |
|
|
The interval between two consecutive exports of metrics. |
|
`` |
The type of OpenTelemetry exporter to use for metrics. Options: |
|
|
The aggregation temporality to use for exporting metrics. Options: |
|
|
The aggregation strategy to use for exporting histograms. 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. |
|
|
Maximum number of retries. |
|
|
Initial backoff time. |
|
|
Maximum backoff time. |
|
|
Backoff multiplier. |
| The default OTLP exporter uses HTTP/Protobuf. If you’d like to use gRPC, refer to OTLP gRPC. |
Micrometer OTLP
Spring libraries and many other libraries from the Java ecosystem are instrumented using Micrometer Metrics. The Arconia OpenTelemetry Spring Boot Starter comes built-in with the Micrometer Metrics Registry OTLP provided by the Micrometer project, which exports Micrometer metrics directly to an OTLP endpoint without going through the OpenTelemetry API.
That means there will be two different exporters sending metrics to the same OTLP endpoint: the OpenTelemetry Metrics OTLP exporter (for metrics instrumented via OpenTelemetry API) and the Micrometer Metrics Registry OTLP (for metrics instrumented via Micrometer API).
| If you’d rather export Micrometer metrics via the OpenTelemetry API instead of using a separate Micrometer-specific exporter, refer to the Micrometer Metrics Support section. |
Enabling/Disabling
The Micrometer Metrics Registry OTLP can be disabled via configuration properties.
arconia.otel.exporter.otlp.micrometer.enabled: false
Alternatively, you can exclude the io.arconia:arconia-opentelemetry-micrometer-metrics-registry-otlp dependency from your project, which will disable the registry entirely.
-
Gradle
-
Maven
dependencies {
implementation("io.arconia:arconia-opentelemetry-spring-boot-starter") {
exclude group: "io.arconia", module: "arconia-opentelemetry-micrometer-metrics-registry-otlp"
}
}
<dependency>
<groupId>io.arconia</groupId>
<artifactId>arconia-opentelemetry-spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>io.arconia</groupId>
<artifactId>arconia-opentelemetry-micrometer-metrics-registry-otlp</artifactId>
</exclusion>
</exclusions>
</dependency>
Configuration Properties
On top of the general metrics and OTLP configuration described previously, the Micrometer Metrics Registry OTLP provides additional configuration properties.
Property |
Default |
Description |
|
|
Base time unit for Micrometer metrics. |
|
|
Default maximum number of buckets to be used for exponential histograms, if configured. This has no effect on explicit bucket histograms. |
|
|
Max scale to use for exponential histograms, if configured. |
Micrometer Metrics Support
Spring libraries and many other libraries from the Java ecosystem are instrumented using Micrometer Metrics. Arconia supports two ways to export Micrometer metrics to OpenTelemetry:
-
via the Micrometer Metrics Registry OTLP from the Micrometer project, which exports Micrometer metrics directly to an OTLP endpoint without going through the OpenTelemetry API;
-
via the Micrometer Metrics OpenTelemetry Bridge from the OpenTelemetry Java Instrumentation project.
The following table summarizes the differences between the two approaches:
| Aspect | Micrometer Metrics Registry OTLP | Micrometer Metrics OpenTelemetry Bridge |
|---|---|---|
Stable |
✅ |
❌ |
OpenTelemetry API |
❌ |
✅ |
Support non-OTLP exporters |
❌ |
✅ |
Support exemplars |
❌ |
✅ |
Support reading metrics |
✅ |
❌ |
Maintained by the Micrometer team |
✅ |
❌ |
By default, Arconia uses the Micrometer Metrics Registry OTLP. The main reason is that it’s stable and fully supported by the Micrometer project. However, if you need to export Micrometer metrics via the OpenTelemetry API, use a different exporter than OTLP, or need exemplar support, you can switch to the Micrometer Metrics OpenTelemetry Bridge instead. Refer to the Micrometer Metrics OpenTelemetry Bridge section for more details.
Micrometer Metrics OpenTelemetry Bridge (from OpenTelemetry Java Instrumentation)
Arconia optionally supports exporting Micrometer metrics via the Micrometer Metrics OpenTelemetry Bridge provided by the OpenTelemetry Java Instrumentation for Micrometer, which is based on the OpenTelemetry API and integrates fully with the OpenTelemetry SDK.
| The Micrometer Metrics OpenTelemetry Bridge from the OpenTelemetry Java Instrumentation project is still experimental. |
The OpenTelemetryMeterRegistry bean registered by this bridge doesn’t support reading metrics, but only bridging them to OpenTelemetry. For that reason, an additional SimpleMeterRegistry bean is registered for reading Micrometer metrics, an operation typically performed by the Spring Boot Actuator library.
|
Enabling/Disabling the Bridge
By default, the Arconia OpenTelemetry Spring Boot Starter comes built-in with the Micrometer Metrics Registry OTLP. You can choose to remove it and use the Micrometer Metrics OpenTelemetry Bridge instead. To achieve that, exclude the io.arconia:arconia-opentelemetry-micrometer-metrics-registry-otlp dependency from your project and include the io.arconia:arconia-opentelemetry-micrometer-metrics-bridge dependency instead.
-
Gradle
-
Maven
dependencies {
implementation("io.arconia:arconia-opentelemetry-spring-boot-starter") {
exclude group: "io.arconia", module: "arconia-opentelemetry-micrometer-metrics-registry-otlp"
}
implementation("io.arconia:arconia-opentelemetry-micrometer-metrics-bridge")
}
<dependency>
<groupId>io.arconia</groupId>
<artifactId>arconia-opentelemetry-spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>io.arconia</groupId>
<artifactId>arconia-opentelemetry-micrometer-metrics-registry-otlp</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.arconia</groupId>
<artifactId>arconia-opentelemetry-micrometer-metrics-bridge</artifactId>
</dependency>
If the Micrometer Metrics OpenTelemetry Bridge is included in the project, it will be auto-configured by default. You can disable it via configuration properties.
arconia.otel.metrics.micrometer-bridge.enabled: false
| The Micrometer Metrics OpenTelemetry Bridge is mutually exclusive with the Micrometer Metrics Registry OTLP. If you have both dependencies in your project, it will be up to you to explicitly disable one of the two options via configuration properties or else neither will be auto-configured. |
Configuration Properties
The Micrometer Metrics OpenTelemetry Bridge can be configured via configuration properties.
Property |
Default |
Description |
|
|
The base time unit for Micrometer metrics. |
|
|
Whether to generate gauge-based Micrometer histograms. |