
Introduction
- Run queries in BigQuery to compute exposure and metrics.
- Store assignment data in BigQuery.
- Administrators who want to set up Confidence for their organization
account-<your-account-id>@spotify-confidence.iam.gserviceaccount.com.
You can name your service account anything you want.
For clarity, the tutorial assumes you create a service account called confidence.
You can read more about service account impersonation in the Google Cloud documentation.Before You Begin
- You need to have a Confidence account.
- You need to have a Google Cloud Platform account.
- You need to have permissions to create service accounts.
- You need to have the following APIs enabled in your Google Cloud Platform
project:
- BigQuery API
- Cloud Resource Manager API
Terraform Scripts
Terraform scripts are available to create the service account, setup permissions and create the required datasets. If you are using Terraform, then after you have applied the Terraform Configuration, you can skip directly to step Step 1c.Step 1: Prepare GCP and Create Data Warehouse Connection
In this step, you:- create a service account in GCP that Confidence impersonates
- create a dataset for storing the tables that Confidence generates
- configure a metrics data warehouse connection
Step 1a: Create Service Account
For Confidence to access BigQuery, you need to create a service account that has permissions to access BigQuery. You also need to allow Confidence to impersonate the service account. Follow these steps:Go to Google Cloud Platform Console
Navigate to Service Accounts
Enter service account details
confidence. Make note of the service account email address. You can click copy-to-clipboard icon to copy it. Click CREATE AND CONTINUE.Grant roles to the account
- BigQuery Job User
- BigQuery Data Viewer
Grant Confidence Access to Impersonate the Service Account
Confidence needs to be able to impersonate the service account you just created to be able to access BigQuery. You do this by granting one of Confidence’s own service accounts the “Workload Identity User” role, called the principal account:Open the service account details
Enter the principal account
account-<your-account-id>@spotify-confidence.iam.gserviceaccount.com as principal.Step 1b: Create BigQuery Datasets to Store Metrics and Exposure
Confidence needs a dataset in BigQuery where it can store intermediate metrics and exposure calculations. For Confidence to access the dataset, you need to grant the principal service account access to the dataset.Go to Google Cloud Platform Console
Create a new dataset
Select the dataset location
EU or US.Grant permissions
confidence service account you created and assign the role BigQuery Data Owner.Step 1c: Configure a Metrics Data Warehouse
With the completion of step 1a and 1b, you have now created a service account and a dataset in BigQuery. You can now configure Confidence to use BigQuery to compute metrics. To do so, follow these steps:Navigate to Metrics Data Warehouse settings
Enter connection details
confidence_metrics) and the email address of the confidence service account you created in step 1a.Step 2: Configure Confidence to Write and Read Assignment Data
In this step, you:- create a dataset in BigQuery that Confidence can write assignment data to
- configure a flag applied connector so that Confidence is able to write assignment data
- configure an assignment table so that Confidence is able to read assignment data
Step 2a: Create BigQuery Datasets to Store Assignment Data
If you want to use Confidence Flags to run experiments, you need to complete a few more steps to configure Confidence to store assignment data in BigQuery and an assignment table that reads from the BigQuery table. Confidence needs a dataset in BigQuery where it can store assignment data. For Confidence to access the dataset, you need to grant the principal service account access to the dataset.Go to Google Cloud Platform Console
Create a new dataset
Select the dataset location
EU or US.Grant permissions
confidence service account you created and add the role BigQuery Data Owner.Step 2b: Configure a Flag Applied Connector
For Confidence to be able to store assignment data in BigQuery, you need to set up a connector between Confidence and BigQuery.Navigate to Flag applied connections
Enter connection details
confidence_flag_applied) you created in step 2a and the email address of the confidence service account you created in step 1a.Enter the table name
flag_applied) to write assignment data to. Confidence creates the table with the right schema for you.Step 2c: Configure an Assignment Table
For Confidence to use the stored assignment table, you need to set up an assignment table that reads from the BigQuery table. You first need to create an entity, which represents the thing you’re experimenting on, like your users. To do so, follow these steps:Navigate to the BigQuery connection
Enter assignment table name
flag_applied. This name should typically match the name you used in step 2b. Confidence can then read assignments from the destination table of your flag assignments.Create or select an entity
User and specify the data type of the identifier that identifies the entity. For example, if you have a UUID that identifies your users, your primary key type is a String.Step 3: Grant View Access to Metrics Data Sources
Confidence uses fact tables to describe the data that you create metrics from. To ensure that Confidence can access data from the data sources you use for fact tables, you need to grant the role BigQuery Data Viewer to the service account namedconfidence that you have created.
Grant this role for the datasets and tables you want Confidence to have access to.
Go to Google Cloud Platform Console
Select the dataset or table
Open permissions dialog
Grant permissions
confidence service account you created and assign the role BigQuery Data Viewer.
