Skip to content

Prometheus Exemplars are missing from _count #40904

@jonatan-ivanov

Description

@jonatan-ivanov

It seems that 3.3.0 introduced a regression during the migration of Prometheus 1.x: exemplars are missing from _count time series.

I think there are two bugs that are causing this:

  1. It seems PrometheusPropertiesConfigAdapter does not respect the Micrometer defaults for "Prometheus Properties" (these) when there are no user-defined custom properties set:
    private Properties fromPropertiesMap(PrometheusProperties prometheusProperties) {
    Map<String, String> map = prometheusProperties.getProperties();
    if (map.isEmpty()) {
    return null;
    }
    Properties properties = PrometheusConfig.super.prometheusProperties();
    properties = (properties != null) ? properties : new Properties();
    properties.putAll(map);
    return properties;
    }

    It seems Micrometer defaults (PrometheusConfig.super.prometheusProperties()) are only respected and merged with user-defined custom properties when they present, otherwise Micrometer defaults are ignored. This is a problem since Micrometer sets some defaults which can be ignored or not ignored depending on the presence of user-defined properties.
  2. Ignoring Micrometer defaults could have been worked around by manually setting them from user-properties (or by setting any custom Prometheus property) but another bug prevents them to take effect on the exporter. It seems PrometheusOutputFormat does not use these properties when it initializes the exporters:
    Since PrometheusOutputFormat calls ExpositionFormats.init() instead of ExpositionFormats.init(ExporterProperties), no property set by Micrometer/Boot/user can have any effect on the exporters since they are ignored (in comparison, Micrometer does this).

One workaround could be using the Prometheus property loading mechanism. Adding a prometheus.properties file to the classpath for example placing it to the resources folder with the following content brings exemplars on _count back:

io.prometheus.exporter.exemplarsOnAllMetricTypes=true

In order to reproduce it, you need to ask for the OpenMetrics format from Boot:

http :8080/actuator/prometheus 'Accept: application/openmetrics-text; version=1.0.0' | grep 'trace_id'

and you will need Micrometer's (1.13.x) Prometheus (1.x) registry and Micrometer Tracing: start.spring.io example

Metadata

Metadata

Assignees

Labels

type: regressionA regression from a previous release

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions