Skip to content

Add GCP Cloud Run OpenTelemetry sample#329

Draft
eamsden wants to merge 1 commit into
mainfrom
eamsden/gcp-cloud-run-otel-sample
Draft

Add GCP Cloud Run OpenTelemetry sample#329
eamsden wants to merge 1 commit into
mainfrom
eamsden/gcp-cloud-run-otel-sample

Conversation

@eamsden

@eamsden eamsden commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a project-neutral Google Cloud Run worker-pool sample using temporalio.contrib.gcp.OpenTelemetryPlugin
  • run the Google-Built OpenTelemetry Collector as a startup-probed sidecar, with Secret Manager-backed Temporal credentials and collector configuration
  • use the plugin's coordinated 60-second metric default without an override, export cumulative metrics without a collector batch processor, and retain a dedicated five-second trace batch
  • demonstrate graceful worker shutdown and bounded Python trace flushing
  • pin SDK PR Add GCP OpenTelemetry plugin sdk-python#1658 at 6eeb6f1f38888fce5eab7fdf58c439bcd8d2e163 until the plugin is released

Validation

  • poe format
  • poe lint (Ruff and mypy; 546 source files)
  • mise exec uv@latest -- uv run pytest tests/gcp_open_telemetry -q (6 passed)
  • full repository test suite (67 passed, 4 skipped)
  • mise exec uv@latest -- uv lock --check
  • mise exec uv@latest -- uv lock --project gcp_open_telemetry --check
  • git diff --check
  • isolated Cloud Run worker-pool and Temporal Cloud E2E verified the unoverridden 60-second default, workflow and activity execution, metrics and trace export, GCP resource attribution, and clean trace/collector shutdown without duplicate-series or exporter errors; the pool was returned to zero instances

Python currently exposes no public Temporal Core metric force-flush API. The sample therefore documents periodic metric export and a clean shutdown window without claiming a separate shutdown metric point. The unbatched metrics pipeline remains safe if the runtime emits a shutdown-time export.

This remains a draft until the SDK plugin is released and the temporary source pins can be replaced with the released dependency version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant