-
Notifications
You must be signed in to change notification settings - Fork 40.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prometheus Exemplars are missing from _count #40904
Comments
Hello Jonatan, for 1: public Properties prometheusProperties() {
return get(this::fromPropertiesMap, PrometheusConfig.super::prometheusProperties);
} and this protected final <V> V get(Function<T, V> getter, Supplier<V> fallback) {
V value = getter.apply(this.properties);
return (value != null) ? value : fallback.get();
} So if With our invocation, if Looking at Map<String, String> map = prometheusProperties.getProperties();
if (map.isEmpty()) {
return null;
} So if there are no user-defined properties, we return This looks fine to me, or have I overlooked something? |
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed. |
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue. |
The bot reminded me that there's something pending. I gave it another look, and it looks like that point 1 that @jonatan-ivanov has raised isn't valid, but the 2nd is. I have something in https://github.com/mhalbritter/spring-boot/tree/mh/40904-prometheus-exemplars-are-missing-from-_count, but I need to play around with it a bit more. |
I also added a smoke test to verify that it doesn't break in the future. |
Sorry for the late response, you are right about I looked at your fix in Lines 73 to 78 in 7d96789
What do you think about renaming I also checked the latest snapshots, it works, thank you very much! |
Thanks for the feedback! Sounds good, will rename the parameter. |
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:
PrometheusPropertiesConfigAdapter
does not respect the Micrometer defaults for "Prometheus Properties" (these) when there are no user-defined custom properties set:spring-boot/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/prometheus/PrometheusPropertiesConfigAdapter.java
Lines 65 to 74 in 82d8222
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.PrometheusOutputFormat
does not use these properties when it initializes the exporters:spring-boot/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/prometheus/PrometheusOutputFormat.java
Line 81 in 82d8222
Since
PrometheusOutputFormat
callsExpositionFormats.init()
instead ofExpositionFormats.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 theresources
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:
and you will need Micrometer's (1.13.x) Prometheus (1.x) registry and Micrometer Tracing: start.spring.io example
The text was updated successfully, but these errors were encountered: