Using flag triggers with Dynatrace
Read time: 2 minutes
Last edited: Sep 15, 2021
This topic explains how to use LaunchDarkly's triggers feature with Dynatrace. For example, you can create an alert in Dynatrace that uses a LaunchDarkly trigger to toggle a flag on or off when a predefined or custom Dynatrace event has been triggered.
We recommend specifying a custom Dynatrace alerting profile for your triggers. This ensures that the scope of events that send a webhook to your LaunchDarkly trigger is correct. To learn more about how to create custom alerting profiles, read Dynatrace's documentation on alerting profiles.
To learn more about how Dynatrace uses triggers, read Dynatrace's documentation on webhooks.
In order to complete this topic, you must meet the following prerequisites:
- You must have a feature flag with a trigger.
- You must have access to the trigger's URL. To learn more about accessing trigger URLs, read Understanding flag triggers' security.
- You must have an existing Dynatrace account.
In order to configure a LaunchDarkly trigger in Dynatrace, you must perform two steps:
- Create an alerting profile in Dynatrace to determine what Dynatrace events you want associated with your trigger, and
- Create a webhook in Dynatrace that includes a custom JSON template with your trigger URL and alerting profile specified.
We strongly recommend that you use a custom alerting profile. Alerting profiles specify what Dynatrace event or set of events will invoke the webhook. In the absence of a user-specified alerting profile, Dynatrace's default alerting profile sends a webhook to LaunchDarkly for all Dynatrace events.
To configure a custom alerting profile:
- Log in to Dynatrace.
- Create a new alerting profile that filters for the sepcific event(s) you want to be associated with your LaunchDarkly trigger. Give the alerting profile a human-readable name. To learn more, read Dynatrace's documentation.
- Click Done in the top right-hand corner of the page.
To see event details associated with the invocation of a LaunchDarkly trigger, you must configure a JSON template when setting up the webhook in Dynatrace.
To configure the template:
- Create a new webhook and paste the LaunchDarkly trigger URL into the Webhook URL field. To learn more, read Dynatrace's documentation.
- Copy this payload into the Custom payload field in Dynatrace.
LaunchDarkly uses the payload
url fields to create the main body of trigger audit log entries. If you use a different JSON template than the one provided above, you must include the
url fields or the trigger will not save useful data about the event in the flag's audit log. The
url is the URL of your Dynatrace event.
- Select your pre-configured alerting profile from the Alerting profile dropdown field.
- Send a test notification in order to save any new webhook configurations or changes.
- Return to the LaunchDarkly flag settings page and check that the test notification has been received by clicking on the overflow menu on your LaunchDarkly trigger and confirming that the execution count has incremented.
- Return to Dynatrace and click Save.
Your new Dynatrace webhook will now trigger flag changes based on the action you specified in LaunchDarkly.