369.md 3.1 KB
Newer Older
Lab机器人's avatar
readme  
Lab机器人 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
# 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  }  } 
```