feat(otel): consolidate all metrics on OpenTelemetry#57
Merged
Conversation
Remove the duplicate Prometheus MetricsManager in grpc/ package and consolidate all metrics on the existing OpenTelemetry instrumentation layer. The OTel layer in otel_instrumentation.go already covered all the same metrics with proper semantic conventions. - Delete grpc/metrics.go (MetricsManager, Prometheus registry, promhttp) - Delete grpc/metrics_test.go - Remove enableMetrics, metricsPath, enableLogging config fields - Remove WithMetrics, WithoutMetrics, WithMetricsPath, WithLogging, WithoutLogging options - Remove legacy fallback branch in setupEchoServer - Remove metricsManager, stopUptime, trackUptime from Server - Add registerServerMetrics() with OTel observable gauges for server.uptime and server.start_time - Update README.md to reflect OTel-only metrics Net: -1016 lines added, +76 lines. prometheus/client_golang now only imported by temporal/client.go. BREAKING CHANGE: MetricsManager, GetMetricsManager(), WithMetrics(), WithoutMetrics(), WithMetricsPath(), WithLogging(), WithoutLogging() removed. Use WithOTelConfig() for metrics instrumentation.
Replace the tally/Prometheus metrics system in temporal/ with native
OTel metrics via temporalotel.MetricsHandler. This fixes the Go 1.22+
panic caused by duplicate http.Handle("/metrics") registration when
multiple Temporal clients are created in the same process.
- Rewrite NewClient: return (client.Client, error) instead of
(client.Client, io.Closer, error)
- Remove NewClientWithMetrics — no longer needed
- Remove newPrometheusScope and all tally/prometheus imports
- Remove MetricsListenAddress from Config
- Add OTel metrics handler when OTelConfig.MeterProvider is set
- Remove metricsCloser from WorkerManager, WorkflowManager,
ScheduleManager
- Update all tests and examples
Dependencies removed: uber-go/tally/v4, go.temporal.io/sdk/contrib/tally
Dependencies demoted: prometheus/client_golang (direct → indirect)
BREAKING CHANGE: NewClient signature changed from
(client.Client, io.Closer, error) to (client.Client, error).
NewClientWithMetrics and MetricsListenAddress removed.
- Remove WithMetrics() from grpc server example - Remove /metrics endpoint from status JSON in grpc example - Remove MetricsListenAddress from dashboard example README - Remove NewClientWithMetrics references from temporal example README - Update PROJECT_TEMPLATE.md grpc feature table and temporal API
…nature Remove closer pattern from schedule_integration_test.go — missed in the initial refactor because integration tests are excluded from unit test builds.
jasoet
added a commit
that referenced
this pull request
Apr 8, 2026
Remove legacy Prometheus metrics from grpc/ and temporal/ packages,
consolidating all metrics on OpenTelemetry.
grpc/: Delete MetricsManager, remove enableMetrics/metricsPath/enableLogging
config options, add OTel observable gauges for server uptime/start_time.
temporal/: Replace tally/Prometheus with temporalotel.MetricsHandler. Simplify
NewClient from (client.Client, io.Closer, error) to (client.Client, error).
Fixes Go 1.22+ panic from duplicate http.Handle("/metrics").
Dependencies removed: uber-go/tally/v4, go.temporal.io/sdk/contrib/tally.
Dependencies demoted: prometheus/client_golang (direct to indirect).
Breaking changes in grpc: WithMetrics/WithoutMetrics/WithMetricsPath/WithLogging/
WithoutLogging/GetMetricsManager removed. Use WithOTelConfig() for metrics.
Breaking changes in temporal: NewClientWithMetrics and MetricsListenAddress removed.
NewClient signature changed to (client.Client, error).
jasoet
added a commit
that referenced
this pull request
Apr 8, 2026
Remove legacy Prometheus metrics from grpc/ and temporal/ packages,
consolidating all metrics on OpenTelemetry.
grpc/: Delete MetricsManager, remove enableMetrics/metricsPath/enableLogging
config options, add OTel observable gauges for server uptime/start_time.
temporal/: Replace tally/Prometheus with temporalotel.MetricsHandler. Simplify
NewClient from (client.Client, io.Closer, error) to (client.Client, error).
Fixes Go 1.22+ panic from duplicate http.Handle("/metrics").
Dependencies removed: uber-go/tally/v4, go.temporal.io/sdk/contrib/tally.
Dependencies demoted: prometheus/client_golang (direct to indirect).
Breaking changes in grpc: WithMetrics/WithoutMetrics/WithMetricsPath/WithLogging/
WithoutLogging/GetMetricsManager removed. Use WithOTelConfig() for metrics.
Breaking changes in temporal: NewClientWithMetrics and MetricsListenAddress removed.
NewClient signature changed to (client.Client, error).
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
MetricsManagerand consolidate on the existing OTel instrumentation layer. Deletemetrics.go(379 lines), removeenableMetrics/metricsPath/enableLoggingconfig options, add OTel observable gauges for server uptime/start_timetemporalotel.MetricsHandler. Fixes Go 1.22+ panic from duplicatehttp.Handle("/metrics")when multiple Temporal clients exist in the same process. SimplifyNewClientsignature from(client.Client, io.Closer, error)to(client.Client, error)uber-go/tally/v4andgo.temporal.io/sdk/contrib/tallyremoved entirely;prometheus/client_golangdemoted from direct to indirectNet: -1,418 lines, +427 lines (mostly the design doc). All 6 instrumented packages now consistently use
otel.Config.MeterProvider.Test plan
task test— all unit tests pass (grpc 71.2% cov, temporal 2.9% cov)task lint— 0 issuesgo build ./...— entire project compilesgo build -tags integration ./temporal/...— integration tests compile🤖 Generated with Claude Code