Add MR lead time data to GraphQL
What does this MR do?
Exposes the MR lead time information (originally implemented in the REST API in !52243 (closed)) through GraphQL.
Example request/response
With interval: ALL
(default)
Query:
{
project(fullPath: "root/release-test") {
analytics {
leadTime(from: "2021-01-01T00:00:00.000Z", interval: ALL) {
nodes {
from
to
value
}
}
}
}
}
Response:
{
"data": {
"project": {
"analytics": {
"leadTime": {
"nodes": [
{
"from": "2021-01-01",
"to": "2021-02-12T16:47:43+00:00",
"value": 3840
}
]
}
}
}
}
}
With interval: MONTHLY
Query:
{
project(fullPath: "root/release-test") {
analytics {
leadTime(from: "2021-01-01T00:00:00.000Z", interval: MONTHLY) {
nodes {
from
to
value
}
}
}
}
}
Response:
{
"data": {
"project": {
"analytics": {
"leadTime": {
"nodes": [
{
"from": "2021-02-01T00:00:00Z",
"to": "2021-03-01T00:00:00Z",
"value": 3840
}
]
}
}
}
}
}
With interval: DAILY
(this will be what the UI uses)
Query:
{
project(fullPath: "root/release-test") {
analytics {
leadTime(from: "2021-01-01T00:00:00.000Z", interval: DAILY) {
nodes {
from
to
value
}
}
}
}
}
Response:
{
"data": {
"project": {
"analytics": {
"leadTime": {
"nodes": [
{
"from": "2021-02-05",
"to": "2021-02-06",
"value": 5037
},
{
"from": "2021-02-10",
"to": "2021-02-11",
"value": 1446
}
]
}
}
}
}
}
When the user doesn't have permission or the feature isn't licensed
Query:
{
project(fullPath: "root/release-test") {
analytics {
leadTime(from: "2021-01-01T00:00:00.000Z", interval: DAILY) {
nodes {
from
to
value
}
}
}
}
}
Response:
{
"data": {
"project": {
"analytics": {
"leadTime": null
}
}
}
}
When an error occurs
Query:
{
project(fullPath: "root/release-test") {
analytics {
leadTime(from: "2020-01-01T00:00:00.000Z", interval: DAILY) {
nodes {
from
to
value
}
}
}
}
}
Response:
{
"data": {
"project": {
"analytics": {
"leadTime": null
}
}
},
"errors": [
{
"message": "Date range is greater than 91 days",
"locations": [
{
"line": 4,
"column": 7
}
],
"path": [
"project",
"analytics",
"leadTime"
]
}
]
}
Authorization
This new GraphQL data is available to projects on GitLab Ultimate and users with at least Reporter permissions. This matches the counterpart REST API.
Other changes
This MR deprecates the project.pipeline_analytics
field in favor of the new project.analytics.pipeline
. This groups all project analytics under the same field. The deprecated field is not removed and will continue to function as usual, so this will not affect end-users in any way.
Related to #291746 (closed)
Edited by Nathan Friend