Skip to content

Commit

Permalink
update pipeline/jenkins-metric.md and add en version (#5803)
Browse files Browse the repository at this point in the history
  • Loading branch information
windsonsea authored Oct 21, 2024
1 parent 7a09815 commit 71ea761
Show file tree
Hide file tree
Showing 3 changed files with 132 additions and 56 deletions.
80 changes: 80 additions & 0 deletions docs/en/docs/amamba/user-guide/pipeline/jenkins-metric.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
MTPE: windsonsea
Date: 2024-08-21
---

# Pipeline Metrics

This page introduces the metrics exposed by pipeline.

## Built-in Metrics of Jenkins Components

Jenkins itself exposes metrics through the [prometheus-plugin](https://plugins.jenkins.io/prometheus/),
which can be viewed at the path `http://JenkinsHost:JenkinsPort/prometheus/`.

### Default Exposed Metrics

| Monitoring Metric | Description |
|-------------------|-------------|
| default_jenkins_disk_usage_bytes | Disk usage of the first-level folder in JENKINS_HOME in bytes |
| default_jenkins_job_usage_bytes | Amount of disk usage for each job in Jenkins in bytes |
| default_jenkins_file_store_capacity_bytes | Total size in bytes of the file stores used by Jenkins |
| default_jenkins_file_store_available_bytes | Estimated available space on the file stores used by Jenkins |
| default_jenkins_executors_available | Shows how many Jenkins Executors are available |
| default_jenkins_executors_busy | Shows how many Jenkins Executors are busy |
| default_jenkins_executors_connecting | Shows how many Jenkins Executors are connecting |
| default_jenkins_executors_defined | Shows how many Jenkins Executors are defined |
| default_jenkins_executors_idle | Shows how many Jenkins Executors are idle |
| default_jenkins_executors_online | Shows how many Jenkins Executors are online |
| default_jenkins_executors_queue_length | Shows the number of items that can run but are waiting on a free executor |
| default_jenkins_version | Shows the Jenkins version |
| default_jenkins_up | Shows if Jenkins is ready to receive requests |
| default_jenkins_uptime | Shows the time since Jenkins was initialized |
| default_jenkins_nodes_online | Shows the online status of nodes |
| default_jenkins_builds_duration_milliseconds_summary | Summary of Jenkins build times in milliseconds by Job |
| default_jenkins_builds_success_build_count | Successful build count |
| default_jenkins_builds_failed_build_count | Failed build count |
| default_jenkins_builds_health_score | Health score of a job |
| default_jenkins_builds_available_builds_count | Gauge indicating how many builds are available for the given job |
| default_jenkins_builds_discard_active | Gauge indicating if the build discard feature is active for the job. |
| default_jenkins_builds_running_build_duration_milliseconds | Gauge indicating the runtime of the current build. |
| default_jenkins_builds_last_build_result_ordinal | Build status of a job (last build) (0=SUCCESS, 1=UNSTABLE, 2=FAILURE, 3=NOT_BUILT, 4=ABORTED) |
| default_jenkins_builds_last_build_result | Build status of a job as a boolean value (1 or 0). <br/>Where 1 stands for the build status SUCCESS or UNSTABLE and 0 for the build statuses FAILURE, NOT_BUILT or ABORTED |
| default_jenkins_builds_last_build_duration_milliseconds | Build times in milliseconds of the last build |
| default_jenkins_builds_last_build_start_time_milliseconds | Last build start timestamp in milliseconds |
| default_jenkins_builds_last_build_tests_total | Number of total tests during the last build |
| default_jenkins_builds_last_build_tests_failing | Number of failing tests during the last build |
| default_jenkins_builds_last_stage_duration_milliseconds_summary | Summary of Jenkins build times by Job and Stage in the last build |

### Additional Enabled Metrics

#### Exposure Method

1. Go to the Jenkins configuration interface, operation path: `Manage Jenkins -> Configure System -> Prometheus -> Check`

2. After enabling, restart the Jenkins instance

![jenkins-metric](../../images/jenkins-metric.png)

#### Metrics

| Monitoring Metric | Description |
|-------------------|-------------|
| default_jenkins_builds_build_result_ordinal | Build status of a job (last build) (0=SUCCESS, 1=UNSTABLE, 2=FAILURE, 3=NOT_BUILT, 4=ABORTED) |
| default_jenkins_builds_build_result | Build status of a job as a boolean value (1 or 0). <br/>Where 1 stands for the build status SUCCESS or UNSTABLE and 0 for the build statuses FAILURE, NOT_BUILT or ABORTED |
| default_jenkins_builds_build_duration_milliseconds | Build times in milliseconds of the last build |
| default_jenkins_builds_build_start_time_milliseconds | Last build start timestamp in milliseconds |
| default_jenkins_builds_build_tests_total | Number of total tests during the last build |
| default_jenkins_builds_build_tests_skipped | Number of skipped tests during the last build |
| default_jenkins_builds_build_tests_failing | Number of failing tests during the last build |
| default_jenkins_builds_stage_duration_milliseconds_summary | Summary of Jenkins build times by Job and Stage in the last build |

## Platform Metrics

Exposed by the application workspace

| Metric | Description | Prometheus Type | Attributes | Some Usage |
|--------|-------------|-----------------|------------|------------|
| amamba_pipeline_run_duration | Pipeline run duration (milliseconds) | Gauge | workspace_id (Workspace) pipeline_id (Pipeline Name) run_id (Run ID) | Displays the duration of a single pipeline run, calculates the average duration for each pipeline, tracks the trend of pipeline execution duration, and identifies the top time-consuming pipelines |
| amamba_pipeline_run_total | Total pipeline runs | Gauge | workspace_id (Workspace) pipeline_id (Pipeline Name) run_id (Run ID) status (Pipeline Status) | Number of executions for each pipeline, success/failure rate for each pipeline, and trends of pipeline execution counts |
| amamba_pipeline_status | Recent pipeline run status | Gauge | workspace_id (Workspace) pipeline_id (Pipeline Name) status (Pipeline Status) | Success/failure rates of pipelines and statistics on pipeline run status |
1 change: 1 addition & 0 deletions docs/en/navigation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ nav:
- Build Multi-Arch Image: amamba/user-guide/pipeline/podman.md
- Use Cacher in Pipeline: amamba/quickstart/job-cacher.md
- System Env Variables: amamba/user-guide/pipeline/system-env.md
- Pipeline Metrics: amamba/user-guide/pipeline/jenkins-metric.md
- GitOps:
- Import Repository: amamba/user-guide/gitops/import-repo.md
- Create Argo CD App: amamba/user-guide/gitops/create-argo-cd.md
Expand Down
107 changes: 51 additions & 56 deletions docs/zh/docs/amamba/user-guide/pipeline/jenkins-metric.md
Original file line number Diff line number Diff line change
@@ -1,79 +1,74 @@
---
hide:
- toc
---

# 流水线监控指标

下文介绍于流水线监控暴露的指标信息。

## Jenkins 组件内置指标

Jenkins 自身通过 [promethus-plugin](https://plugins.jenkins.io/prometheus/) 插件来暴露指标,可通过路径`http://JenkinsHost:JenkinsPort/prometheus/` 查看。
Jenkins 自身通过 [promethus-plugin](https://plugins.jenkins.io/prometheus/)
插件来暴露指标,可通过路径`http://JenkinsHost:JenkinsPort/prometheus/` 查看。

### 默认暴露出来的指标

| 监控指标 | 描述 |
| ------------------------------------------------------------ | ------------------------------------------------------------ |
| default_jenkins_disk_usage_bytes | Disk usage of first level folder in JENKINS_HOME in bytes |
| default_jenkins_job_usage_bytes | Amount of disk usage for each job in Jenkins in bytes |
| default_jenkins_file_store_capacity_bytes | Total size in bytes of the file stores used by Jenkins |
| default_jenkins_file_store_available_bytes | Estimated available space on the file stores used by Jenkins |
| default_jenkins_executors_available | Shows how many Jenkins Executors are available |
| default_jenkins_executors_busy | Shows how many Jenkins Executors busy |
| default_jenkins_executors_connecting | Shows how many Jenkins Executors are connecting |
| default_jenkins_executors_defined | Shows how many Jenkins Executors are defined |
| default_jenkins_executors_idle | Shows how many Jenkins Executors are idle |
| default_jenkins_executors_online | Shows how many Jenkins Executors are online |
| default_jenkins_executors_queue_length | Shows number of items that can run but waiting on free executor |
| default_jenkins_version | Shows the jenkins Version |
| default_jenkins_up | Shows if jenkins ready to receive requests |
| default_jenkins_uptime | Shows time since Jenkins was initialized |
| default_jenkins_nodes_online | Shows Nodes online status |
| default_jenkins_builds_duration_milliseconds_summary | Summary of Jenkins build times in milliseconds by Job |
| default_jenkins_builds_success_build_count | Successful build count |
| default_jenkins_builds_failed_build_count | Failed build count |
| default_jenkins_builds_health_score | Health score of a job |
| default_jenkins_builds_available_builds_count | Gauge which indicates how many builds are available for the given job |
| default_jenkins_builds_discard_active | Gauge which indicates if the build discard feature is active for the job. |
| default_jenkins_builds_running_build_duration_milliseconds | Gauge which indicates the runtime of the current build. |
| default_jenkins_builds_last_build_result_ordinal | Build status of a job (last build) (0=SUCCESS,1=UNSTABLE,2=FAILURE,3=NOT_BUILT,4=ABORTED) |
| default_jenkins_builds_last_build_result | Build status of a job as a boolean value (1 or 0). <br/>Where 1 stands for the build status SUCCESS or UNSTABLE and 0 for the build states FAILURE,NOT_BUILT or ABORTED |
| default_jenkins_builds_last_build_duration_milliseconds | Build times in milliseconds of last build |
| default_jenkins_builds_last_build_start_time_milliseconds | Last build start timestamp in milliseconds |
| default_jenkins_builds_last_build_tests_total | Number of total tests during the last build |
| default_jenkins_builds_last_build_tests_failing | Number of failing tests during the last build |
| default_jenkins_builds_last_stage_duration_milliseconds_summary | Summary of Jenkins build times by Job and Stage in the last build |
| 监控指标 | 描述 |
| ------- | --- |
| default_jenkins_disk_usage_bytes | Jenkins_HOME中一级文件夹的磁盘使用量(以字节为单位) |
| default_jenkins_job_usage_bytes | Jenkins中每个作业的磁盘使用量(以字节为单位) |
| default_jenkins_file_store_capacity_bytes | Jenkins使用的文件存储的总大小(以字节为单位) |
| default_jenkins_file_store_available_bytes | Jenkins使用的文件存储中估计的可用空间 |
| default_jenkins_executors_available | 可用的Jenkins执行器数量 |
| default_jenkins_executors_busy | 正在忙碌的Jenkins执行器数量 |
| default_jenkins_executors_connecting | 正在连接的Jenkins执行器数量 |
| default_jenkins_executors_defined | 已定义的Jenkins执行器数量 |
| default_jenkins_executors_idle | 空闲的Jenkins执行器数量 |
| default_jenkins_executors_online | 在线的Jenkins执行器数量 |
| default_jenkins_executors_queue_length | 可以运行但在等待空闲执行器的项目数量 |
| default_jenkins_version | Jenkins版本 |
| default_jenkins_up | 显示Jenkins是否准备好接收请求 |
| default_jenkins_uptime | 显示Jenkins自初始化以来的运行时间 |
| default_jenkins_nodes_online | 显示节点的在线状态 |
| default_jenkins_builds_duration_milliseconds_summary | 按作业总结的Jenkins构建时间(以毫秒为单位) |
| default_jenkins_builds_success_build_count | 成功构建的数量 |
| default_jenkins_builds_failed_build_count | 失败构建的数量 |
| default_jenkins_builds_health_score | 作业的健康评分 |
| default_jenkins_builds_available_builds_count | 指示特定作业可用构建数量的仪表 |
| default_jenkins_builds_discard_active | 表示构建丢弃功能是否对该作业激活的仪表 |
| default_jenkins_builds_running_build_duration_milliseconds | 表示当前构建运行时长的仪表 |
| default_jenkins_builds_last_build_result_ordinal | 作业的构建状态(最后构建)(0=成功,1=不稳定,2=失败,3=未构建,4=已中止) |
| default_jenkins_builds_last_build_result | 作业的构建状态的布尔值(1或0)。<br/>其中1表示构建状态为成功或不稳定,0表示构建状态为失败、未构建或已中止 |
| default_jenkins_builds_last_build_duration_milliseconds | 最后构建的时间(以毫秒为单位) |
| default_jenkins_builds_last_build_start_time_milliseconds | 最后构建的开始时间戳(以毫秒为单位) |
| default_jenkins_builds_last_build_tests_total | 最后构建中测试的总数 |
| default_jenkins_builds_last_build_tests_failing | 最后构建中失败测试的数量 |
| default_jenkins_builds_last_stage_duration_milliseconds_summary | 按作业和阶段总结的最后构建中的Jenkins构建时间 |

### 额外启用的指标

#### 暴露方式

1. 前往 jenkins 配置界面,操作路径:`系统管理 -> 系统配置 -> Prometheus -> 勾选 `

1. 前往 Jenkins 配置界面,操作路径:**系统管理** -> **系统配置** -> **Prometheus** ,勾选
2. 开启后重启 Jenkins 实例

![jenkins-metric](../../images/jenkins-metric.png)
![jenkins-metric](../../images/jenkins-metric.png)

#### 指标

| 监控指标 | description |
| ---------------------------------------------------------- | ------------------------------------------------------------ |
| default_jenkins_builds_build_result_ordinal | Build status of a job (last build) (0=SUCCESS,1=UNSTABLE,2=FAILURE,3=NOT_BUILT,4=ABORTED) |
| default_jenkins_builds_build_result | Build status of a job as a boolean value (1 or 0). <br/>Where 1 stands for the build status SUCCESS or UNSTABLE and 0 for the build states FAILURE,NOT_BUILT or ABORTED |
| default_jenkins_builds_build_duration_milliseconds | Build times in milliseconds of last build |
| default_jenkins_builds_build_start_time_milliseconds | Last build start timestamp in milliseconds |
| default_jenkins_builds_build_tests_total | Number of total tests during the last build |
| default_jenkins_builds_build_tests_skipped | Number of skipped tests during the last build |
| default_jenkins_builds_build_tests_failing | Number of failing tests during the last build |
| default_jenkins_builds_stage_duration_milliseconds_summary | Summary of Jenkins build times by Job and Stage in the last build |
| 监控指标 | 描述 |
| ------ | ---- |
| default_jenkins_builds_build_result_ordinal | 作业的构建状态(最后构建)(0=成功,1=不稳定,2=失败,3=未构建,4=已中止) |
| default_jenkins_builds_build_result | 作业的构建状态的布尔值(1或0)。<br/>其中1表示构建状态为成功或不稳定,0表示构建状态为失败、未构建或已中止 |
| default_jenkins_builds_build_duration_milliseconds | 最近构建的时间(以毫秒为单位) |
| default_jenkins_builds_build_start_time_milliseconds | 最近构建的开始时间戳(以毫秒为单位) |
| default_jenkins_builds_build_tests_total | 最近构建中的总测试数量 |
| default_jenkins_builds_build_tests_skipped | 最近构建中跳过的测试数量 |
| default_jenkins_builds_build_tests_failing | 最近构建中失败的测试数量 |
| default_jenkins_builds_stage_duration_milliseconds_summary | 按作业和阶段总结的最后构建中的Jenkins构建时间 |

## 平台指标

由应用工作台暴露
由应用工作台暴露

| 指标 | description | Prometheus Type | attributes | some usage |
| ---------------------------- | -------------------------- | --------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
| amamba_pipeline_run_duration | 流水线运行持续时间(毫秒) | Gauge | workspace_id (工作空间) pipeline_id (流水线名称) run_id (运行id) | 展示单条流水线运行时长计算每条流水线的平均时长统计流水线执行时长趋势流水线耗时Top |
| amamba_pipeline_run_total | 流水线运行次数 | Gauge | workspace_id (工作空间) pipeline_id (流水线名称) run_id (运行id) status (流水线状态) | 每条流水线执行的次数每条流水线的成功/失败率 流水线执行次数趋势Top |
| amamba_pipeline_status | 流水线最近运行状态 | Gauge | workspace_id (工作空间) pipeline_id (流水线名称) status (流水线状态) | 流水线的成功/失败率流水线的运行状态统计 |
| 指标 | 描述 | Prometheus 类型 | 属性 | 用法举例 |
| --- | ---- | -------------- | --- | ------- |
| amamba_pipeline_run_duration | 流水线运行持续时间(毫秒) | Gauge | workspace_id (工作空间) pipeline_id (流水线名称) run_id (运行id) | 展示单条流水线运行时长计算每条流水线的平均时长统计流水线执行时长趋势流水线耗时Top |
| amamba_pipeline_run_total | 流水线运行次数 | Gauge | workspace_id (工作空间) pipeline_id (流水线名称) run_id (运行id) status (流水线状态) | 每条流水线执行的次数每条流水线的成功/失败率 流水线执行次数趋势Top |
| amamba_pipeline_status | 流水线最近运行状态 | Gauge | workspace_id (工作空间) pipeline_id (流水线名称) status (流水线状态) | 流水线的成功/失败率流水线的运行状态统计 |

0 comments on commit 71ea761

Please sign in to comment.