---
title: Mergify
description: Monitor your Mergify merge queue stats
breadcrumbs: Docs > Integrations > Mergify
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# Mergify
Supported OS Integration version2.0.0
{% callout %}
# Important note for users on the following Datadog sites: us2.ddog-gov.com

{% alert level="info" %}
To find out if this integration is available in your organization, see your [Datadog Integrations](https://app.datadoghq.com/integrations) page or ask your organization administrator.

To initiate an exception request to enable this integration for your organization, email [support@ddog-gov.com](mailto:support@ddog-gov.com).
{% /alert %}

{% /callout %}
Mergify - Merge Queue Stats
## Overview{% #overview %}

This integration sends [Mergify](https://mergify.com) merge queue metrics to your Datadog account, so you can monitor and alert on your merge queue alongside the rest of your observability data. It covers merge queue throughput (pull requests entered and merged, queue and batch size), queue health (exit reasons, check outcomes, CI retries, and bisections), and performance (queue time, CI runtime, and idle waits) for each configured repository. It ships with an out-of-the-box **Mergify - Merge Queue Stats** dashboard to get you started.

## Setup{% #setup %}

- **In Datadog**: Go to **Integrations**, select the Mergify tile and click **Install Integration**.
- Click **Connect Accounts** to begin authorization of this integration. You will be redirected to the [Mergify dashboard](https://dashboard.mergify.com).
- **In the Mergify dashboard**: Log in, select the organization you would like to set up the **Datadog Integration** for and click **Connect the integration**.

Your Mergify statistics now appear in Datadog.

## Uninstallation{% #uninstallation %}

1. Go to the [Mergify dashboard](https://dashboard.mergify.com), log in, and navigate to **Integrations**.
1. Click the **Disconnect** button in the **Datadog** tile.

Once this integration has been uninstalled, any previous authorizations are revoked.

Note: Ensure that all API keys associated with this integration have been disabled by searching for the integration name on the Datadog [API Keys page](https://app.datadoghq.com/organization-settings/api-keys?filter=Mergify).

## Data Collected{% #data-collected %}

### Metrics{% #metrics %}

|  |
|  |
| **mergify.merge\_queue\_length**(gauge)                 | [Deprecated] Merge queue length. Use mergify.queue.size.max instead                                                                            |
| **mergify.time\_to\_merge.median**(gauge)               | [Deprecated] Median time to merge. Use mergify.queue.total_queue_time instead*Shown as second*                                                 |
| **mergify.time\_to\_merge.mean**(gauge)                 | [Deprecated] Mean time to merge. Use mergify.queue.total_queue_time instead*Shown as second*                                                   |
| **mergify.queue\_checks\_outcome**(gauge)               | [Deprecated] Number of queue operation outcomes by outcome_type tag. Use mergify.queue.check_outcome instead                                   |
| **mergify.queue.entered**(count)                        | Number of pull requests that entered the merge queue                                                                                           |
| **mergify.queue.merged**(count)                         | Number of pull requests merged from the queue                                                                                                  |
| **mergify.queue.size.max**(gauge)                       | Maximum number of pull requests waiting in the queue during the period                                                                         |
| **mergify.queue.batch\_size.sum**(count)                | Sum of batch sizes in pull requests per batch. Divide by mergify.queue.batch_size.count for the average batch size                             |
| **mergify.queue.batch\_size.count**(count)              | Number of batches observed. Denominator for the average batch size                                                                             |
| **mergify.queue.running\_checks.max**(gauge)            | Maximum number of concurrent CI checks running for the queue during the period                                                                 |
| **mergify.queue.exit\_reason**(count)                   | Number of pull requests that left the queue split by reason in the exit_reason tag                                                             |
| **mergify.queue.check\_outcome**(count)                 | Number of batch check outcomes split by result in the outcome tag                                                                              |
| **mergify.queue.checks\_retries.recovered**(count)      | Number of CI check sessions that recovered after a retry                                                                                       |
| **mergify.queue.checks\_retries.not\_recovered**(count) | Number of CI check sessions that did not recover after a retry                                                                                 |
| **mergify.queue.bisection.started**(count)              | Number of batch bisections started to isolate a failing pull request                                                                           |
| **mergify.queue.total\_queue\_time.sum**(count)         | Sum of total time pull requests spent in the queue. Divide by mergify.queue.total_queue_time.count for the average queue time*Shown as second* |
| **mergify.queue.total\_queue\_time.count**(count)       | Number of pull requests that left the queue. Denominator for the average total queue time                                                      |
| **mergify.queue.ci\_runtime.sum**(count)                | Sum of CI runtime across queued pull requests. Divide by mergify.queue.ci_runtime.count for the average CI runtime*Shown as second*            |
| **mergify.queue.ci\_runtime.count**(count)              | Number of CI runtime samples. Denominator for the average CI runtime                                                                           |
| **mergify.queue.idle.capacity.sum**(count)              | Sum of time pull requests spent waiting for queue capacity (CI slots). Divide by mergify.queue.idle.count for the average*Shown as second*     |
| **mergify.queue.idle.schedule.sum**(count)              | Sum of time pull requests spent waiting on a merge schedule. Divide by mergify.queue.idle.count for the average*Shown as second*               |
| **mergify.queue.idle.freeze.sum**(count)                | Sum of time pull requests spent waiting on a queue freeze. Divide by mergify.queue.idle.count for the average*Shown as second*                 |
| **mergify.queue.idle.count**(count)                     | Number of queue-leave events. Shared denominator for the mergify.queue.idle.*.sum metrics                                                      |

The merge queue stats metrics (prefixed `mergify.queue.`) cover three categories:

- **Throughput**: pull requests entered and merged, queue size, batch size, and concurrent running checks.
- **Queue Health**: queue exit reasons, batch check outcomes, CI check retries, and batch bisections.
- **Performance**: total queue time, CI runtime, and idle time spent waiting for capacity, schedules, or freezes.

These metrics are tagged by `repository`, `branch`, `queue`, and `priority_rule`. Duration and size averages are submitted as `sum` and `count` companions, derived in Datadog as `sum / count` (for example, `mergify.queue.total_queue_time.sum / mergify.queue.total_queue_time.count`).

#### Queue outcomes and exit reasons{% #queue-outcomes-and-exit-reasons %}

`mergify.queue.check_outcome` (tag `outcome`) and the deprecated `mergify.queue_checks_outcome` (tag `outcome_type`) report the same set of values. `mergify.queue.exit_reason` (tag `exit_reason`) reports these same values plus `UNKNOWN` (no reason was recorded):

- `SUCCESS`: the pull request was merged
- `PR_DEQUEUED`: the pull request was manually dequeued
- `PR_DEQUEUED_FROM_PARTITION`: the pull request was removed from a partition
- `PR_AHEAD_DEQUEUED`: a pull request ahead in the queue was dequeued
- `BATCH_AHEAD_FAILED`: a batch ahead in the queue failed to merge
- `PR_WITH_HIGHER_PRIORITY_QUEUED`: a higher-priority pull request was queued
- `SCHEDULED_FREEZE_STATUS_CHANGED`: a scheduled freeze changed the freeze status
- `SPECULATIVE_CHECK_NUMBER_REDUCED`: the number of speculative checks was reduced
- `CHECKS_TIMEOUT`: the speculative checks timed out
- `CHECKS_FAILED`: the speculative checks failed
- `QUEUE_RULE_MISSING`: the queue rule used to queue the pull request no longer exists
- `BASE_BRANCH_MISSING`: the base branch no longer exists
- `BASE_BRANCH_CHANGED`: the pull request base branch changed
- `PR_UNEXPECTEDLY_FAILED_TO_MERGE`: the pull request unexpectedly failed to merge
- `BATCH_MAX_FAILURE_RESOLUTION_ATTEMPTS`: the maximum batch failure-resolution attempts were reached
- `PR_CHECKS_STOPPED_BECAUSE_MERGE_QUEUE_PAUSE`: checks were interrupted because the merge queue is paused
- `CONFLICT_WITH_BASE_BRANCH`: the pull request conflicts with the base branch
- `CONFLICT_WITH_PULL_AHEAD`: the pull request conflicts with a pull request ahead in the queue
- `BRANCH_UPDATE_FAILED`: the pull request branch could not be updated
- `DRAFT_PULL_REQUEST_CHANGED`: non-Mergify commits were added to the draft pull request
- `BATCH_PULL_REQUEST_CLOSED`: the batch pull request was closed
- `PULL_REQUEST_UPDATED`: the pull request was manually updated
- `MERGE_QUEUE_RESET`: the merge queue was reset
- `INCOMPATIBILITY_WITH_BRANCH_PROTECTIONS`: the pull request is incompatible with the branch protections
- `PR_MANUALLY_MERGED`: the pull request was merged manually, outside Mergify
- `DRAFT_PULL_REQUEST_CREATION_FAILED`: the draft pull request could not be created
- `DRAFT_PULL_REQUEST_CREATION_BRANCH_NOT_INDEXED`: the draft pull request could not be created because of a GitHub branch-indexing delay
- `CONFIGURATION_CHANGED`: the Mergify configuration changed
- `UNPROCESSABLE_PULL_REQUEST`: the pull request could not be processed
- `PR_MANUALLY_DEQUEUED`: the pull request was dequeued by a command
- `STACK_PREDECESSOR_DEQUEUED`: a stack predecessor was dequeued
- `INTERMEDIATE_RESULTS_SKIPPED`: intermediate results were skipped during batch promotion
- `CHECKS_RETRIED`: the checks failed and are being retried
- `SCHEDULE_BLOCKED_AHEAD_YIELDED`: a schedule-blocked pull request ahead yielded its position

### Service Checks{% #service-checks %}

Mergify does not include any service checks.

### Events{% #events %}

Mergify does not include any events.

## Support{% #support %}

Need help? Contact [Mergify support](https://mergify.com).
