Incoming: Breaking changes to metrics API and webhooks

We’re introducing some breaking changes to the schema for the Check and Repository types in our GraphQL API, limited to the fields related to repository metrics. This also affects the webhook payloads for the events analysis_run.started and analysis_run.updated that use the same object schema as the corresponding types.

These changes will be effective from 12:00 am PST on Feb 2, 2023 Feb 14, 2023. We recommend handling the changes in any integrations where you consume these APIs and webhook events.

Breaking changes to the Repository type

The schema for the metrics field in the Repository type will be changed from a connection field to a list field. This will change how you query the metrics of a repository.

Current sample query (that will change):

query($name: String!, $login: String!, $vcsProvider: VCSProvider!) {
    repository(name: $name, login: $login, vcsProvider: $vcsProvider) {
        id
        metrics {
            edges {
                node {
                    metric {
                        shortcode
                    }
                    key
                    values {
                        edges {
                          node {
                              value
                          }
                        }
                    }
                }
            }
        }
    }
}

New sample query

query($name: String!, $login: String!, $vcsProvider: VCSProvider!) {
    repository(name: $name, login: $login, vcsProvider: $vcsProvider) {
        id
        metrics {
            shortcode
            items {
                key
                values {
                    edges {
                        node {
                            value
                        }
                    }
                }
            }
        }
    }
}

Breaking changes to the Check type

Similarly, the schema for the metrics field in the Check type will be changed from a connection field to a list field. This will change how you query the metrics in an individual check on a repository.

Current sample query (that will change):

query ($runUid: UUID!) {
    run(runUid: $runUid) {
        checks {
            edges {
                node {
                    metrics {
                        edges {
                            node {
                                repositoryMetric {
                                    metric {
                                        shortcode
                                    }
                                    key
                                }
                                value
                            }
                        }
                    }
                }
            }
        }
    }
}

New sample query

query ($runUid: UUID!) {
    run(runUid: $runUid) {
        checks {
            edges {
                node {
                    metrics {
                        shortcode
                        items {
                            key
                            values {
                                edges {
                                    node {
                                        value
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}