Commit 86e40b81 authored by chiehminw's avatar chiehminw
Browse files

Add Sidekiq::Stats metrics

Retreive Sidekiq stats metrics from
https://github.com/mperham/sidekiq/blob/v5.2.7/lib/sidekiq/api.rb#L106

Signed-off-by: default avatarchiehminw <chiehminw@synology.com>
parent 2d9e4c19
...@@ -50,9 +50,25 @@ metrics. ...@@ -50,9 +50,25 @@ metrics.
* `process_smaps_private_dirty_bytes` * `process_smaps_private_dirty_bytes`
* `process_smaps_swap_bytes` * `process_smaps_swap_bytes`
* `process_smaps_pss_bytes` * `process_smaps_pss_bytes`
1. [Sidekiq](lib/gitlab_monitor/sidekiq.rb) -- `sidekiq_queue_size`, `sidekiq_queue_paused`, 1. [Sidekiq](lib/gitlab_monitor/sidekiq.rb)
`sidekiq_queue_latency_seconds`, `sidekiq_enqueued_jobs`, `sidekiq_dead_jobs`, * Stats
`sidekiq_running_jobs`, `sidekiq_to_be_retried_jobs` * `sidekiq_jobs_processed_total`
* `sidekiq_jobs_failed_total`
* `sidekiq_jobs_enqueued_size`
* `sidekiq_jobs_scheduled_size`
* `sidekiq_jobs_retry_size`
* `sidekiq_jobs_dead_size`
* `sidekiq_default_queue_latency_seconds`
* `sidekiq_processes_size`
* `sidekiq_workers_size`
* Queues
* `sidekiq_queue_size`
* `sidekiq_queue_paused`
* `sidekiq_queue_latency_seconds`
* Jobs
* `sidekiq_enqueued_jobs`
* `sidekiq_running_jobs`
* `sidekiq_to_be_retried_jobs`
### Setup with GitLab Development Kit ### Setup with GitLab Development Kit
......
...@@ -83,11 +83,11 @@ probes: ...@@ -83,11 +83,11 @@ probes:
sidekiq: &sidekiq sidekiq: &sidekiq
methods: methods:
- probe_stats
- probe_queues - probe_queues
- probe_jobs - probe_jobs
- probe_workers - probe_workers
- probe_retries - probe_retries
- probe_dead
opts: opts:
redis_url: "redis://localhost:6379" redis_url: "redis://localhost:6379"
redis_enable_client: true redis_enable_client: true
......
...@@ -274,6 +274,7 @@ module GitLab ...@@ -274,6 +274,7 @@ module GitLab
validate! validate!
::GitLab::Monitor::SidekiqProber.new(redis_url: @redis_url) ::GitLab::Monitor::SidekiqProber.new(redis_url: @redis_url)
.probe_stats
.probe_queues .probe_queues
.probe_jobs .probe_jobs
.probe_workers .probe_workers
......
...@@ -21,6 +21,25 @@ module GitLab ...@@ -21,6 +21,25 @@ module GitLab
ensure_queue_job_stats_script_loaded ensure_queue_job_stats_script_loaded
end end
def probe_stats
return self unless connected?
stats = Sidekiq::Stats.new
@metrics.add("sidekiq_jobs_processed_total", stats.processed)
@metrics.add("sidekiq_jobs_failed_total", stats.failed)
@metrics.add("sidekiq_jobs_enqueued_size", stats.enqueued)
@metrics.add("sidekiq_jobs_scheduled_size", stats.scheduled_size)
@metrics.add("sidekiq_jobs_retry_size", stats.retry_size)
@metrics.add("sidekiq_jobs_dead_size", stats.dead_size)
@metrics.add("sidekiq_default_queue_latency_seconds", stats.default_queue_latency)
@metrics.add("sidekiq_processes_size", stats.processes_size)
@metrics.add("sidekiq_workers_size", stats.workers_size)
self
end
def probe_queues def probe_queues
return self unless connected? return self unless connected?
...@@ -92,6 +111,9 @@ module GitLab ...@@ -92,6 +111,9 @@ module GitLab
end end
def probe_dead def probe_dead
puts "[DEPRECATED] probe_dead is now considered obsolete and will be removed in future major versions,"\
" please use probe_stats instead"
return self unless connected? return self unless connected?
@metrics.add("sidekiq_dead_jobs", Sidekiq::Stats.new.dead_size) @metrics.add("sidekiq_dead_jobs", Sidekiq::Stats.new.dead_size)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment