This guide explains how LaunchDarkly partners can use the REST API to build an integration for Creating and managing metrics. By the end of this guide, you as a LaunchDarkly partner should have the information you need to create an integration that can create metrics for our joint customers’ LaunchDarkly experiments.
Experimentation lets you validate the impact of features you roll out to your app or infrastructure. You can measure things like page views, clicks, load time, infrastructure costs, and more.
By connecting metrics you create to flags in your LaunchDarkly environment, you can measure the changes in your customer’s behavior based on what flags they evaluate. This helps you make more informed decisions, so the features your development team ships align with your business objectives.
You can use this integration method to create custom conversion binary metrics, custom conversion count metrics, and custom numeric metrics:
To learn more, read Events.
To build an integration, make sure you meet the prerequisites. Then follow the steps outlined on the Getting started page.
The Getting started page explains each of the following steps in detail:
"otherCapabilities"" ["external"].For a custom metric integration, the following sections describe the required request format.
All API calls from LaunchDarkly partners should include a custom User-Agent:
Your integration can use either API keys or OAuth for authentication:
LaunchDarkly has support for OAuth clients. The only two types of scoped permissions are currently reader and writer. A metric integration needs the writer scope so it can create metrics. However, your customers may not want to provide the level of access overall that this functionality would grant.
For a custom metric integration, we suggest that partners use an API key.
The endpoint to create a new metric accepts a POST body in JSON format. The minimum set of required parameters is:
key: The metric key.kind: This kind of event your metric will track. This should be custom.isNumeric: Whether to track numeric changes in value against a baseline (true) or to track a conversion when users taken an action (false).unit: The unit of measure for numeric custom metrics.eventKey: This should be equal to the event key you’re using in your code.Sending custom events to LaunchDarkly requires a unique event key. You can set the event key to anything you want. Adding this event key to your codebase lets your SDK track actions customers take in your app as events. To learn more, read Sending custom events.
LaunchDarkly also automatically generates a metric key when you create a metric. You only use the metric key to identify the metric in API calls. To learn more, read Creating and managing metrics.
You can also use the REST API: Create a LaunchDarkly metric
This manifest is required for an integration. It renders your integration metadata inside of the LaunchDarkly UI.
This guide describes the process of building a metric integration. To learn more about building your own integrations, read Building partner integrations.