Module: Capistrano::Notifier::Helpers::StatsD
- Defined in:
- lib/capistrano/notifier/helpers/statsd.rb
Instance Method Summary collapse
- #application ⇒ Object
- #notifier_statsd_options ⇒ Object
- #stage ⇒ Object
- #statsd_default_pattern ⇒ Object
- #statsd_defaults ⇒ Object
- #statsd_host ⇒ Object
- #statsd_notifier_command ⇒ Object
- #statsd_options ⇒ Object
- #statsd_packet ⇒ Object
- #statsd_pattern ⇒ Object
- #statsd_port ⇒ Object
- #statsd_with ⇒ Object
Instance Method Details
#application ⇒ Object
5 6 7 |
# File 'lib/capistrano/notifier/helpers/statsd.rb', line 5 def application fetch :application end |
#notifier_statsd_options ⇒ Object
13 14 15 |
# File 'lib/capistrano/notifier/helpers/statsd.rb', line 13 def ||= fetch :notifier_statsd_options end |
#stage ⇒ Object
9 10 11 |
# File 'lib/capistrano/notifier/helpers/statsd.rb', line 9 def stage fetch :stage end |
#statsd_default_pattern ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/capistrano/notifier/helpers/statsd.rb', line 41 def statsd_default_pattern if stage "#{application}.#{stage}.deploy" else "#{application}.deploy" end end |
#statsd_defaults ⇒ Object
17 18 19 |
# File 'lib/capistrano/notifier/helpers/statsd.rb', line 17 def statsd_defaults { host: "127.0.0.1", port: "8125", with: :counter } end |
#statsd_host ⇒ Object
21 22 23 |
# File 'lib/capistrano/notifier/helpers/statsd.rb', line 21 def statsd_host [:host] end |
#statsd_notifier_command ⇒ Object
62 63 64 |
# File 'lib/capistrano/notifier/helpers/statsd.rb', line 62 def statsd_notifier_command "echo -n #{statsd_packet} | nc -w 1 -u #{statsd_host} #{statsd_port}" end |
#statsd_options ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/capistrano/notifier/helpers/statsd.rb', line 25 def ||= if statsd_defaults.merge else statsd_defaults end end |
#statsd_packet ⇒ Object
33 34 35 |
# File 'lib/capistrano/notifier/helpers/statsd.rb', line 33 def statsd_packet "#{statsd_pattern}:#{statsd_with}".gsub('|', '\\|') end |
#statsd_pattern ⇒ Object
37 38 39 |
# File 'lib/capistrano/notifier/helpers/statsd.rb', line 37 def statsd_pattern .fetch(:pattern){ statsd_default_pattern } end |
#statsd_port ⇒ Object
49 50 51 |
# File 'lib/capistrano/notifier/helpers/statsd.rb', line 49 def statsd_port [:port] end |
#statsd_with ⇒ Object
53 54 55 56 57 58 59 60 |
# File 'lib/capistrano/notifier/helpers/statsd.rb', line 53 def statsd_with case [:with] when :counter "1|c" when :gauge "1|g" end end |