Metrics Exposer 1.5.0 Readme

Configuration

Metrics Exposer offers some level of configuration. For example, you can enable or disable SSL. It’s also possible to provide multiple Prometheus configurations, setting or not one as the default.

Server SSL


Metrics Exposer can expose its endpoint under HTTPS protocol, and in that case, it will need the server certificate.

When server.ssl.enabled=true, you have to pass a Keystore to build the SSL context used by Metrics Exposer.

This server keystore can be passed with server.ssl properties

Parameter Description Example

server.port

Server HTTP(s) port

9080

server.ssl.enabled

Whether to enable SSL support

true

server.ssl.enabled-protocols

Enabled SSL protocols

TLSv1.2

server.ssl.key-store

Path to the key store that holds the SSL certificate

${HOME}/axual_local_data/security/metrics-exposer/metrics-exposer.server.keystore.jks

server.ssl.key-store-type

Type of the key store

JKS

server.ssl.key-alias

The alias under which the key is stored in the keystore.

demo https services

server.ssl.key-password

Password used to access the key in the key store

notsecret

server.ssl.key-store-password

Password used to access the key store

notsecret


Axual Security


Metrics Exposer connects to Prometheus to retrieve metrics, to allow connecting to an https URL we need to provide a truststore that holds all certificates Metrics Exposer is allowed to trust

This truststore can be passed with axual.security properties

Parameter Description Example

axual.security.trust-store

Path to the trust store that holds the trusted CA certificate

${HOME}/axual_local_data/security/metrics-exposer/metrics-exposer.client.truststore.jks

axual.security.trust-store-password

Password used to access the trust store

notsecret


Configuring Metrics Exposer


Metrics Exposer allows the user to configure the prometheusUrls, and the labelBlackList via configuration.

You can specify the prometheus url for a tenant name by passing a configuration map like the following:

metrics-exposer:
  prometheus-urls:
    default: http://localhost:9090
    # <tenant-name>: <prometheus-url>

By default, Metrics Exposer retrieves all labels returned by Prometheus in its response. If you want to filter labels out of Metrics Exposer’s response, you can do so by configuring the following:

metrics-exposer:
   label-black-list:
      - 'container'
      - 'endpoint'
      - 'instance'

Labels that are defined in the configuration will be filtered in the Metrics Exposer’s response.


OpenTelemetry Tracing Configuration

The service uses spring-boot-starter-opentelemetry for distributed tracing.

By default, tracing is enabled with 100% sampling, but OTLP export is disabled.

Enabling Trace Export

To export traces to an OTLP collector (such as Jaeger, Prometheus, or others), configure:

management:
  tracing:
    export:
      enabled: true
  opentelemetry:
    tracing:
      export:
        otlp:
          endpoint: http://otlp-collector:4317  # Replace with your OTLP collector URL
          transport: grpc  # Export protocol: grpc or http/protobuf
          headers: # Custom HTTP headers you want to pass to the collector, for example auth headers.
            key: value

Adjusting Sampling

The trace.sampling.probability property controls the fraction of spans that are collected. Setting it to 1.0 means all spans will be exported.

To adjust the sampling rate (default is 100%):

management:
  tracing:
    sampling:
      probability: 0.1  # 10% sampling

Support for Spring Boot 3.5.x properties

The service has support for Spring Boot 3.5.x OpenTelemetry properties.

You can use the following Spring Boot 3.5.x properties to configure OpenTelemetry:

management:
  tracing:
    enabled: true
  otlp:
    tracing:
      endpoint: http://otlp-collector:4317  # Replace with your OTLP collector URL
      transport: grpc  # Export protocol: grpc or http/protobuf
      headers: # Custom HTTP headers you want to pass to the collector, for example auth headers.
        key: value

The service will map each Spring Boot 3.5.x property to the corresponding Spring Boot 4.x OpenTelemetry property.

Spring Boot 3.5.x property Spring Boot 4.x property Default value

management.tracing.enabled

management.tracing.export.enabled

false

management.otlp.tracing.compression

management.opentelemetry.tracing.export.otlp.compression

"none"

management.otlp.tracing.connect-timeout

management.opentelemetry.tracing.export.otlp.connect-timeout

10s

management.otlp.tracing.endpoint

management.opentelemetry.tracing.export.otlp.endpoint

""

management.otlp.tracing.export.enabled

management.tracing.export.otlp.enabled

true

management.otlp.tracing.headers

management.opentelemetry.tracing.export.otlp.headers

""

management.otlp.tracing.timeout

management.opentelemetry.tracing.export.otlp.timeout

10s

management.otlp.tracing.transport

management.opentelemetry.tracing.export.otlp.transport

"http"