Flag triggers are only available to customers on select plans. To learn more, read about our pricing. To upgrade your plan, contact Sales.
This topic explains how to use LaunchDarkly’s trigger feature with Datadog. For example, you can create an alert in Datadog that toggles a flag’s targeting on or off if a performance metric drops below a certain threshold.
We recommend using flag triggers for Datadog alerts only, not recovery alerts. If you connect a trigger to recovery alerts, the trigger activates on recovery as well as on alert.
To learn more about configuring your webhook without recovery alerts, read Connect the webhook to a Datadog event.
In order to complete this topic, you must meet the following prerequisites.
Connecting a LaunchDarkly trigger to Datadog takes two steps.
You must:
First you must configure a JSON template to use the LaunchDarkly trigger.
To configure the template:
Log in to Datadog.
Navigate to Integrations and search for the Webhooks section.
Create a new webhook based on the Installation instructions and paste the LaunchDarkly trigger URL into the URL field.
Copy this Datadog payload into the configuration field in Datadog:
The only payload keys LaunchDarkly processes are title and url. Any other fields you put in the payload do not appear in LaunchDarkly.
If you use a different JSON template than the one provided above, you must include the title and url fields or the trigger will not save useful data about the event in the flag’s change history. The url is the URl of your Datadog event.
After you create the webhook in Datadog, you must connect it to an event in order for the LaunchDarkly trigger to perform actions on the flag.
Navigate to Monitors.
Choose the Alert you wish to connect to the trigger and add the webhook you created earlier to that alert.
If you don’t want Datadog to trigger when the alert recovers, wrap the webhook in the following template expression:
Click Save.
In the Datadog metric alert you want to activate the flag trigger, add @webhook-<YOUR_WEBHOOK_NAME>.
After you create a trigger in Datadog, you can verify that it has connected to LaunchDarkly correctly.
To test the trigger:
Your configuration details may vary based on your requirements.
To learn more about how Datadog handles webhooks, read Datadog’s documentation.
To improve security and limit access, assign a role that grants only the permissions required by the Datadog App Builder integration. This integration only needs to toggle a feature flag’s targeting. To achieve this, the role must allow the updateOn action.
The updateOn action grants the App Builder integration permission to toggle the state of your feature flags to on or off when a trigger fires.
Here are some example custom role policies:
A policy that permits the integration to perform only the updateOn action on the specified resource:
A policy that permits the integration to perform only the updateOn action on all flags in a specific environment:
To learn more about creating and managing roles, read Roles.