Event Logging
Local development
Run, modify, and validate Event Logging locally
Prerequisites
uvand Python 3.13buffor protobuf edits- Application Default Credentials with access to:
- Cloud Spanner
- Secret Manager secret
STATSIG_SERVER_KEY(or the configured override)
Minimum local environment
export GCP_PROJECT_ID="nest-dev-473721"
export STATSIG_ENVIRONMENT="development"
# If you use file-based ADC:
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/service-account.json"If you do not use a service-account file locally, authenticate with:
gcloud auth application-default loginInstall and regenerate
Run these commands from the repo root:
# First-time workspace setup
uv sync --all-packages
# Targeted package sync
uv sync --package events
# Only when the proto changed
buf generateRun the service
uv run --package events granian --interface asgi services.events.main:app --host 0.0.0.0 --port 8080 --workers 1Startup will fail fast until all of these succeed:
- GCP project id resolution
- Spanner pool warmup
- Secret Manager lookup for the Statsig server key
- Statsig client initialization
Tests
uv run --package events pytest -q services/events/testsWhen you change the contract
- Edit
proto/events/v1/events.proto. - Run
buf generate. - Update
services/events/tests/. - Update the repo docs and this docs section so the behavioral contract stays explicit.
Last updated on