Sidekiq 指标 API

  • Tier: 基础版, 专业版, 旗舰版
  • Offering: 私有化部署

这个 API 端点允许你检索有关 Sidekiq 当前状态、其作业、队列和进程的一些信息。

获取当前队列指标#

列出有关所有已注册队列的信息,包括它们的积压和延迟。

plaintext
GET /sidekiq/queue_metrics
shell
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/sidekiq/queue_metrics"

示例响应:

json
1{ 2 "queues": { 3 "default": { 4 "backlog": 0, 5 "latency": 0 6 } 7 } 8}

获取当前进程指标#

列出所有注册为处理你队列的 Sidekiq 工作进程的信息。

plaintext
GET /sidekiq/process_metrics
shell
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/sidekiq/process_metrics"

示例响应:

json
1{ 2 "processes": [ 3 { 4 "hostname": "gitlab.example.com", 5 "pid": 5649, 6 "tag": "gitlab", 7 "started_at": "2016-06-14T10:45:07.159-05:00", 8 "queues": [ 9 "post_receive", 10 "mailers", 11 "archive_repo", 12 "system_hook", 13 "project_web_hook", 14 "gitlab_shell", 15 "incoming_email", 16 "runner", 17 "common", 18 "default" 19 ], 20 "labels": [], 21 "concurrency": 25, 22 "busy": 0 23 } 24 ] 25}

获取当前作业统计#

列出有关 Sidekiq 已执行作业的信息。

plaintext
GET /sidekiq/job_stats
shell
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/sidekiq/job_stats"

示例响应:

json
1{ 2 "jobs": { 3 "processed": 2, 4 "failed": 0, 5 "enqueued": 0, 6 "dead": 0 7 } 8}

获取所有上述指标的综合响应#

列出有关 Sidekiq 当前可用的所有信息。

plaintext
GET /sidekiq/compound_metrics
shell
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/sidekiq/compound_metrics"

示例响应:

json
1{ 2 "queues": { 3 "default": { 4 "backlog": 0, 5 "latency": 0 6 } 7 }, 8 "processes": [ 9 { 10 "hostname": "gitlab.example.com", 11 "pid": 5649, 12 "tag": "gitlab", 13 "started_at": "2016-06-14T10:45:07.159-05:00", 14 "queues": [ 15 "post_receive", 16 "mailers", 17 "archive_repo", 18 "system_hook", 19 "project_web_hook", 20 "gitlab_shell", 21 "incoming_email", 22 "runner", 23 "common", 24 "default" 25 ], 26 "labels": [], 27 "concurrency": 25, 28 "busy": 0 29 } 30 ], 31 "jobs": { 32 "processed": 2, 33 "failed": 0, 34 "enqueued": 0, 35 "dead": 0 36 } 37}