Class: Attio::Observability::Metrics::StatsD
- Inherits:
-
Object
- Object
- Attio::Observability::Metrics::StatsD
- Defined in:
- lib/attio/observability.rb
Overview
StatsD metrics
Instance Method Summary collapse
- #format_tags(tags) ⇒ Object private
- #gauge(metric, value, tags: {}) ⇒ Object
- #histogram(metric, value, tags: {}) ⇒ Object
- #increment(metric, tags: {}) ⇒ Object
-
#initialize ⇒ StatsD
constructor
A new instance of StatsD.
Constructor Details
#initialize ⇒ StatsD
Returns a new instance of StatsD.
222 223 224 225 226 227 |
# File 'lib/attio/observability.rb', line 222 def initialize require "statsd-ruby" @client = ::Statsd.new("localhost", 8125) rescue LoadError raise "Please add 'statsd-ruby' to your Gemfile" end |
Instance Method Details
#format_tags(tags) ⇒ Object (private)
241 242 243 |
# File 'lib/attio/observability.rb', line 241 private def () .map { |k, v| "#{k}:#{v}" } end |
#gauge(metric, value, tags: {}) ⇒ Object
233 234 235 |
# File 'lib/attio/observability.rb', line 233 def gauge(metric, value, tags: {}) @client.gauge(metric, value, tags: ()) end |
#histogram(metric, value, tags: {}) ⇒ Object
237 238 239 |
# File 'lib/attio/observability.rb', line 237 def histogram(metric, value, tags: {}) @client.histogram(metric, value, tags: ()) end |
#increment(metric, tags: {}) ⇒ Object
229 230 231 |
# File 'lib/attio/observability.rb', line 229 def increment(metric, tags: {}) @client.increment(metric, tags: ()) end |