Labels

Undocumented in source.
version(unittest)
struct Labels {}

Members

Variables

id
hash_t id;
Undocumented in source.
job
cstring job;
Undocumented in source.
perf
float perf;
Undocumented in source.

Examples

Test collecting populated stats, but without any label.

auto test_collector = new Collector();
test_collector.collect(Statistics(3600, 347, 3.14, 6.023, 0.43));

test!("==")(test_collector.getCollection(),
    "up_time_s 3600\ncount 347\nratio 3.14\nfraction 6.023\n" ~
    "very_real 0.43\n");

Test collecting populated stats with one label

auto test_collector = new Collector();
test_collector.collect!("id")(
    Statistics(3600, 347, 3.14, 6.023, 0.43), 123.034);

test!("==")(test_collector.getCollection(),
    "up_time_s {id=\"123.034\"} 3600\ncount {id=\"123.034\"} 347\n" ~
    "ratio {id=\"123.034\"} 3.14\nfraction {id=\"123.034\"} 6.023\n" ~
    "very_real {id=\"123.034\"} 0.43\n");

Test collecting stats having initial values with multiple labels

auto test_collector = new Collector();
test_collector.collect(Statistics(3600, 347, 3.14, 6.023, 0.43),
    Labels(1_235_813, "ocean", 3.14159));

test!("==")(test_collector.getCollection(),
    "up_time_s {id=\"1235813\",job=\"ocean\",perf=\"3.14159\"} 3600\n" ~
    "count {id=\"1235813\",job=\"ocean\",perf=\"3.14159\"} 347\n" ~
    "ratio {id=\"1235813\",job=\"ocean\",perf=\"3.14159\"} 3.14\n" ~
    "fraction {id=\"1235813\",job=\"ocean\",perf=\"3.14159\"} 6.023\n" ~
    "very_real {id=\"1235813\",job=\"ocean\",perf=\"3.14159\"} 0.43\n");

Test resetting collected stats

auto test_collector = new Collector();
test_collector.collect!("id")(Statistics.init, 123);

test!("==")(test_collector.getCollection(),
    "up_time_s {id=\"123\"} 0\ncount {id=\"123\"} 0\n" ~
    "ratio {id=\"123\"} 0\nfraction {id=\"123\"} 0\n" ~
    "very_real {id=\"123\"} 0\n");

test_collector.reset();

test!("==")(test_collector.getCollection(), "");

Meta