Commit dad492dc authored by Shinya Maeda's avatar Shinya Maeda Committed by Markus Koller

Add documentation for Daily DORA metrics

This commit adds the documenattion for the
Daily DORA metrics that added in GitLab 13.10.
parent cfba5117
---
title: Support daily DORA metrics API
merge_request: 56080
author:
type: added
---
name: dora_daily_metrics
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/55473
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/291746
milestone: '13.10'
type: development
group: group::release
default_enabled: false
---
stage: Release
group: Release
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
type: reference, api
---
# DevOps Research and Assessment (DORA) key metrics API **(ULTIMATE)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/279039) in [GitLab Ultimate](https://about.gitlab.com/pricing/) 13.10.
All methods require [reporter permissions and above](../../user/permissions.md).
## Get project-level DORA metrics
Get project-level DORA metrics.
```plaintext
GET /projects/:id/dora/metrics
```
| Attribute | Type | Required | Description |
|-------------- |-------- |----------|----------------------- |
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](../README.md#namespaced-path-encoding) can be accessed by the authenticated user. |
| `metric` | string | yes | The [metric name](../../user/analytics/ci_cd_analytics.md#supported-metrics-in-gitlab). One of `deployment_frequency` or `lead_time_for_changes`. |
| `start_date` | string | no | Date range to start from. ISO 8601 Date format, for example `2021-03-01`. Default is 3 months ago. |
| `end_date` | string | no | Date range to end at. ISO 8601 Date format, for example `2021-03-01`. Default is the current date. |
| `interval` | string | no | The bucketing interval. One of `all`, `monthly` or `daily`. Default is `daily`. |
| `environment_tier` | string | no | The [tier of the environment](../../ci/environments/index.md#deployment-tier-of-environments). Default is `production`. |
Example request:
```shell
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/dora/metrics?metric=deployment_frequency"
```
Example response:
```json
[
{ "2021-03-01": 3 },
{ "2021-03-02": 6 },
{ "2021-03-03": 0 },
{ "2021-03-04": 0 },
{ "2021-03-05": 0 },
{ "2021-03-06": 0 },
{ "2021-03-07": 0 },
{ "2021-03-08": 4 }
]
```
## Get group-level DORA metrics
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/279039) in [GitLab Ultimate](https://about.gitlab.com/pricing/) 13.10.
Get group-level DORA metrics.
```plaintext
GET /groups/:id/dora/metrics
```
| Attribute | Type | Required | Description |
|-------------- |-------- |----------|----------------------- |
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](../README.md#namespaced-path-encoding) can be accessed by the authenticated user. |
| `metric` | string | yes | The [metric name](../../user/analytics/ci_cd_analytics.md#supported-metrics-in-gitlab). One of `deployment_frequency` or `lead_time_for_changes`. |
| `start_date` | string | no | Date range to start from. ISO 8601 Date format, for example `2021-03-01`. Default is 3 months ago. |
| `end_date` | string | no | Date range to end at. ISO 8601 Date format, for example `2021-03-01`. Default is the current date. |
| `interval` | string | no | The bucketing interval. One of `all`, `monthly` or `daily`. Default is `daily`. |
| `environment_tier` | string | no | The [tier of the environment](../../ci/environments/index.md#deployment-tier-of-environments). Default is `production`. |
Example request:
```shell
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/1/dora/metrics?metric=deployment_frequency"
```
Example response:
```json
[
{ "2021-03-01": 3 },
{ "2021-03-02": 6 },
{ "2021-03-03": 0 },
{ "2021-03-04": 0 },
{ "2021-03-05": 0 },
{ "2021-03-06": 0 },
{ "2021-03-07": 0 },
{ "2021-03-08": 4 }
]
```
...@@ -22,7 +22,10 @@ View pipeline duration history: ...@@ -22,7 +22,10 @@ View pipeline duration history:
![Pipeline duration](img/pipelines_duration_chart.png) ![Pipeline duration](img/pipelines_duration_chart.png)
## DORA4 Metrics ## DevOps Research and Assessment (DORA) key metrics **(ULTIMATE)**
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/275991) in GitLab 13.7.
> - Added support for [lead time for changes](https://gitlab.com/gitlab-org/gitlab/-/issues/291746) in GitLab 13.10.
Customer experience is a key metric. Users want to measure platform stability and other Customer experience is a key metric. Users want to measure platform stability and other
post-deployment performance KPIs, and set targets for customer behavior, experience, and financial post-deployment performance KPIs, and set targets for customer behavior, experience, and financial
...@@ -41,9 +44,18 @@ performance indicators for software development teams: ...@@ -41,9 +44,18 @@ performance indicators for software development teams:
- Time to restore service: How long it takes an organization to recover from a failure in - Time to restore service: How long it takes an organization to recover from a failure in
production. production.
GitLab plans to add support for all the DORA4 metrics at the project and group levels. GitLab added ### Supported metrics in GitLab
the first metric, deployment frequency, at the project and group scopes for [CI/CD charts](ci_cd_analytics.md#deployment-frequency-charts),
the [Project API]( ../../api/dora4_project_analytics.md), and the [Group API]( ../../api/dora4_group_analytics.md). The following table shows the supported metrics, at which level they are supported, and which GitLab version (API and UI) they were introduced:
| Metric | Level | API version | Chart (UI) version | Comments |
| --------------- | ----------- | --------------- | ---------- | ------- |
| `deployment_frequency` | Project-level | [13.7+](../../api/dora/metrics.md) | [13.8+](#deployment-frequency-charts) | The [old API endopint](../../api/dora4_project_analytics.md) was [deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/323713) in 13.10. |
| `deployment_frequency` | Group-level | [13.10+](../../api/dora/metrics.md) | To be supported | |
| `lead_time_for_changes` | Project-level | [13.10+](../../api/dora/metrics.md) | To be supported | Unit in seconds. Aggregation method is median. |
| `lead_time_for_changes` | Group-level | [13.10+](../../api/dora/metrics.md) | To be supported | Unit in seconds. Aggregation method is median. |
| `change_failure_rate` | Project/Group-level | To be supported | To be supported | |
| `time_to_restore_service` | Project/Group-level | To be supported | To be supported | |
## Deployment frequency charts **(ULTIMATE)** ## Deployment frequency charts **(ULTIMATE)**
......
...@@ -87,6 +87,7 @@ The following table depicts the various user permission levels in a project. ...@@ -87,6 +87,7 @@ The following table depicts the various user permission levels in a project.
| See a commit status | | ✓ | ✓ | ✓ | ✓ | | See a commit status | | ✓ | ✓ | ✓ | ✓ |
| See a container registry | | ✓ | ✓ | ✓ | ✓ | | See a container registry | | ✓ | ✓ | ✓ | ✓ |
| See environments | | ✓ | ✓ | ✓ | ✓ | | See environments | | ✓ | ✓ | ✓ | ✓ |
| See [DORA metrics](analytics/ci_cd_analytics.md) | | ✓ | ✓ | ✓ | ✓ |
| See a list of merge requests | | ✓ | ✓ | ✓ | ✓ | | See a list of merge requests | | ✓ | ✓ | ✓ | ✓ |
| View CI/CD analytics | | ✓ | ✓ | ✓ | ✓ | | View CI/CD analytics | | ✓ | ✓ | ✓ | ✓ |
| View Code Review analytics **(STARTER)** | | ✓ | ✓ | ✓ | ✓ | | View Code Review analytics **(STARTER)** | | ✓ | ✓ | ✓ | ✓ |
......
...@@ -13,8 +13,6 @@ module EE ...@@ -13,8 +13,6 @@ module EE
state_machine :status do state_machine :status do
after_transition any => :success do |deployment| after_transition any => :success do |deployment|
next unless ::Feature.enabled?(:dora_daily_metrics, deployment.project, default_enabled: :yaml)
deployment.run_after_commit do deployment.run_after_commit do
# Schedule to refresh the DORA daily metrics. # Schedule to refresh the DORA daily metrics.
# It has 5 minutes delay due to waiting for the other async processes # It has 5 minutes delay due to waiting for the other async processes
......
...@@ -15,8 +15,6 @@ module API ...@@ -15,8 +15,6 @@ module API
end end
def fetch!(container) def fetch!(container)
not_found! unless ::Feature.enabled?(:dora_daily_metrics, container, default_enabled: :yaml)
result = ::Dora::AggregateMetricsService result = ::Dora::AggregateMetricsService
.new(container: container, current_user: current_user, params: declared_params(include_missing: false)) .new(container: container, current_user: current_user, params: declared_params(include_missing: false))
.execute .execute
......
...@@ -18,18 +18,6 @@ RSpec.describe Deployment do ...@@ -18,18 +18,6 @@ RSpec.describe Deployment do
deployment.succeed! deployment.succeed!
end end
end end
context 'when dora_daily_metrics feature flag is disabled' do
before do
stub_feature_flags(dora_daily_metrics: false)
end
it 'does not schedule Dora::DailyMetrics::RefreshWorker' do
expect(::Dora::DailyMetrics::RefreshWorker).not_to receive(:perform_in)
deployment.succeed!
end
end
end end
end end
end end
...@@ -49,18 +49,6 @@ RSpec.describe API::Dora::Metrics do ...@@ -49,18 +49,6 @@ RSpec.describe API::Dora::Metrics do
expect(json_response['message']).to eq('You do not have permission to access dora metrics.') expect(json_response['message']).to eq('You do not have permission to access dora metrics.')
end end
end end
context 'when dora_daily_metrics feature flag is disabled' do
before do
stub_feature_flags(dora_daily_metrics: false)
end
it 'returns not found' do
subject
expect(response).to have_gitlab_http_status(:not_found)
end
end
end end
describe 'GET /groups/:id/dora/metrics' do describe 'GET /groups/:id/dora/metrics' do
...@@ -110,17 +98,5 @@ RSpec.describe API::Dora::Metrics do ...@@ -110,17 +98,5 @@ RSpec.describe API::Dora::Metrics do
expect(json_response['message']).to eq('You do not have permission to access dora metrics.') expect(json_response['message']).to eq('You do not have permission to access dora metrics.')
end end
end end
context 'when dora_daily_metrics feature flag is disabled' do
before do
stub_feature_flags(dora_daily_metrics: false)
end
it 'returns not found' do
subject
expect(response).to have_gitlab_http_status(:not_found)
end
end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment