File: example_edition_2018.rs

package info (click to toggle)
rust-prometheus 0.13.4-4
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 740 kB
  • sloc: makefile: 25
file content (24 lines) | stat: -rw-r--r-- 988 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Copyright 2019 TiKV Project Authors. Licensed under Apache-2.0.

use prometheus::register_counter;

/// small example that uses rust 2018 style macro imports

#[allow(unused)]
fn main() {
    register_counter!("test_macro_3", "help");
    prometheus::register_counter_vec!("errorz", "errors", &["error"]).unwrap();
    prometheus::register_gauge!("test_macro_gauge_2", "help");
    prometheus::register_gauge_vec!("test_macro_gauge_vec_3", "help", &["a", "b"]);
    prometheus::register_histogram!("test_macro_histogram_4", "help", vec![1.0, 2.0]);
    prometheus::register_histogram_vec!(
        "test_macro_histogram_4",
        "help",
        &["a", "b"],
        vec![1.0, 2.0]
    );
    prometheus::register_int_counter!("meh", "foo");
    prometheus::register_int_counter_vec!("errorz", "errors", &["error"]).unwrap();
    prometheus::register_int_gauge!("test_macro_gauge_2", "help");
    prometheus::register_int_gauge_vec!("test_macro_gauge_vec_4", "help", &["a", "b"]);
}