Nest Engineering Docs
Event Logging

Configuration

Runtime configuration and environment variables for Event Logging

Local prerequisites

  • Application Default Credentials with Spanner and Secret Manager access.
  • GCP_PROJECT_ID set when running outside Google Cloud.
  • STATSIG_ENVIRONMENT set explicitly for local work so forwarded events do not default to production.

Environment variables

VariableRequiredDefault / sourceNotes
GCP_PROJECT_IDRequired outside GCPMetadata server when availableUsed for Spanner and Secret Manager lookups.
SPANNER_INSTANCE_IDNonestSpanner instance for NestEventLog.
SPANNER_DATABASE_IDNonestSpanner database for NestEventLog.
CONNECT_READ_MAX_BYTESNoConnect library defaultMaximum accepted request size.
STATSIG_ENVIRONMENTNoproductionCloud Deploy sets this per environment; set it explicitly in local dev.
STATSIG_SERVICE_NAMENoevents or K_SERVICELogical service name on the Statsig client.
STATSIG_FORWARDING_USER_IDNoservice:eventsStable service user for forwarded Statsig events.
STATSIG_SERVER_KEY_SECRET_IDNoSTATSIG_SERVER_KEYSecret Manager secret id used to fetch the server key at startup.
STATSIG_SERVER_KEY_SECRET_VERSIONNolatestSecret version for the Statsig server key.
DEBUGNofalseEnables debug-oriented logging behavior.
PORTCloud Run onlyCloud Run runtimeUsed by the container command at runtime.
K_SERVICECloud Run onlyCloud Run runtimeFallback 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=nest
  • SPANNER_DATABASE_ID=nest
  • STATSIG_SERVICE_NAME=events
  • STATSIG_FORWARDING_USER_ID=service:events
  • STATSIG_ENVIRONMENT from the Cloud Deploy target parameters

See:

  • services/events/deploy/service.yaml
  • infra/envs/dev/cloud_deploy.tf
  • infra/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

On this page