Module: Pyroscope
- Defined in:
- lib/pyroscope.rb,
lib/pyroscope/version.rb
Defined Under Namespace
Modules: Rust, Utils Classes: Config
Constant Summary collapse
- VERSION =
'0.3.2'.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
86 87 88 89 90 |
# File 'lib/pyroscope.rb', line 86 def (thread_id, ) .each do |tag_name, tag_value| Rust.add_thread_tag(thread_id, tag_name.to_s, tag_value.to_s) end end |
._remove_tags(thread_id, tags) ⇒ Object
remove tags
93 94 95 96 97 |
# File 'lib/pyroscope.rb', line 93 def (thread_id, ) .each do |tag_name, tag_value| Rust.remove_thread_tag(thread_id, tag_name.to_s, tag_value.to_s) end end |
.configure {|@config| ... } ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/pyroscope.rb', line 38 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 || 100, @config.detect_subprocesses || false, @config.on_cpu || false, @config.report_pid || false, @config.report_thread_id || false, (@config. || {}) ) end |
.drop ⇒ Object
99 100 101 |
# File 'lib/pyroscope.rb', line 99 def drop Rust.drop_agent end |
.remove_tags(*tags) ⇒ Object
71 72 73 |
# File 'lib/pyroscope.rb', line 71 def (*) warn("deprecated. Use `Pyroscope.tag_wrapper` instead.") end |
.tag(tags) ⇒ Object
67 68 69 |
# File 'lib/pyroscope.rb', line 67 def tag() warn("deprecated. Use `Pyroscope.tag_wrapper` instead.") end |
.tag_wrapper(tags) ⇒ Object
57 58 59 60 61 62 63 64 65 |
# File 'lib/pyroscope.rb', line 57 def tag_wrapper() tid = thread_id (tid, ) begin yield ensure (tid, ) end end |
.tags_to_string(tags) ⇒ Object
convert tags object to string
76 77 78 |
# File 'lib/pyroscope.rb', line 76 def () .map { |k, v| "#{k}=#{v}" }.join(',') end |
.thread_id ⇒ Object
get thread id
81 82 83 |
# File 'lib/pyroscope.rb', line 81 def thread_id return Utils.thread_id end |