@c2l2c/后台-插图-多拉度量
显示后台前端插件 每个目录实体的DORA度量衡 ——范围为您正在观看的特定服务,而不是整个org.
对于每个带有 GitHub repo 注释的目录服务, 此插件会添加一个 DORA 计量标签 通过 OAuth 直接从 GitHub PR 计算出所有四个关键度量, 不需要额外的后端或数据管道 :
- 部署频率 ——公关与目标分支的合并频率
- 更改的引导时间 ——从PR开放到合并的平均时间
- 更改失败率 ——热补剂部署百分比(仅生产)
- MTTR 导弹 平均恢复时间,以平均热补真核反应持续时间(仅生产)计量
- 生产热器 - 在特定期间部署的热补剂数量(仅生产)
评级分为: 精英/高/中/低 每个DORA研究基准.
这与Org级 DORA 计分卡有何不同
值级 DORA 插件 gitHub ORG中所有存储器的汇总度量衡。 此插件将参数范围改为 一个单一目录实体 ——当您想要跟踪服务层面的DORA健康,比较环境(如生产与中转),或钻入特定PR驱动您的前置时间或故障率时有用. 它也不需要后端: 所有的数据都使用用户现有的 GitHub OAuth 会话获取客户端 .
截图/录像
1. DORA计量仪表板

2. 部署不便观点

3. LTFC 扩展视图

4. CFR扩展观点

5. MTTR扩展视图

所需资源
- 后台 v1.35+(新前端系统)
- 在您的后台实例中配置了 GitHub OAuth( 插件使用)
githubAuthApi以呼叫 GitHub REST API ) - 附加注释的目录实体
github.com/project-slug: org/repo
安装
# In your Backstage app workspace
yarn workspace app add @c2l2c/backstage-plugin-dora-metrics
注册插件
单位 packages/app/src/App.tsx数字 :
import doraMetricsPlugin from '@c2l2c/backstage-plugin-dora-metrics/alpha';
// Add to your app's plugins array
const app = createApp({
plugins: [doraMetricsPlugin],
// ...
});
配置
添加到您的 app-config.yaml数字 :
app:
doraMetrics:
# Lookback window in days (default: 30)
collection:
initialDays: 30
# Optional: base URL of the GitHub instance (default: https://github.com).
# Set this for GitHub Enterprise. The REST API base URL is derived automatically:
# github.com → https://api.github.com
# *.ghe.com (Cloud) → https://api.<host> (e.g. https://api.va.ghe.com)
# other (GHE Server)→ https://<host>/api/v3
githubUrl: https://github.com
# Define the environments / branches to track.
# Exactly ONE environment may set isProduction: true.
environments:
- name: Production
branch: main # single branch name
isProduction: true
label: hotfix # PR label for production failures (used for CFR/MTTR)
- name: Staging
branch: staging
isProduction: false
- name: Any main
# Comma-separated list — PRs merged to any of these branches are included
branch: "main,master"
isProduction: false
- name: Release branches
# JavaScript regex — resolved against the repo's actual branch list at query time
branch: "^release/.*"
isProduction: false
# Optional: override DORA benchmark targets
targets:
deploymentFrequency: 1 # deploys per day (Elite ≥ 1)
leadTime: 24 # hours (Elite ≤ 24h)
changeFailureRate: 5 # % (Elite ≤ 5%)
mttr: 1 # hours (Elite ≤ 1h)
# Optional: enable mock data for local development (skips GitHub API calls)
debug: false
分支和标签图案
两者 branch 财务报告和审定财务报表 label 字段接受相同的三种格式:
| 格式 | 示例 | 行为 |
|---|---|---|
| 单名 | main 编号 : hotfix | 精确匹配 |
| 逗号分隔 | main,master 编号 : hotfix,fix,bug | 匹配列表中的任何名称 |
| Java 脚本正则ex | ^release/.* 编号 : ^hotfix | Regex 测试每个值 |
如果字符串包含其中任何一个字符,则该字符串被视为正则名: | ^ $ [ ] ( ) { } ? + * \
对于 branch:当多个分支相匹配时,从所有分支中取出公关并被公关号码去掉. Regex模式在查询时间通过GitHub Brances API来解决Repo的活分行列表.
对于 label:如果 任意 它的 GitHub 标签符合模式.
环境制约因素
- 您可以定义任意数量的环境 .
- 只有一个 环境可能具有
isProduction: true。插件在启动时会丢出一个配置错误,如果该限制被违反. - 改变故障率、MTTR和Hotfixs只为生产环境计算.
通过目录注释的每个repo覆盖
您可以在每次服务的基础上覆盖环境和目标 catalog-info.yaml 不更改全局配置 :
metadata:
annotations:
github.com/project-slug: my-org/my-repo
# Override the environments list for this repo only (JSON)
dora-metrics/environments: |
[
{ "name": "Production", "branch": "main", "isProduction": true, "label": "hotfix" },
{ "name": "Staging", "branch": "staging", "isProduction": false }
]
# Override DORA targets for this repo only (JSON, partial overrides supported)
dora-metrics/targets: |
{ "deploymentFrequency": 2, "leadTime": 48 }
注释值被解析为JSON. 部分 targets 超接被与全局目标合并——只有您指定的密钥被替换.
示例配置
正在准备使用示例配置 examples/ 目录 :
| 文件 | 说明 |
|---|---|
app-config.regex-branch.yaml | 以正丁基锡化合物分型跟踪生产(^release/.*)和一个逗号分隔标签模式 |
app-config.multi-branch.yaml | 跟踪生产情况 main,master; 横穿 develop,dev; 热补丁标签为正则 |
catalog-info.yaml | 每层环境和目标覆盖通过 catalog-info.yaml 说明 |
如何运作
插件读取 github.com/project-slug 来自目录实体的注释并呼叫 GitHub REST API(通过用户的 GitHub OAuth 会话进行认证),以便在配置的时间窗口内获取合并的拉取请求.
它计算:
- 部署频率: 每天合并到目标分支的公关
- 引导时间: 从 PR 创建到合并的时间
- 法语: 标记为热补(仅生产环境)的PR百分比
- MTTR 导弹: 平均热补丁 PR 开放时间(仅限生产环境)
- 生产热器 - 在特定时间段部署的热补剂数量(仅生产环境)
许可证
阿帕奇 - 2.0