Add GCP Cloud Run OpenTelemetry support - #3022
Draft
seanbollin wants to merge 1 commit into
Draft
Conversation
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>
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
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 fromCLOUD_RUN_WORKER_POOL/K_SERVICE, 60s report interval, deferred shutdown flush). Depends only ontemporal-opentelemetry— no Google client libraries; the collector does GCP resource detection, auth, and export.temporal-opentelemetry: a sharedOpenTelemetryWorker.resolveServiceName(env, default, fallbackEnvVars...)andOpenTelemetryPlugin.Builder.getMetricsReportInterval().OtelLambdaWorkerConfigurationHelperonto the shared resolver, with no public API or behavior change.Credit
Builds directly on @eamsden's draft #2955. Ported from that PR:
GcpOpenTelemetryPlugin, renamed toCloudRunOpenTelemetryPlugin) as a thinSimplePlugindelegate, its 7 unit tests, and the README.OpenTelemetryPlugin.Builder.getMetricsReportInterval()getter and thesettings.gradle/temporal-bommodule wiring.New in this PR, on top of @eamsden's work: the shared
OpenTelemetryWorker.resolveServiceName(...)extraction, the refactor of the AWS LambdaOtelLambdaWorkerConfigurationHelperonto it, and the explicittemporal-gcp-cloud-runmodule/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-runPOM lists onlytemporal-opentelemetryas 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 viamise.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