Skip to content

Add GCP Cloud Run OpenTelemetry support - #3022

Draft
seanbollin wants to merge 1 commit into
mainfrom
gcp-cloud-run-otel
Draft

Add GCP Cloud Run OpenTelemetry support#3022
seanbollin wants to merge 1 commit into
mainfrom
gcp-cloud-run-otel

Conversation

@seanbollin

@seanbollin seanbollin commented Aug 19, 2026

Copy link
Copy Markdown

Summary

Adds GCP Cloud Run serverless-worker OpenTelemetry support, mirroring the approved .NET SDK common-core refactor (temporalio/sdk-dotnet#844) and building on the earlier draft #2955.

  • New module temporal-gcp-cloud-run (io.temporal.gcp.cloudrun.CloudRunOpenTelemetryPlugin) — exports Core metrics and tracing spans over OTLP/gRPC to a local OpenTelemetry Collector sidecar. Cloud Run specifics only (service name from CLOUD_RUN_WORKER_POOL/K_SERVICE, 60s report interval, deferred shutdown flush). Depends only on temporal-opentelemetryno Google client libraries; the collector does GCP resource detection, auth, and export.
  • Additive core changes in temporal-opentelemetry: a shared OpenTelemetryWorker.resolveServiceName(env, default, fallbackEnvVars...) and OpenTelemetryPlugin.Builder.getMetricsReportInterval().
  • Refactor the AWS Lambda OtelLambdaWorkerConfigurationHelper onto the shared resolver, with no public API or behavior change.

Credit

Builds directly on @eamsden's draft #2955. Ported from that PR:

  • The Cloud Run plugin (his GcpOpenTelemetryPlugin, renamed to CloudRunOpenTelemetryPlugin) as a thin SimplePlugin delegate, its 7 unit tests, and the README.
  • The additive OpenTelemetryPlugin.Builder.getMetricsReportInterval() getter and the settings.gradle / temporal-bom module wiring.
  • The env-var precedence + 60s default + deferred-shutdown-flush design.

New in this PR, on top of @eamsden's work: the shared OpenTelemetryWorker.resolveServiceName(...) extraction, the refactor of the AWS Lambda OtelLambdaWorkerConfigurationHelper onto it, and the explicit temporal-gcp-cloud-run module/package naming.

Non-breaking

Core changes are purely additive (new methods, no new dependencies). The AWS Lambda module's public constants/signatures/behavior are unchanged — its existing tests pass unmodified (the non-breakage gate: 46 tests). Non-Lambda / non-Cloud-Run users are unaffected. The generated temporal-gcp-cloud-run POM lists only temporal-opentelemetry as a dependency (no Google/AWS libs).

Verification

./gradlew spotlessApply :temporal-opentelemetry:test :temporal-aws-lambda:test :temporal-gcp-cloud-run:test :temporal-gcp-cloud-run:javadoc :temporal-gcp-cloud-run:generatePomFileForMavenJavaPublication :temporal-bom:generatePomFileForMavenJavaPublication — all pass (opentelemetry 20, aws-lambda 46, gcp 7). Note: build must run on JDK ≤ 23 (the repo pins Temurin 21 via mise.toml).

Related

Companion sample: temporalio/samples-java (Cloud Run worker). Cross-SDK effort with sdk-go, sdk-python, and .NET (temporalio/sdk-dotnet#844).

🤖 Generated with Claude Code

Adds a Cloud Run serverless-worker OpenTelemetry integration, mirroring the
approved .NET SDK common-core refactor (temporalio/sdk-dotnet#844) and building
on #2955.

- New module temporal-gcp-cloud-run (io.temporal.gcp.cloudrun): a
  CloudRunOpenTelemetryPlugin that exports Core metrics and tracing spans over
  OTLP/gRPC to a local OpenTelemetry Collector sidecar. Cloud Run specifics only
  (service name from CLOUD_RUN_WORKER_POOL/K_SERVICE, 60s report interval,
  deferred shutdown flush); depends only on temporal-opentelemetry, no Google
  client libraries.
- Extract a shared OpenTelemetryWorker.resolveServiceName(env, default,
  fallbackEnvVars...) into the provider-neutral core and add
  OpenTelemetryPlugin.Builder.getMetricsReportInterval() (both additive).
- Refactor the AWS Lambda OtelLambdaWorkerConfigurationHelper onto the shared
  resolver with no public API or behavior change (existing tests unmodified).

Co-authored-by: Edward Amsden <edward.amsden@temporal.io>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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