diff --git a/lib/cmetrics/src/cmt_encode_prometheus.c b/lib/cmetrics/src/cmt_encode_prometheus.c index b5f76149c75..8e3bfd07531 100644 --- a/lib/cmetrics/src/cmt_encode_prometheus.c +++ b/lib/cmetrics/src/cmt_encode_prometheus.c @@ -373,7 +373,11 @@ static cfl_sds_t bucket_value_to_string(double val) len = snprintf(str, 64, "%g", val); cfl_sds_len_set(str, len); - if (!strchr(str, '.')) { + /* + * Append .0 only when there is no decimal point and the number + * is not in scientific notation. + */ + if (!strchr(str, '.') && !strchr(str, 'e')) { cfl_sds_cat_safe(&str, ".0", 2); }