Module: Pyroscope
- Defined in:
- lib/pyroscope.rb,
lib/pyroscope/version.rb
Defined Under Namespace
Classes: Config
Constant Summary collapse
- VERSION =
'0.3.0'.freeze
Class Method Summary collapse
-
._add_tags(thread_id, tags) ⇒ Object
add tags.
-
._remove_tags(thread_id, tags) ⇒ Object
remove tags.
- .configure {|@config| ... } ⇒ Object
- .drop ⇒ Object
- .remove_tags(*tags) ⇒ Object
- .tag(tags) ⇒ Object
- .tag_wrapper(tags) ⇒ Object
-
.tags_to_string(tags) ⇒ Object
convert tags object to string.
-
.thread_id ⇒ Object
get thread id.
Class Method Details
._add_tags(thread_id, tags) ⇒ Object
add tags
84 85 86 87 88 |
# File 'lib/pyroscope.rb', line 84 def (thread_id, ) .each do |tag_name, tag_value| Rust.add_tag(thread_id, tag_name.to_s, tag_value.to_s) end end |
._remove_tags(thread_id, tags) ⇒ Object
remove tags
91 92 93 94 95 |
# File 'lib/pyroscope.rb', line 91 def (thread_id, ) .each do |tag_name, tag_value| Rust.remove_tag(thread_id, tag_name.to_s, tag_value.to_s) end end |
.configure {|@config| ... } ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/pyroscope.rb', line 36 def configure @config = Config.new # Pass config to the block yield @config Rust.initialize_agent( @config.app_name || @config.application_name, @config.server_address, @config.auth_token, @config.sample_rate, @config.detect_subprocesses, @config.on_cpu, @config.report_pid, @config.report_thread_id, (@config.) ) end |
.drop ⇒ Object
97 98 99 |
# File 'lib/pyroscope.rb', line 97 def drop Rust.drop_agent end |
.remove_tags(*tags) ⇒ Object
69 70 71 |
# File 'lib/pyroscope.rb', line 69 def (*) warn("deprecated. Use `Pyroscope.tag_wrapper` instead.") end |
.tag(tags) ⇒ Object
65 66 67 |
# File 'lib/pyroscope.rb', line 65 def tag() warn("deprecated. Use `Pyroscope.tag_wrapper` instead.") end |
.tag_wrapper(tags) ⇒ Object
55 56 57 58 59 60 61 62 63 |
# File 'lib/pyroscope.rb', line 55 def tag_wrapper() tid = thread_id (tid, ) begin yield ensure (tid, ) end end |
.tags_to_string(tags) ⇒ Object
convert tags object to string
74 75 76 |
# File 'lib/pyroscope.rb', line 74 def () .map { |k, v| "#{k}=#{v}" }.join(',') end |
.thread_id ⇒ Object
get thread id
79 80 81 |
# File 'lib/pyroscope.rb', line 79 def thread_id return Utils.thread_id end |