Skip to content
/ semantic_layer Public template

This is a working example of a semantic layer sync into Statsig.

License

Notifications You must be signed in to change notification settings

statsig-io/semantic_layer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

87 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Statsig Semantic Layer Synchronization Demo

Welcome to the demonstration repository for synchronizing a semantic layer with Statsig. This repository showcases how to integrate Statsig with your data metrics and sources through an automated process. Utilizing a script executed by a GitHub Action, this setup automatically synchronizes changes to .yml files located in the /metrics or /metric_sources directories. This means that whenever you create or update these files, the script either updates existing metrics or metric sources in Statsig or creates new ones accordingly. Note: The current setup does not handle deletions.

To integrate this process into your workflow, follow these steps:

  1. Fork this repository to get started.
  2. In your forked repository, add your Statsig Console API Key to GitHub Secrets.
  3. Tailor the metric definitions to align with your data needs.
  4. Verify the automation by modifying relevant files and observing the triggered GitHub Action.

Detailed Guide

Forking the Repository

  1. Fork this repository to create a copy in your GitHub account. Untitled

Adding the Statsig Console API Key

  1. Navigate to Settings > Secrets and variables > Actions in your repository settings. Create a new secret named STATSIG_API_KEY with your Statsig Console API key as its value. This key facilitates authentication with the Statsig Console API for the synchronization process. Untitled

Customizing Metric Definitions

  1. Metric definitions reside within the ./metrics directory, and metric source definitions are found in the ./metric_sources/ directory. To customize:

    • Utilize the Statsig Console API to fetch an existing metric_source or metric using GET requests for metric sources and metrics.
    • Remove the provided example metrics and metric sources, and replace them with your definitions in ./metric_sources/*.yml and ./metrics/*.yml.

Note: For enhanced readability, we modified metric.warehouseNative[] to metric.metricDefinition[] in our examples. You can see this change here. Feel free to adjust the translations or revert to using metric.warehouseNative[] in your definitions.

Verifying Automation

  1. To test, edit a metric or metric source description in your repository. This action should trigger the GitHub Action, visible under the Actions tab. The process will then either create or update your metrics and metric sources in Statsig based on the repository's semantic definitions.
Untitled Untitled Untitled

Seeking Feedback

  1. This example serves as a basic MVP. We encourage testing and further development to meet production standards. Please share any feedback or improvements you've made to this workflow. Thank you for your contributions!

About

This is a working example of a semantic layer sync into Statsig.

Resources

License

Stars

Watchers

Forks