Function prometheus::push_metrics[][src]

pub fn push_metrics<S: BuildHasher>(
    job: &str,
    grouping: HashMap<String, String, S>,
    url: &str,
    mfs: Vec<MetricFamily>,
    basic_auth: Option<BasicAuthentication>
) -> Result<()>

push_metrics pushes all gathered metrics to the Pushgateway specified by url, using the provided job name and the (optional) further grouping labels (the grouping map may be nil). See the Pushgateway documentation for detailed implications of the job and other grouping labels. Neither the job name nor any grouping label value may contain a “/”. The metrics pushed must not contain a job label of their own nor any of the grouping labels.

You can use just host:port or ip:port as url, in which case ‘http://’ is added automatically. You can also include the schema in the URL. However, do not include the ‘/metrics/jobs/…’ part.

Note that all previously pushed metrics with the same job and other grouping labels will be replaced with the metrics pushed by this call. (It uses HTTP method ‘PUT’ to push to the Pushgateway.)