Warehouse nativeWarehouse native metrics

Metric data sources

Overview

This topic explains how to create a metric data source for Snowflake native Experimentation.

Metric data sources allow you to bring multiple data tables directly from your Snowflake 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 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 Snowflake tables, you must map your Snowflake table columns to the schema that LaunchDarkly needs to create a metric and run an experiment.

To create a data source:

  1. Click the gear icon in the left sidenav to view Organization settings.
  2. In the “Connections” section, click Metric data sources.
  3. Click Create.
  4. In the “Name your data source” section, enter a data source Name.
  5. (Optional) Add a Description.
  6. In the “Define data source” section, click Select warehouse integration and choose the Snowflake integration for a specific LaunchDarkly project and environment.
  7. 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.
  8. Click Run query.
  9. In the “Map your data in LaunchDarkly” section, map your Snowflake 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.
  10. 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.