Module: StatsD::Instrument::Helpers
- Included in:
- Assertions, Matchers::Matcher
- Defined in:
- lib/statsd/instrument/helpers.rb
Class Method Summary collapse
Instance Method Summary collapse
- #capture_statsd_datagrams(client: nil, &block) ⇒ Object (also: #capture_statsd_calls)
Class Method Details
.add_tag(tags, key, value) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/statsd/instrument/helpers.rb', line 14 def self.add_tag(, key, value) = .dup || {} if .is_a?(String) = .empty? ? "#{key}:#{value}" : "#{tags},#{key}:#{value}" elsif .is_a?(Array) << "#{key}:#{value}" elsif .is_a?(Hash) [key] = value else raise ArgumentError, "add_tag only supports string, array or hash, #{tags.class} provided" end end |
Instance Method Details
#capture_statsd_datagrams(client: nil, &block) ⇒ Object Also known as: capture_statsd_calls
6 7 8 9 |
# File 'lib/statsd/instrument/helpers.rb', line 6 def capture_statsd_datagrams(client: nil, &block) client ||= StatsD.singleton_client client.capture(&block) end |