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.

Table 1. Metrics Configuration Properties

Property

Default

Description

arconia.otel.metrics.cardinality-limit

2000

Maximum number of distinct points per metric.

arconia.otel.metrics.exemplars.enabled

true

Whether exemplars should be enabled.

arconia.otel.metrics.exemplars.filter

trace-based

Determines which measurements are eligible to become Exemplars. Options: always-on, always-off, trace-based.

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 Logs 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.
Table 2. General Metrics Exporter Configuration Properties

Property

Default

Description

arconia.otel.exporter.type

otlp

The type of OpenTelemetry exporter to use for observability signals. Options: console, otlp, none.

arconia.otel.metrics.exporter.interval

60s

The interval between two consecutive exports of metrics.

arconia.otel.metrics.exporter.type

``

The type of OpenTelemetry exporter to use for metrics. Options: console, otlp, none.

arconia.otel.metrics.exporter.aggregation-temporality

cumulative

The aggregation temporality to use for exporting metrics. Options: cumulative, delta, low-memory.

arconia.otel.metrics.exporter.histogram-aggregation

explicit-bucket-histogram

The aggregation strategy to use for exporting histograms. Options: base2-exponential-bucket-histogram, explicit-bucket-histogram.

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.
Table 3. OTLP Metrics Exporter Configuration Properties

Property

Default

Description

arconia.otel.metrics.exporter.otlp.compression

gzip

Compression type to use for OTLP requests. Options: none, gzip.

arconia.otel.metrics.exporter.otlp.connect-timeout

10s

The maximum waiting time for the exporter to establish a connection to the endpoint.

arconia.otel.metrics.exporter.otlp.endpoint

http://localhost:4317 (gPRC) or http://localhost:4318/v1/metrics (HTTP)

The endpoint to which telemetry data will be sent.

arconia.otel.metrics.exporter.otlp.headers

-

Additional headers to include in each request to the endpoint.

arconia.otel.metrics.exporter.otlp.metrics

false

Whether to generate metrics for the exporter itself.

arconia.otel.metrics.exporter.otlp.protocol

http-protobuf

Transport protocol to use for OTLP requests. Options: grpc, http-protobuf.

arconia.otel.metrics.exporter.otlp.timeout

10s

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. Arconia supports bridges to export Micrometer Metrics to OpenTelemetry.

Micrometer Metrics OpenTelemetry Bridge (from OpenTelemetry Java Instrumentation)

The Arconia OpenTelemetry Spring Boot Starter comes built-in with 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

The Micrometer Metrics OpenTelemetry Bridge can be disabled via configuration properties.

arconia.otel.metrics.micrometer-bridge.enabled: false

Alternatively, you can exclude the io.arconia:arconia-opentelemetry-micrometer-metrics-bridge dependency from your project, which will disable the bridge entirely.

  • Gradle

  • Maven

dependencies {
    implementation("io.arconia:arconia-opentelemetry-spring-boot-starter") {
        exclude group: "io.arconia", module: "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-bridge</artifactId>
        </exclusion>
    </exclusions>
</dependency>

Configuration Properties

The Micrometer Metrics OpenTelemetry Bridge can be configured via configuration properties.

Table 4. Micrometer Metrics OpenTelemetry Bridge Configuration Properties

Property

Default

Description

arconia.otel.metrics.micrometer-bridge.base-time-unit

seconds

The base time unit for Micrometer metrics.

arconia.otel.metrics.micrometer-bridge.histogram-gauges

true

Whether to generate gauge-based Micrometer histograms.