• Home
  • Integrations
  • SDKs
  • Guides
  • API docs
    No results for ""
    EXPAND ALL

    EDIT ON GITHUB

    Application metadata configuration

    Read time: 4 minutes
    Last edited: Feb 01, 2023

    Overview

    This topic explains how to configure LaunchDarkly SDKs to send application metadata to LaunchDarkly. This feature is available for both client-side and server-side SDKs.

    Sending application metadata to LaunchDarkly allows you to populate the "From source" field on Context details pages with information about the SDK or application that sent the context attributes. To learn more, read The context details page.

    Newer versions of LaunchDarkly SDKs replace users with contexts

    A context is a generalized way of referring to the people, services, machines, or other resources that encounter feature flags in your product. To learn more, read Contexts.

    Creating contexts and evaluating flags based on them is supported in the latest major versions of some of our SDKs. For these SDKs, the code samples on this page include the two most recent versions.

    You can upgrade your SDKs at any time, but the ability to target by context, or review context instances that have encountered flags in your application, is only available for customers in the contexts Early Access Program (EAP). If you want access to this feature, join the EAP.

    If you are using the latest version of an SDK and are not part of the EAP, your application can send contexts to LaunchDarkly and they will appear on the Users list.

    Customizing application identifiers and application versions

    Some LaunchDarkly SDKs support application identifier and application version configuration options. These options allow you to send this metadata to LaunchDarkly. You can use this metadata for things like flag targeting and configuring our Accelerate product offering. To learn more, read Getting started with Accelerate.

    For the SDKs that support this feature, you can send the following metadata:

    • Application identifier (string): A unique identifier representing the application where the LaunchDarkly SDK is running. The value can use only alphanumeric characters and hyphens -, periods ., and underscores _. For example, authentication-service.
    • Application version (string): A unique identifier representing the version of the application where the LaunchDarkly SDK is running. The value can use only alphanumeric characters and hyphens -, periods ., and underscores _. For example, you could set this to the semantic version of your application, such as 1.0.0. If you are using Accelerate, we recommend setting the application version to the full secure hash algorithm (SHA) of the GitHub commit for this deployment, such as a12bcde3f45ab6c789123456d78efabcde91234f.

    You can set these values when you configure the SDK. All connections to LaunchDarkly from a client will send the same value to LaunchDarkly, whether the connection is through streaming, polling, or events. You cannot change the value after you configure the client.

    Configuring application metadata for Accelerate

    Accelerate is for Early Access Program customers only

    Accelerate is only available to members of LaunchDarkly's Early Access Program (EAP). If you want access to this feature, join the EAP.

    Configuring your application metadata to send deployment information lets Accelerate track the frequency and timing of your deployments. If you set the application version to a deployment Git SHA, Accelerate will also link the SHAs to your pull requests (PRs) and track which PRs are in your deployment.

    To learn how to retrieve the SHA for your deployment, read Configure your application to send deployment information.

    Details about each SDK's configuration are available in the SDK-specific sections below:

    Client-side SDKs

    This feature is available in the following client-side SDKs:

    Android

    Expand Android code sample

    This code sample shows you how to configure the application identifier and application version:

    LDConfig config = new LDConfig.Builder()
    .applicationInfo(
    Components.applicationInfo()
    .applicationId("authentication-service")
    .applicationVersion("1.0.0")
    )
    .build();

    To learn more, read ApplicationInfoBuilder.

    iOS

    Expand iOS code sample

    This code sample shows you how to configure the application identifier and application version:

    var applicationInfo = ApplicationInfo()
    applicationInfo.applicationIdentifier("authentication-service")
    applicationInfo.applicationVersion("1.0.0")
    var config = LDConfig(mobileKey: mobileKey)
    config.applicationInfo = applicationInfo

    To learn more about the specific configuration options that are available in this SDK, read the SDK's API docs.

    JavaScript

    Expand JavaScript code sample

    This code sample shows you how to configure the application identifier and application version:

    const options = {
    application: {
    id: 'authentication-service',
    version: '1.0.0',
    },
    };
    const client = LDClient.initialize('client-side-id-123abc', context, options);

    To learn more about the specific configuration options that are available in this SDK, read the LDOptions.

    Node.js (client-side)

    Expand Node.js (client-side) code sample

    This code sample shows you how to configure the application identifier and application version:

    const options = {
    application: {
    id: "authentication-service",
    version: "1.0.0"
    }
    };
    const client = LDClient.initialize('client-side-id-123abc', context, options);

    To learn more, read application.

    Server-side SDKs

    This feature is available for the following server-side SDKs:

    Go

    Expand Go code sample

    This code sample shows you how to pass custom parameters to the client by creating a custom configuration object.

    The code in this sample configures the application identifier and application version:

    var config ld.Config
    config.ApplicationInfo.ApplicationID = "authentication-service"
    config.ApplicationInfo.ApplicationVersion = "1.0.0"

    To learn more about the configuration options, read Config.

    Java

    Expand Java code sample

    This code sample shows you how to pass custom parameters to the client by creating a custom configuration object. In this example, we've configured two properties for the application identifier and application version.

    To pass custom parameters:

    LDConfig config = new LDConfig.Builder()
    .applicationInfo(
    Components.applicationInfo()
    .applicationId("authentication-service")
    .applicationVersion("1.0.0")
    ).build();

    For a complete list of configuration options for the client, including proxy settings, timeouts, and streaming/polling options, read the Javadoc for LDConfig.Builder.

    Node.js (server-side)

    Expand Node.js (server-side) code sample

    This code sample shows you how to pass custom parameters to the client by creating a custom configuration object. In this example, we've configured two properties for the application identifier and application version.

    To pass custom parameters:

    var options = {
    application: {
    id: 'authentication-service',
    version: '1.0.0'
    }
    };
    client = ld.init('sdk-key-123abc', options);

    To learn more about the specific configuration options that are available in this SDK, read the SDK's API docs.

    Ruby

    Expand Ruby code sample

    This code sample shows you how to pass custom parameters to the client by creating a custom configuration object. In this example, we've configured two properties for the application identifier and application version.

    To pass custom parameters:

    LaunchDarkly::Config.new({
    application: {
    id: "authentication-service",
    version: "abc123def456"
    }
    })

    To learn more about the specific configuration options that are available in this SDK, read the SDK's API docs.

    Rust

    Expand Rust code sample

    This code sample shows you how to pass custom parameters to the client by creating a custom configuration object:

    let mut application_info = ApplicationInfo::new();
    application_info
    .application_identifier("authentication-service")
    .application_version("1.0.0");
    let config = ConfigBuilder::new(&sdk_key)
    .application_info(application_info)
    .build();

    The Config type lets you specify a variety of options. To learn more about the specific configuration options that are available in this SDK, read the SDK's API docs.