|
| 1 | +--- |
| 2 | +title: 'Advanced Features' |
| 3 | +description: 'Optional integrations such as Datadog telemetry and CI Insights object storage.' |
| 4 | +--- |
| 5 | + |
| 6 | +## Mergify Instance Datadog Integration |
| 7 | + |
| 8 | +You can monitor your Mergify Enterprise instance using Datadog for metrics and logs. |
| 9 | + |
| 10 | +### Enabling metrics |
| 11 | + |
| 12 | +Mergify can emit metrics to Datadog via StatsD. Set the following environment variables on the |
| 13 | +engine container: |
| 14 | + |
| 15 | +```ini |
| 16 | +DD_TRACE_ENABLED=1 |
| 17 | +DD_DOGSTATSD_DISABLE=0 |
| 18 | +DD_AGENT_HOST=<my-datadog-agent-host> |
| 19 | +DD_DOGSTATSD_PORT=8125 |
| 20 | +GUNICORN_CMD_ARGS="--statsd-host=<my-datadog-agent-host>:8125" |
| 21 | +``` |
| 22 | + |
| 23 | +### Enabling logging |
| 24 | + |
| 25 | +Configure the Datadog Agent to accept UDP logs by creating |
| 26 | +`/etc/datadog-agent/mergify-engine.d/conf.yaml`: |
| 27 | + |
| 28 | +```yaml |
| 29 | +init_config: |
| 30 | + |
| 31 | +instances: |
| 32 | + |
| 33 | +logs: |
| 34 | + - type: udp |
| 35 | + port: 10518 |
| 36 | + source: python |
| 37 | + service: mergify-engine |
| 38 | + sourcecategory: sourcecode |
| 39 | +``` |
| 40 | +
|
| 41 | +Then instruct Mergify to ship its logs: |
| 42 | +
|
| 43 | +```ini |
| 44 | +MERGIFYENGINE_LOG_DATADOG=udp://<my-datadog-agent-host>:10518 |
| 45 | +``` |
| 46 | + |
| 47 | +## CI Insights Object Storage |
| 48 | + |
| 49 | +CI test traces can be exported to Mergify CI Insights by backing the feature with object storage. |
| 50 | +Set `MERGIFYENGINE_CI_TRACES_BACKEND` and bucket credentials according to your provider. |
| 51 | + |
| 52 | +### Google Cloud Storage |
| 53 | + |
| 54 | +Requirements: |
| 55 | + |
| 56 | +- Two buckets: `<mycompany>-mergify-ci-traces-incoming` and |
| 57 | + `<mycompany>-mergify-ci-traces-done` |
| 58 | + |
| 59 | +- Service Account with read/write/delete access (`Object Storage User` role scoped to these buckets) |
| 60 | + |
| 61 | +- JSON key for that Service Account |
| 62 | + |
| 63 | +Base64-encode the JSON key: |
| 64 | + |
| 65 | +```sh |
| 66 | +cat credentials.json | base64 -w0 |
| 67 | +``` |
| 68 | + |
| 69 | +Configure the engine: |
| 70 | + |
| 71 | +```ini |
| 72 | +MERGIFYENGINE_CI_TRACES_BACKEND="gcs" |
| 73 | +MERGIFYENGINE_CI_TRACES_INCOMING_BUCKET="<mycompany>-mergify-ci-traces-incoming" |
| 74 | +MERGIFYENGINE_CI_TRACES_DONE_BUCKET="<mycompany>-mergify-ci-traces-done" |
| 75 | +MERGIFYENGINE_GCS_CREDENTIALS="base64-encoded-credentials-json" |
| 76 | +``` |
| 77 | + |
| 78 | +### Amazon S3 |
| 79 | + |
| 80 | +Requirements: |
| 81 | + |
| 82 | +- Two buckets named `<mycompany>-mergify-ci-traces-incoming` and |
| 83 | + `<mycompany>-mergify-ci-traces-done` |
| 84 | + |
| 85 | +- IAM credentials with read/write/delete rights on those buckets |
| 86 | + |
| 87 | +Environment variables: |
| 88 | + |
| 89 | +```ini |
| 90 | +MERGIFYENGINE_CI_TRACES_BACKEND="s3" |
| 91 | +MERGIFYENGINE_CI_TRACES_INCOMING_BUCKET="<mycompany>-mergify-ci-traces-incoming" |
| 92 | +MERGIFYENGINE_CI_TRACES_DONE_BUCKET="<mycompany>-mergify-ci-traces-done" |
| 93 | +MERGIFYENGINE_AWS_ACCOUNT_ID=1234567 |
| 94 | +MERGIFYENGINE_AWS_ACCESS_KEY_ID=123567 |
| 95 | +MERGIFYENGINE_AWS_SECRET_ACCESS_KEY=<secret> |
| 96 | +# Optional |
| 97 | +MERGIFYENGINE_AWS_REGION_NAME=us-west-2 |
| 98 | +# Custom S3 implementation endpoint |
| 99 | +MERGIFYENGINE_AWS_ENDPOINT_URL_S3=s3://my-s3-domain.example.com:1234/ |
| 100 | +``` |
| 101 | + |
| 102 | +## Slack Integration |
| 103 | + |
| 104 | +Mergify Enterprise 8.6.0+ can post notifications directly to Slack. These steps assume your |
| 105 | +self-hosted dashboard lives at `https://mergify.mycompany.com`—adjust URLs as needed. |
| 106 | + |
| 107 | +### 1. Create a Slack App |
| 108 | + |
| 109 | +Visit [api.slack.com/apps](https://api.slack.com/apps) and click **Create New App**. Once created, |
| 110 | +configure the app: |
| 111 | + |
| 112 | +#### OAuth & Permissions |
| 113 | + |
| 114 | +- Add redirect URL: `https://mergify.mycompany.com/front/integrations/callback/slack`. |
| 115 | +- Add the scopes required for channel messaging and metadata (reuse your existing scope list). |
| 116 | + |
| 117 | +#### Incoming Webhooks |
| 118 | + |
| 119 | +- Enable Incoming Webhooks so Mergify can send messages. |
| 120 | + |
| 121 | +#### Event Subscriptions |
| 122 | + |
| 123 | +- Enable events and set the request URL to `https://mergify.mycompany.com/slack-event`. |
| 124 | +- Subscribe the bot to the `channel_rename` event so channel names stay in sync. |
| 125 | + |
| 126 | +### 2. Set Environment Variables |
| 127 | + |
| 128 | +In your engine container, provide the Slack credentials (under **Basic Information** in the Slack |
| 129 | +app): |
| 130 | + |
| 131 | +```ini |
| 132 | +MERGIFYENGINE_SLACK_CLIENT_ID=<Slack client ID> |
| 133 | +MERGIFYENGINE_SLACK_CLIENT_SECRET=<Slack client secret> |
| 134 | +MERGIFYENGINE_SLACK_SIGNING_SECRET=<Slack signing secret> |
| 135 | +``` |
| 136 | + |
| 137 | +### 3. Allow URLs |
| 138 | + |
| 139 | +Permit outbound calls from Mergify to Slack: |
| 140 | + |
| 141 | +- `https://slack.com/oauth/v2/authorize` |
| 142 | +- `https://slack.com/api/oauth.v2.access` |
| 143 | +- `https://hooks.slack.com/*` |
| 144 | +- `https://slack.com/api/conversations.info` |
| 145 | + |
| 146 | +Also ensure Slack can reach these endpoints on your deployment: |
| 147 | + |
| 148 | +- `https://mergify.mycompany.com/front/integrations/callback/slack` |
| 149 | +- `https://mergify.mycompany.com/slack-event` |
| 150 | +- `https://mergify.mycompany.com/slack-interaction` |
| 151 | + |
| 152 | +### 4. Connect via the Dashboard |
| 153 | + |
| 154 | +From the Mergify dashboard (`Integrations → Slack`), initiate the OAuth flow and select the channels |
| 155 | +you want to notify. Each integration can post to multiple channels for different event types. |
0 commit comments