Datadog

With the Datadog integration, you can enrich your RUM data with feature flag data. This will enable you to catch regressisions on new feature releases.

Get available features from Bucket

In this example, we're using the Browser SDK:

//init
const bucket = new BucketBrowserSDK.BucketClient({
    publishableKey: "pub_prod_5eS0G5hX4ZOpwoAw1CKTeP",
    user: { 
        id: "u1234", 
        name: "Rasmus Makwarth" 
    },
});

//get features
const features = bucket.getFeatures();

This will return JSON with all available features for the authenticated user:

"features": {
    "export-to-csv": {
        "isEnabled": true,
        "key": "export-to-csv",
        "targetingVersion": 2
    },
    ...
}

Add as RUM context on Datadog

We can forward all features or pick certain features and send access state to Datadog (documentation):

datadogRum.addFeatureFlagEvaluation("export-to-csv", true);
//etc. 

Which will look like this on Datadog:

Last updated