Using flag triggers with New Relic One
Read time: 2 minutes
Last edited: Sep 29, 2021
This topic explains how to use LaunchDarkly's trigger feature with New Relic One. For example, you can create an policy in New Relic One that uses a LaunchDarkly trigger to toggle a flag on or off if a performance metric drops below a certain threshold.
In order to complete this topic, you must meet the following prerequisites:
- You must have a feature flag with a trigger. To learn more about creating triggers, read Creating a new flag trigger.
- You must have access to the trigger's URL, which you copied and saved during the trigger creation process. To learn more, read Understanding flag triggers' security.
- You must have an existing New Relic One account.
Connecting a LaunchDarkly trigger to New Relic One takes two steps.
- Create a webhook-type notification channel in New Relic One with your trigger URL, and
- Connect that webhook to a New Relic One policy.
First you must configure a JSON template to use the LaunchDarkly trigger.
To configure the template:
- Log in to New Relic One.
- Navigate to Alerts & AI and look for the Notification Channels section in the sidebar.
- In the Notification Channels section, click + New Notification Channel.
- Select Webhook as the channel type.
- Paste the LaunchDarkly trigger URL into the Base URL field.
- Click Create Channel.
After you create the webhook notification channel in New Relic One, you must connect it to a policy in order for the LaunchDarkly trigger to perform actions on the flag.
- Under Alerts & AI, navigate to Policies.
- Select the policy you wish to connect to the trigger.
- On the policy's Notification channels tab, add your newly-created webhook channel.
After you create a trigger in New Relic One, you can verify that it has connected to LaunchDarkly correctly.
To test the trigger:
- Navigate to the configuration for the webhook notification channel you set up in New Relic One.
- Click Send a test notification at the bottom of the page. A popup with a response code appears.
- Navigate back to the flag's Settings page in LaunchDarkly.
- Click on the overflow dropdown menu on your LaunchDarkly trigger to confirm that the execution count has incremented. Sending a test notification does not trigger the flag action, so don't worry that you might toggle a flag by testing the configuration.
That's it! When the conditions of your policy are met, your flag changes will now be performed.