Skip to content

Implement 'to_metrics' in Rust

Will Chandler (ex-GitLab) requested to merge wc/riir-to-metrics into master

This is a Rust rewrite using the magnus library of the to_metrics method in the fast_mmaped_file Ruby C extension. It strives to match the behavior of the C implementation as closely as possible, with the exception of additional checks for correctness.

All active specs are passing and no failures have been found from 100,000 fuzzing runs.

The output of to_metrics is not identical to the existing extension as floating point values are occasionally slight different, e.g. 0.0009244309985660948 vs 0.00092443099856609479. My guess is this is due to differences in float formatting between libc and the Rust standard library. I've attached the output of to_metrics from the C and Rust implementation for comparison.

Edited by Will Chandler (ex-GitLab)

Merge request reports

Loading