GuidesAPI Reference
Submit Documentation FeedbackJoin Developer CommunityLog In

Set up New Relic

This integration enables you to associate an Optimizely feature flag, variation, or experiment with New Relic performance data.

You can track and monitor New Relic data and additionally segment the experiences delivered by Optimizely.

Using Optimizely’s notification listeners, you can forward events that occur in the SDK using your New Relic custom attributes.

In the example code below, we add a call to New Relic in the activate callback function. This can be placed directly after initializing the Optimizely client. This assumes a New Relic object is in scope.

const optimizely = require('@optimizely/optimizely-sdk');
const optimizelyEnums = require('@optimizely/optimizely-sdk/lib/utils/enums');
const newrelic = require('newrelic');

function onActivate(activateObject) {
  newrelic.addCustomAttributes({
    'optimizely_segment': activateObject.experiment['key']);
  });
}

// Add a ACTIVATE notification listener
let activateId = optly.notificationCenter.addNotificationListener(
  optimizelyEnums.NOTIFICATION_TYPES.ACTIVATE,
  onActivate
);
from optimizely.notification_center import NotificationCenter
from optimizely.helpers import enums
import newrelic

def on_activate(experiment, user_id, attributes, variation, event):
    newrelic_obj.agent.add_custom_parameter(‘optimizely_segment’, variation)

opt_obj.notification_center.add_notification_listener(enums.NotificationTypes.ACTIVATE, on_activate)

📘

Note

This integration currently doesn't support feature rollouts.


Did this page help you?