fn format_metric(key: &str, value: &str, labels: Option<&HashMap<String, String>>) -> String {
    let mut result = key.to_string();
    if let Some(labels) = labels {
        result.push('{');
        for (k, v) in labels.iter() {
            result.push_str(&format!("{}=\"{}\",", k, v.replace("\"", "_")));
        }
        result.remove(result.len() - 1);
        result.push('}');
    }
    result.push_str(&format!(" {}\n", value));
    result
}
/// Returns a well formatted Prometheus metric string.
Returns a well formatted Prometheus metric string.
Returns a well formatted Prometheus metric string .
fn format_metric(key: &str, value: &str, labels: Option<&HashMap<String, String>>) -> String {
    let mut result = key.to_string();
    if let Some(labels) = labels {
        result.push('{');
        for (k, v) in labels.iter() {
            result.push_str(&format!("{}=\"{}\",", k, v.replace("\"", "_")));
        }
        result.remove(result.len() - 1);
        result.push('}');
    }
    result.push_str(&format!(" {}\n", value));
    result
}
fn format_metric ( key : & str , value : & str , labels : Option < & HashMap < String , String > > ) -> String { let mut result = key . to_string ( ) ; if let Some ( labels ) = labels { result . push ( '{' ) ; for ( k , v ) in labels . iter ( ) { result . push_str ( & format ! ( " \" \" " k v replace ( " \" " " " ) ) ) ; } result . remove ( result . len ( ) - 1 ) ; result . push ( '}' ) ; } result . push_str ( & format ! ( " \n " value ) ) ; result }
Returns a well formatted Prometheus metric string.
Returns a well formatted Prometheus metric string .
key
&str
value
&str
labels
Option<&HashMap<String, String>>
key
&str
value
&str
labels
Option<&HashMap<String, String>>