1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
class TestRandom
def initialize(collector, config)
@collector = collector
@config = config
end
def raid
# Clean up any previously reported metrics
# to prevent stale labelsets
@collector.redact!("die_roll")
# Report new metrics
@collector.report!(
"die_roll",
rand(4) + 1,
help: "A random value from 1 to 4 inclusive",
type: "gauge",
labels: { die: "d4" }
)
@collector.report!(
"die_roll",
rand(6) + 1,
help: "A random value from 1 to 6 inclusive",
type: "gauge",
labels: { die: "d6" }
)
@collector.report!(
"die_roll",
rand(8) + 1,
help: "A random value from 1 to 8 inclusive",
type: "gauge",
labels: { die: "d8" }
)
@collector.report!(
"die_roll",
rand(10) + 1,
help: "A random value from 1 to 10 inclusive",
type: "gauge",
labels: { die: "d10" }
)
@collector.report!(
"die_roll",
rand(12) + 1,
help: "A random value from 1 to 12 inclusive",
type: "gauge",
labels: { die: "d12" }
)
@collector.report!(
"die_roll",
rand(20) + 1,
help: "A random value from 1 to 20 inclusive",
type: "gauge",
labels: { die: "d20" }
)
@collector.report!(
"die_roll",
rand(100) + 1,
help: "A random value from 1 to 100 inclusive",
type: "gauge",
labels: { die: "d%" }
)
end
end
|