Class: Sidekiq::Form526JobStatusTracker::Metrics
- Inherits:
-
Object
- Object
- Sidekiq::Form526JobStatusTracker::Metrics
- Defined in:
- lib/sidekiq/form526_job_status_tracker/metrics.rb
Overview
Helper class that fires off StatsD metrics
Instance Method Summary collapse
- #error_tags(error, is_bdd, service_provider) ⇒ Object private
-
#increment_exhausted ⇒ Object
Increments when a job has exhausted all its retries rubocop:enable Style/OptionalBooleanParameter.
-
#increment_non_retryable(error, is_bdd = false, service_provider = nil) ⇒ Object
Increments a non retryable error with a tag for the specific error.
-
#increment_retryable(error, is_bdd = false, service_provider = nil) ⇒ Object
Increments a retryable error with a tag for the specific error.
-
#increment_success(is_bdd = false, service_provider = nil) ⇒ Object
Increments a job success rubocop:disable Style/OptionalBooleanParameter.
-
#increment_try ⇒ Object
Increments a job try.
-
#initialize(prefix) ⇒ Metrics
constructor
A new instance of Metrics.
Constructor Details
#initialize(prefix) ⇒ Metrics
Returns a new instance of Metrics.
10 11 12 |
# File 'lib/sidekiq/form526_job_status_tracker/metrics.rb', line 10 def initialize(prefix) @prefix = prefix end |
Instance Method Details
#error_tags(error, is_bdd, service_provider) ⇒ Object (private)
46 47 48 49 50 51 52 53 |
# File 'lib/sidekiq/form526_job_status_tracker/metrics.rb', line 46 def (error, is_bdd, service_provider) = ["error:#{error.class}"] << "status:#{error.status_code}" if error.try(:status_code) << "message:#{error.}" if error.try(:message) << "is_bdd:#{is_bdd}" << "service_provider:#{service_provider}" end |
#increment_exhausted ⇒ Object
Increments when a job has exhausted all its retries rubocop:enable Style/OptionalBooleanParameter
40 41 42 |
# File 'lib/sidekiq/form526_job_status_tracker/metrics.rb', line 40 def increment_exhausted StatsD.increment("#{@prefix}.exhausted") end |
#increment_non_retryable(error, is_bdd = false, service_provider = nil) ⇒ Object
Increments a non retryable error with a tag for the specific error
28 29 30 |
# File 'lib/sidekiq/form526_job_status_tracker/metrics.rb', line 28 def increment_non_retryable(error, is_bdd = false, service_provider = nil) StatsD.increment("#{@prefix}.non_retryable_error", tags: (error, is_bdd, service_provider)) end |
#increment_retryable(error, is_bdd = false, service_provider = nil) ⇒ Object
Increments a retryable error with a tag for the specific error
34 35 36 |
# File 'lib/sidekiq/form526_job_status_tracker/metrics.rb', line 34 def increment_retryable(error, is_bdd = false, service_provider = nil) StatsD.increment("#{@prefix}.retryable_error", tags: (error, is_bdd, service_provider)) end |
#increment_success(is_bdd = false, service_provider = nil) ⇒ Object
Increments a job success rubocop:disable Style/OptionalBooleanParameter
22 23 24 |
# File 'lib/sidekiq/form526_job_status_tracker/metrics.rb', line 22 def increment_success(is_bdd = false, service_provider = nil) StatsD.increment("#{@prefix}.success", tags: %W[is_bdd:#{is_bdd} service_provider:#{service_provider}]) end |
#increment_try ⇒ Object
Increments a job try
16 17 18 |
# File 'lib/sidekiq/form526_job_status_tracker/metrics.rb', line 16 def increment_try StatsD.increment("#{@prefix}.try") end |