pyroscope 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/pyroscope/version.rb +1 -1
- data/lib/pyroscope.rb +4 -3
- data/test.rb +11 -11
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 743ff4c97e82300fb18a63cb6ebe626f241ce77a1bf0fd034198db698b5c5aca
|
4
|
+
data.tar.gz: 76d3705d25132cb5779b9e430eb2972894597d4bd4732a30c28a8995ec18fcaa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4bc08bbdc5fa0081806d4e2030eef6a6032c1e5fb68d53784fc5e0565f7ed4d57a85171d87ff91213d3fc0209967d47279593ac2025739a611588771d36e8c0d
|
7
|
+
data.tar.gz: 5d27f0e63129001f60bb11fab6f19e837b82a350bc746b6ac7a1bd0e072c1ea7546b3d0b9ea32ff4d864c8feb1b71c718f2a67e9d606d98b2b518c689b9e49fc
|
data/README.md
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
# pyroscope-ruby
|
2
2
|
|
3
|
-
This is a repo for pyroscope ruby integration.
|
3
|
+
This is a repo for pyroscope ruby integration. See [examples/ruby](https://github.com/pyroscope-io/pyroscope/tree/main/examples/ruby) in the main repo for examples.
|
data/lib/pyroscope/version.rb
CHANGED
data/lib/pyroscope.rb
CHANGED
@@ -2,7 +2,7 @@ require "pyroscope/version"
|
|
2
2
|
require "pyroscope_c"
|
3
3
|
|
4
4
|
module Pyroscope
|
5
|
-
Config = Struct.new(:app_name, :server_address, :auth_token, :sample_rate, :with_subprocesses, :log_level)
|
5
|
+
Config = Struct.new(:app_name, :server_address, :auth_token, :sample_rate, :with_subprocesses, :log_level, :tags)
|
6
6
|
|
7
7
|
class << self
|
8
8
|
def configure
|
@@ -16,6 +16,7 @@ module Pyroscope
|
|
16
16
|
@configuration.with_subprocesses || 0,
|
17
17
|
@configuration.log_level || "error",
|
18
18
|
)
|
19
|
+
tag(@configuration.tags) if @configuration.tags
|
19
20
|
end
|
20
21
|
|
21
22
|
def stop
|
@@ -38,13 +39,13 @@ module Pyroscope
|
|
38
39
|
|
39
40
|
def tag(tags)
|
40
41
|
tags.each_pair do |key, val|
|
41
|
-
_set_tag(key, val)
|
42
|
+
_set_tag(key.to_s, val.to_s)
|
42
43
|
end
|
43
44
|
end
|
44
45
|
|
45
46
|
def remove_tags(*keys)
|
46
47
|
keys.each do |key|
|
47
|
-
_set_tag(key, "")
|
48
|
+
_set_tag(key.to_s, "")
|
48
49
|
end
|
49
50
|
end
|
50
51
|
|
data/test.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
-
require
|
2
|
-
|
3
|
-
puts "prestart #{Process.pid}"
|
1
|
+
require "pyroscope"
|
4
2
|
|
5
3
|
Pyroscope.configure do |config|
|
6
|
-
config.app_name = "test.ruby.app
|
7
|
-
config.server_address = "http://
|
4
|
+
config.app_name = "test.ruby.app"
|
5
|
+
config.server_address = "http://pyroscope:4040/"
|
6
|
+
config.tags = {
|
7
|
+
:region => "us-east-1",
|
8
|
+
:hostname => ENV["hostname"]
|
9
|
+
}
|
8
10
|
end
|
9
11
|
|
10
12
|
def work(n)
|
@@ -15,17 +17,15 @@ def work(n)
|
|
15
17
|
end
|
16
18
|
|
17
19
|
def fast_function
|
18
|
-
|
19
|
-
work(20_000)
|
20
|
-
end
|
20
|
+
work(20000)
|
21
21
|
end
|
22
22
|
|
23
23
|
def slow_function
|
24
|
-
|
25
|
-
work(80_000)
|
26
|
-
Pyroscope.remove_tags("function")
|
24
|
+
work(80000)
|
27
25
|
end
|
28
26
|
|
27
|
+
Pyroscope.tag({ "region" => "us-east-1" })
|
28
|
+
|
29
29
|
while true
|
30
30
|
fast_function
|
31
31
|
slow_function
|