Skip to content

Expose Rust extension for use in marshaling metrics and read/write values

Will Chandler (ex-GitLab) requested to merge wc/optional-rust into master

To allow the MmapedFile to optionally consume fast_mmaped_file_rs instead of fast_mmaped_file, we perform an initial class declaration to establish inheritance. This allows us to reuse the class method definitions.

Ideally we'd add a configuration parameter to set this option. However, when I attempted to implement this, it created a circular dependency between MmapedValue and MmapedFile, causing the following failure:

NameError:
uninitialized constant Prometheus::Client::MmapedValue

To work around this, we instead check if the prometheus_rust_mmaped_file environment exists and is set to true and that the Rust extension is loaded.

Also allow library users to configure the exporter to use fast_mmaped_file_rs either via the prometheus_rust_multiprocess_metrics environment variable or setting the rust_multiprocess_metrics configuration value.

We provide the environment variable option to stay consistent with the prometheus_rust_mmaped_file variable used to enable the Rust extension for read/write operations on mmapped files.

Edited by Will Chandler (ex-GitLab)

Merge request reports

Loading