Module: Puma::Plugin::Telemetry::PluginInstanceMethods
- Defined in:
- lib/puma/plugin/telemetry.rb
Overview
Contents of actual Puma Plugin
Instance Method Summary collapse
Instance Method Details
#call(telemetry) ⇒ Object
95 96 97 98 99 |
# File 'lib/puma/plugin/telemetry.rb', line 95 def call(telemetry) Puma::Plugin::Telemetry.config.targets.each do |target| target.call(telemetry) end end |
#run! ⇒ Object
81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/puma/plugin/telemetry.rb', line 81 def run! loop do log_writer.debug 'plugin=telemetry msg="publish"' call(Puma::Plugin::Telemetry.build(@launcher)) rescue Errno::EPIPE # Occurs when trying to output to STDOUT while puma is shutting down rescue StandardError => e log_writer.error "plugin=telemetry err=#{e.class} msg=#{e..inspect}" ensure sleep Puma::Plugin::Telemetry.config.frequency end end |
#start(launcher) ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/puma/plugin/telemetry.rb', line 65 def start(launcher) @launcher = launcher unless Puma::Plugin::Telemetry.config.enabled? log_writer.log 'plugin=telemetry msg="disabled, exiting..."' return end log_writer.log 'plugin=telemetry msg="enabled, setting up runner..."' in_background do sleep Puma::Plugin::Telemetry.config.initial_delay run! end end |