micrometer-metrics / micrometer

An application observability facade for the most popular observability tools. Think SLF4J, but for observability.
https://micrometer.io
Apache License 2.0
4.43k stars 977 forks source link

process_start_time_seconds HELP description inconsistency between Prometheus and micrometer #5290

Open weissn1 opened 1 month ago

weissn1 commented 1 month ago

According to Prometheus documentation (https://prometheus.io/docs/instrumenting/writing_clientlibs/#process-metrics), the HELP string of the metric "process_start_time_seconds" needs to be "Start time of the process since unix epoch in seconds.", but in micrometer it is "Start time of the process since unix epoch."

Currently, if two metrics of the same name but with different HELP description are pushed into the same group, the Pushgateway will notice, pick one HELP message over the other and write a warning message in the logs.

For example:

msg="metric families inconsistent help strings" err="Metric families have inconsistent help strings. The latter will have priority. This is bad. Fix your pushed metrics!"

msg="metric families overlap" err="Metric family has the same name as a metric family used by the Pushgateway itself but it has a different help string. Changing it to the standard help string. This is bad. Fix your pushed metrics!"

Can we fix this HELP description in micrometer to stop these logs?

Environment

Please refer to the following issue: #2413 I understand that we can't change the general description under UptimeMetrics since other registries don't necessarily use seconds as their time unit.

        TimeGauge.builder("process.start.time", runtimeMXBean, TimeUnit.MILLISECONDS, RuntimeMXBean::getStartTime)
            .tags(tags)
            .description("Start time of the process since unix epoch.")
            .register(registry);

But I believe that we can change the description for the Prometheus registry by adding a new MeterFilter under PrometheusRenameFilter.

shakuzen commented 1 month ago

I think we can add it to the PrometheusRenameFilter. Would you be willing to submit a pull request for it?