-
Notifications
You must be signed in to change notification settings - Fork 0
/
autometrics_test_quick.rb
52 lines (38 loc) · 1.31 KB
/
autometrics_test_quick.rb
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
require_relative 'lib/autometrics'
# A class that has autometrics off by default
class ClassWithNoAutometrics
include Autometrics
# Uncomment this line to turn on autometrics for this class
# autometrics
def instance_method_of_class
p "[instance_method_of_class] You should see no [autometrics] around this function call"
end
def another_instance_method_of_class
p "[another_instance_method_of_class] You should see no [autometrics] around this function call"
end
end
class_with_none = ClassWithNoAutometrics.new
class_with_none.instance_method_of_class
class_with_none.another_instance_method_of_class
module AutometricsTest
class ClassWithSomeAutometrics
include Autometrics::On
autometrics only: :foo
def foo
p "`foo` here! You should see some [autometrics::foo] logs around me"
end
def bar
p "`bar` here! You shouldn't see any [autometrics::bar] logs by me"
end
end
end
class_with_some = AutometricsTest::ClassWithSomeAutometrics.new
class_with_some.foo
class_with_some.bar
autometrics def bare_function
puts "[bare_function] You should see [self.autometrics] around this function call"
end
bare_function
puts "*****"
puts "Now let's check the metrics we've collected"
puts Autometrics::PROMETHEUS.test_get_values({ function: :bare_function, module: '' })