For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Sign inTry it free
DocsGuidesSDKsIntegrationsAPI docsTutorialsFlagship blog
DocsGuidesSDKsIntegrationsAPI docsTutorialsFlagship blog
  • Get started
    • Overview
    • Onboarding
    • Get started
    • Launch Insights
    • LaunchDarkly architecture
    • LaunchDarkly vocabulary
  • AgentControl
    • AgentControl
    • Manage AgentControl
  • Feature flags
    • Create flags
    • Target with flags
    • Flag templates
    • Manage flags
    • Code references
    • Contexts
    • Segments
  • Releases
    • Releasing features with LaunchDarkly
    • Release policies
    • Percentage rollouts
    • Progressive rollouts
    • Guarded rollouts
    • Feature monitoring
    • Release pipelines
    • Engineering insights
    • Release management tools
    • Applications and app versions
    • Change history
    • Restoring previous flag versions
  • Observability
    • Observability
    • Session replay
    • Error monitoring
    • Logs
    • Traces
    • Observability metrics
    • Product analytics events
    • LLM observability
    • Alerts
    • Dashboards
    • Service map
    • Vega for auto-remediation
    • Observability MCP server
    • Search specification
    • Observability settings
    • Observability integrations
  • Experimentation
    • Experimentation
    • Experiment metric types
    • Experiment configuration
    • Managing experiments
    • Analyzing experiments
    • Multi-armed bandits
    • Holdouts
  • Metrics and events
    • Metrics in LaunchDarkly
    • Creating metrics
    • Metric groups
    • Events
    • Autogenerated metrics
  • Warehouse native
    • Warehouse native metrics
      • Metric data sources
    • Setting up external warehouses
    • Creating experiments using warehouse native metrics
  • Infrastructure
    • Connect apps and services to LaunchDarkly
    • LaunchDarkly in China and Pakistan
    • LaunchDarkly in the European Union (EU)
    • LaunchDarkly in federal environments
    • Public IP list
  • Your account
    • Projects
    • Views
    • Environments
    • Tags
    • Teams
    • Members
    • Roles
    • Account security
    • Feature previews
    • Billing and usage
    • Changelog
Sign inTry it free
LogoLogo
On this page
  • Overview
  • Prerequisites
  • Snowflake-specific prerequisites
  • Create data sources
  • Archive data sources
Warehouse nativeWarehouse native metrics

Metric data sources

Was this page helpful?
Previous

Setting up external warehouses

Next
Built with

Overview

This topic explains how to create metric data sources for warehouse native metrics.

Metric data sources allow you to bring multiple data tables directly from your external warehouse into LaunchDarkly, without requiring you to centralize your data in a single, all-events table. This lets you add multiple tables as a data source to better match how you have organized your data warehouse.

Prerequisites

To create a metric data source in the LaunchDarkly UI:

  • You must have an existing warehouse native Experimentation integration. To learn more, read Setting up external warehouses.

Snowflake-specific prerequisites

If you are using Snowflake, you must have the LD_DATA_SOURCE_ROLE role in Snowflake. You create this role when you set up the Snowflake Native Experimentation integration. If you modify the native-app-provided SQL before you run it, be sure that this role has read-only access to your metric events tables, schemas, and databases, and no other resources.

When LaunchDarkly calculates your experiment results, it will execute your data source query using the role LD_EXPERIMENTATION_ROLE.

Create data sources

When you create a new metric data source from your warehouse tables, you must map your warehouse table columns to the schema that LaunchDarkly needs to create a metric and run an experiment.

To create a data source:

  1. Open the Data section and navigate to Metric data sources.
  2. Click Create.
  3. In the “Name your data source” section, enter a data source Name.
  4. (Optional) Add a Description.
  5. In the “Define data source” section, click Select warehouse integration and choose the integration for a specific LaunchDarkly project and environment.
  6. Enter a SQL query against one or more tables to return all metric events you want to include in this data source. The query should return data from all columns that provide required ID types to LaunchDarkly. These include a timestamp, an event key such as purchase or button click, an event value (can be null), and at least one column identifying the event’s context, such as user_id or device_id.
  7. Click Run query.
  8. In the “Map your data in LaunchDarkly” section, map your warehouse table columns to fields in LaunchDarkly:
    • Timestamp: Map to the timestamp when the event occurred.
    • Context key: Map to one of your context kinds defined in LaunchDarkly. For example, you can map a “user_id” column to the launchdarkly “user” context.
      • (Optional) Click Add another context pair to add another key/kind pair.
    • Event value: Map to a numeric value representing the event’s measurement, such as order_amount, or 1 for conversion events.
    • Event key: Map to the key of the event type, such as purchase, add to cart, or page view.
  9. Click Save configuration.

Archive data sources

You can archive a data source when you no longer need it. Archiving a metric data source does not make changes to the warehouse integration it is linked to.

To archive a data source:

  1. In LaunchDarkly, navigate to the Metrics list.
  2. Click on the Data sources tab.
  3. Click the name of the data source you want to archive.
  4. Scroll to the bottom of the screen and click Archive.