Using flag triggers with New Relic One
Read time: 2 minutes
Last edited: Aug 23, 2024
Overview
This topic explains how to use LaunchDarkly's trigger feature with New Relic One. For example, you can create a policy in New Relic One that uses a LaunchDarkly trigger to toggle a flag's targeting on or off if a performance metric drops below a certain threshold.
Prerequisites
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 flag triggers.
- You must have access to the trigger's URL, which you copied and saved during the trigger creation process. To learn more, read Flag trigger security.
- You must have an existing New Relic One account.
Connect a flag trigger to New Relic One
Connecting a LaunchDarkly trigger to New Relic One takes two steps.
You must:
- Create a webhook-type notification channel in New Relic One with your trigger URL, and
- Connect that webhook to a New Relic One policy.
Set up a JSON template in New Relic One
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 find 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.
Connect the webhook to a New Relic One policy
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.
Test the trigger configuration
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 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.
When the conditions of your policy are met, your flag changes will now be performed.