Skip to content

Add project-level DORA metrics to GraphQL

Nathan Friend requested to merge nfriend-add-dora-metrics-to-graphql into master

What does this MR do?

Updates the GraphQL endpoint to contain DORA metrics information (deployment frequency and lead time data).

This data is identical to the data already exposed through the DORA REST APIs.

What doesn't this MR do?

This MR only exposes project-level DORA metrics. Group-level DORA metrics will be exposed in a follow-up MR.

Example query/response

Query:

{
  project(fullPath: "root/environment-test") {
    dora {
      metrics(metric: DEPLOYMENT_FREQUENCY, startDate: "2021-04-01", endDate: "2021-04-07", interval: DAILY, environmentTier: PRODUCTION) {
        date
        value
      }
    }
  }
}

Note: Only the metric parameter is required.

Response:

{
  "data": {
    "project": {
      "dora": {
        "metrics": [
          {
            "date": "2021-04-01",
            "value": 0
          },
          {
            "date": "2021-04-02",
            "value": 100
          },
          {
            "date": "2021-04-03",
            "value": 105
          },
          {
            "date": "2021-04-04",
            "value": 55
          }
        ]
      }
    }
  }
}

Differences from the equivalent REST API

The REST API returns a different shape when the interval parameter is all. For full details, see #334821 (closed).

In this GraphQL implementation, the return type is always the same, regardless of the interval parameter. Querying with interval: ALL will return something like this:

{
  "data": {
    "project": {
      "dora": {
        "metrics": [
          {
            "date": null,
            "value": 260
          }
        ]
      }
    }
  }
}

Related to #323966 (closed)

Edited by Nathan Friend

Merge request reports

Loading