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.exemplar-filter

trace-based

Filter for which measurements can become Exemplars. Options: always-on, always-off, trace-based.

arconia.otel.metrics.interval

60s

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.

Table 2. General Metrics Exporter Configuration Properties

Property

Default

Description

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.

arconia.otel.metrics.exporter.type

otlp

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

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. 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.

Table 4. Micrometer Metrics Bridge Configuration Properties

Property

Default

Description

arconia.otel.instrumentation.micrometer.base-time-unit

seconds

The base time unit for Micrometer metrics.

arconia.otel.instrumentation.micrometer.histogram-gauges

true

Whether to generate gauge-based Micrometer histograms.