rust-prometheus icon indicating copy to clipboard operation
rust-prometheus copied to clipboard

Allow creating a GenericGaugeVec with Vec<String>

Open vrmiguel opened this issue 3 years ago • 0 comments

GenericGaugeVec::new's need for &[&str] can lead to inefficient code such as what can be seen here in The Graph's code, where a Vec<&str> is obtained from a Vec<String>, which is then sent as a slice to GenericGaugeVec::new, who clones the contents of the slice in order to again obtain a Vec<String>.

All those allocations could be avoided if there were a way of creating GenericGaugeVec with a Vec<String> directly, which is what this PR proposes.

The usage of GenericGaugeVec::new remains intact while a GenericGaugeVec::new_from_vec function has been added

vrmiguel avatar May 01 '21 22:05 vrmiguel