tree: a7e43688ff26094313ddd0b5d805e1ff152fc72c [path history] [tgz]
  1. cloudbuild.yaml
  2. config.go
  3. Dockerfile
  4. main.go
  5. README.md
godev/cmd/worker/README.md

worker

Endpoints

/merge/?date=<YYYY-MM-DD>

The merge endpoint reads the set of reports from the upload bucket prefixed with the value of the data param and encodes each report as newline separated JSON in a merged report. It returns the number of reports merged and the location of the merged report.

Local Development

For local development, simply build and run. It serves on localhost:8082.

go run ./cmd/worker

By default, the server will use the filesystem for storage object I/O. Run the cloud storage emulator and use the -gcs flag to use the Cloud Storage API.

./devtools/localstorage.sh
go run ./cmd/worker --gcs

Environment Variables

NameDefaultDescription
GO_TELEMETRY_PROJECT_IDgo-telemetryGCP project ID
GO_TELEMETRY_STORAGE_EMULATOR_HOSTlocalhost:8081Host for the Cloud Storage emulator
GO_TELEMETRY_LOCAL_STORAGE.localstorageDirectory for storage emulator I/O or file system storage
GO_TELEMETRY_UPLOAD_CONFIG../config/config.jsonLocation of the upload config used for report validation
GO_TELEMETRY_MAX_REQUEST_BYTES102400Maximum request body size the server allows
GO_TELEMETRY_ENVlocalDeployment environment (e.g. prod, dev, local, ... )

Testing

The worker servie has a suite of regression tests that can be run with:

go test golang.org/x/telemetry/...

Deploying

Each time a CL is reviewed and submitted, the site is automatically deployed to Cloud Run. If it passes its serving-readiness checks, it will be automatically promoted to handle traffic.

If the automatic deployment is not working, or to check on the status of a pending deployment, see the “worker” trigger in the Cloud Build history.

Test Instance

To deploy a test instance of this service, push to a branch and manually trigger the deploy job from the Cloud Build console with the desired values for branch and service name.