rust-prometheus
rust-prometheus copied to clipboard
Allow creating a GenericGaugeVec with Vec<String>
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