# Sidekiq Metrics API

> 原文：[https://docs.gitlab.com/ee/api/sidekiq_metrics.html](https://docs.gitlab.com/ee/api/sidekiq_metrics.html)

*   [Get the current Queue Metrics](#get-the-current-queue-metrics)
*   [Get the current Process Metrics](#get-the-current-process-metrics)
*   [Get the current Job Statistics](#get-the-current-job-statistics)
*   [Get a compound response of all the previously mentioned metrics](#get-a-compound-response-of-all-the-previously-mentioned-metrics)

# Sidekiq Metrics API[](#sidekiq-metrics-api "Permalink")

> **注意：**此端点仅在 GitLab 8.9 及更高版本上可用.

通过此 API 端点，您可以检索有关 Sidekiq 当前状态，其作业，队列和进程的一些信息.

## Get the current Queue Metrics[](#get-the-current-queue-metrics "Permalink")

列出有关所有已注册队列，其积压和延迟的信息.

```
GET /sidekiq/queue_metrics 
```

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

响应示例：

```
{  "queues":  {  "default":  {  "backlog":  0,  "latency":  0  }  }  } 
```

## Get the current Process Metrics[](#get-the-current-process-metrics "Permalink")

列出有关所有注册来处理您的队列的 Sidekiq 工作者的信息.

```
GET /sidekiq/process_metrics 
```

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

响应示例：

```
{  "processes":  [  {  "hostname":  "gitlab.example.com",  "pid":  5649,  "tag":  "gitlab",  "started_at":  "2016-06-14T10:45:07.159-05:00",  "queues":  [  "post_receive",  "mailers",  "archive_repo",  "system_hook",  "project_web_hook",  "gitlab_shell",  "incoming_email",  "runner",  "common",  "default"  ],  "labels":  [],  "concurrency":  25,  "busy":  0  }  ]  } 
```

## Get the current Job Statistics[](#get-the-current-job-statistics "Permalink")

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

```
GET /sidekiq/job_stats 
```

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

响应示例：

```
{  "jobs":  {  "processed":  2,  "failed":  0,  "enqueued":  0,  "dead":  0  }  } 
```

## Get a compound response of all the previously mentioned metrics[](#get-a-compound-response-of-all-the-previously-mentioned-metrics "Permalink")

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

```
GET /sidekiq/compound_metrics 
```

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

响应示例：

```
{  "queues":  {  "default":  {  "backlog":  0,  "latency":  0  }  },  "processes":  [  {  "hostname":  "gitlab.example.com",  "pid":  5649,  "tag":  "gitlab",  "started_at":  "2016-06-14T10:45:07.159-05:00",  "queues":  [  "post_receive",  "mailers",  "archive_repo",  "system_hook",  "project_web_hook",  "gitlab_shell",  "incoming_email",  "runner",  "common",  "default"  ],  "labels":  [],  "concurrency":  25,  "busy":  0  }  ],  "jobs":  {  "processed":  2,  "failed":  0,  "enqueued":  0,  "dead":  0  }  } 
```