Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/cmetrics/src/cmt_encode_prometheus.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Comment on lines 373 to 382
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a regression unit test to cover this formatting behavior (large histogram bucket boundaries that are rendered in scientific notation should not get a trailing ".0" in the exported Prometheus le label). This helps prevent reintroducing malformed labels like "1e+08.0".

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot apply changes based on this feedback

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks great but we need to register changes which intent to cmetrics into https://github.com/fluent/cmetrics. This is because under lib directory is handled as bundled libraries.


Expand Down