Event Logging
Configuration
Runtime configuration and environment variables for Event Logging
Local prerequisites
- Application Default Credentials with Spanner and Secret Manager access.
GCP_PROJECT_IDset when running outside Google Cloud.STATSIG_ENVIRONMENTset explicitly for local work so forwarded events do not default toproduction.
Environment variables
| Variable | Required | Default / source | Notes |
|---|---|---|---|
GCP_PROJECT_ID | Required outside GCP | Metadata server when available | Used for Spanner and Secret Manager lookups. |
SPANNER_INSTANCE_ID | No | nest | Spanner instance for NestEventLog. |
SPANNER_DATABASE_ID | No | nest | Spanner database for NestEventLog. |
CONNECT_READ_MAX_BYTES | No | Connect library default | Maximum accepted request size. |
STATSIG_ENVIRONMENT | No | production | Cloud Deploy sets this per environment; set it explicitly in local dev. |
STATSIG_SERVICE_NAME | No | events or K_SERVICE | Logical service name on the Statsig client. |
STATSIG_FORWARDING_USER_ID | No | service:events | Stable service user for forwarded Statsig events. |
STATSIG_SERVER_KEY_SECRET_ID | No | STATSIG_SERVER_KEY | Secret Manager secret id used to fetch the server key at startup. |
STATSIG_SERVER_KEY_SECRET_VERSION | No | latest | Secret version for the Statsig server key. |
DEBUG | No | false | Enables debug-oriented logging behavior. |
PORT | Cloud Run only | Cloud Run runtime | Used by the container command at runtime. |
K_SERVICE | Cloud Run only | Cloud Run runtime | Fallback service name for Statsig config if STATSIG_SERVICE_NAME is unset. |
Deployment-set values
The Cloud Run manifest pins or passes these values during deploy:
SPANNER_INSTANCE_ID=nestSPANNER_DATABASE_ID=nestSTATSIG_SERVICE_NAME=eventsSTATSIG_FORWARDING_USER_ID=service:eventsSTATSIG_ENVIRONMENTfrom the Cloud Deploy target parameters
See:
services/events/deploy/service.yamlinfra/envs/dev/cloud_deploy.tfinfra/envs/prod/cloud_deploy.tf
Secrets
Event Logging does not read a raw STATSIG_SERVER_KEY environment variable at
runtime. Instead, startup loads the key from Secret Manager using
STATSIG_SERVER_KEY_SECRET_ID and
STATSIG_SERVER_KEY_SECRET_VERSION.
Last updated on