Skip to content

Conversation

@zhang-guodong
Copy link
Contributor

Hi maintainers,

I noticed that input plugin metric_system_v2 reports fd_max as float64. However, fd_max is fixed at max int64(2^63-1 or 9223372036854775807), which exceeds the range of float64. Therefore, the data, with its loss of precision, is represented as 9.223372036854776e+18 in Metric.

allocated, _ := strconv.ParseFloat(string(parts[0]), 64)
maximum, _ := strconv.ParseFloat(string(parts[2]), 64)
r.addMetric(collector, "fd_allocated", &r.commonLabels, allocated)
r.addMetric(collector, "fd_max", &r.commonLabels, maximum)

Since the metric is eventually converted to a string (see log_helper.go#L258), it would be more accurate to record fd_max directly as a string.

Alternatively, how about considering simply removing fd_max, since it's a constant on Linux anyway?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant