Class: RailsTransactionalOutbox::DatadogLatencyReporter

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_transactional_outbox/datadog_latency_reporter.rb

Instance Method Summary collapse

Constructor Details

#initialize(config: RailsTransactionalOutbox.configuration) ⇒ DatadogLatencyReporter

Returns a new instance of DatadogLatencyReporter.



8
9
10
# File 'lib/rails_transactional_outbox/datadog_latency_reporter.rb', line 8

def initialize(config: RailsTransactionalOutbox.configuration)
  @config = config
end

Instance Method Details

#report(latency: generate_latency) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/rails_transactional_outbox/datadog_latency_reporter.rb', line 12

def report(latency: generate_latency)
  datadog_statsd_client.gauge("rails_transactional_outbox.latency.minimum", latency.minimum)
  datadog_statsd_client.gauge("rails_transactional_outbox.latency.maximum", latency.maximum)
  datadog_statsd_client.gauge("rails_transactional_outbox.latency.average", latency.average)
  datadog_statsd_client.gauge("rails_transactional_outbox.latency.highest_since_creation_date",
    latency.highest_since_creation_date)
end