Send deployment information
Read time: 4 minutes
Last edited: Jun 24, 2024
Overview
This topic explains how to configure your app to send deployment information to LaunchDarkly. In LaunchDarkly, a deployment is a new code change your team has introduced to an environment.
Configuring your app to send deployment information to LaunchDarkly lets LaunchDarkly track the frequency and timing of your deployments. LaunchDarkly calculates deployment frequency by receiving deployment start and end times from your pipeline. It also lets LaunchDarkly automatically create a list of deployed applications, which is stored in your account settings.
Until you configure it, LaunchDarkly will prompt you to set up your deployment pipeline:
Click Configure to view the instructions.
There are two options for sending deployment information:
Both options automatically create an application in LaunchDarkly.
Option 1: Set up automated deployment detection
To set up automated deployment detection, specify an application identifier and application version in the configuration options for the LaunchDarkly SDK. Then, update the application version each time you want to indicate a new deployment. To confirm whether your SDK supports these configuration options, read Application metadata configuration.
We recommend using this option if you want to minimize instrumenting your deployment pipeline. Using this method means all communication about deployment events occurs through LaunchDarkly SDK calls. The application identifier and application version are included in real-time flag events, and LaunchDarkly analyzes this information to detect precisely when your end users start using an updated version.
You can set application identifier and application version configuration options for your LaunchDarkly SDKs.
Configure your SDK: Application metadata configuration
Set the application identifier
LaunchDarkly assumes the application identifier is the application key. Typically this is the name of one of the GitHub repositories that you use in this project. LaunchDarkly automatically creates a new application each time you send a unique application identifier.
Set the application version
You can set the application version to any string that includes only letters, numbers, periods (.
), hyphens (-
), or underscores (_
). For example, you could set this to the semantic version of your application.
To enable LaunchDarkly to detect and report which pull requests (PRs) are part of a deployment, set the application version to one of the following options:
- at least the first seven characters of the SHA of the GitHub commit for this deployment
- the tag associated with the GitHub commit for this deployment
LaunchDarkly can only associate deployments with PRs or commits if you use one of these options.
To retrieve the SHA for your deployment:
- From the branch you are deploying, run
git rev-parse HEAD
. - Add an environment variable, such as
APPLICATION_VERSION
. - Use that environment variable when you initialize your SDK.
In some cases, the SHA may not be available when you deploy. If you package the SHA into your build artifact, you can avoid using environment variables. For example, Go applications often inject version information using ldflags
. To learn more, read Using ldflags to Set Version Information for Go Applications.
Option 2: Send events from your deployment pipeline
You can configure webhooks from your deployment pipeline to send your deployment events to LaunchDarkly.
We recommend this option in the following scenarios:
-
You are using an SDK that does not support the application identifier and version configuration options.
-
You anticipate having a large number of application versions reporting at once. For example, if you have a large front-end app, especially a single-page app, you might have dozens of application versions being reported, because you have end users working from long-running versions. It may simplify your deployment frequency metrics to send information directly from your deployment pipeline rather than relying on SDK calls.
-
You want to monitor how long your deployments take to complete. If you use application identifier and version configuration options, then LaunchDarkly will report when a deployment occurred. If you use webhooks to send separate events for each deployment's start and finish, then LaunchDarkly will report on deployment duration as well.
Everyone's deployment pipeline is different. We recommend sending deployment events when each deployment has started, finished, or failed.
You can also use the REST API: Insights deployments (beta)
Additional setup
To finish setting up engineering insights, you may also need to Install the GitHub app and Set up code references. To learn more, read Confirm your setup.