Temporal SDK internal metrics (workflow task latency, activity schedule-to-start latency, worker slot availability, sticky cache hit/miss rate, etc.) are emitted by the Temporal Rust bridge via OTLP. AgentexWorker already exposed a metrics_url parameter to configure the export endpoint, but had no way to pass authentication headers — making it impossible to export to backends that require them.
Rocket context
Rocket's SGP deployment uses Dynatrace (not the standard LGTM stack) for metrics and performance monitoring. Dynatrace OneAgent is injected into every pod via CSI driver and automatically provides two env vars:
OTEL_EXPORTER_OTLP_ENDPOINT — the DT SaaS OTLP endpoint (https://<env>.live.dynatrace.com/api/v2/otlp)
DT_API_TOKEN — an API token scoped for OTLP ingest
Application-level OTel (traces + custom metrics) already flows to Dynatrace via init_opentelemetry() which reads these env vars. Temporal SDK internal metrics were the only signal not reaching Dynatrace — specifically because the Rust bridge's OpenTelemetryConfig requires auth headers to be passed explicitly and there was no way to thread them through AgentexWorker.
Change
Adds an optional metrics_headers parameter to both AgentexWorker and get_temporal_client, passed through to OpenTelemetryConfig.headers in the Temporal runtime.
Behavior
metrics_headers=None (default): identical to current behavior, no impact on existing deployments
metrics_headers={...}: headers are forwarded to the Rust bridge's OTel exporter alongside metrics_url
Once wired up on the caller side, metrics like temporal_workflow_task_execution_latency, temporal_activity_schedule_to_start_latency, and temporal_worker_task_slots_available will appear in Dynatrace alongside the existing application traces.
Greptile Summary
The PR adds optional authentication headers for Temporal SDK OTLP metric exports while preserving existing positional API compatibility.
Appends metrics_headers to both public call signatures.
Forwards worker-supplied headers into OpenTelemetryConfig.
Leaves existing behavior unchanged when no headers are supplied.
Confidence Score: 5/5
The PR appears safe to merge.
The previously reported positional compatibility issue is fixed by appending the new parameter after all existing parameters, and no blocking failure remains.
Important Files Changed
Filename
Overview
src/agentex/lib/core/temporal/workers/worker.py
Adds optional OTLP metrics headers at the end of both signatures and forwards them through the worker startup path without retaining the previously reported positional-binding break.
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[AgentexWorker metrics_headers] --> B[get_temporal_client]
B --> C[OpenTelemetryConfig headers]
C --> D[Temporal OTLP metrics exporter]
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
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.
Problem
Temporal SDK internal metrics (workflow task latency, activity schedule-to-start latency, worker slot availability, sticky cache hit/miss rate, etc.) are emitted by the Temporal Rust bridge via OTLP. AgentexWorker already exposed a metrics_url parameter to configure the export endpoint, but had no way to pass authentication headers — making it impossible to export to backends that require them.
Rocket context
Rocket's SGP deployment uses Dynatrace (not the standard LGTM stack) for metrics and performance monitoring. Dynatrace OneAgent is injected into every pod via CSI driver and automatically provides two env vars:
Application-level OTel (traces + custom metrics) already flows to Dynatrace via init_opentelemetry() which reads these env vars. Temporal SDK internal metrics were the only signal not reaching Dynatrace — specifically because the Rust bridge's OpenTelemetryConfig requires auth headers to be passed explicitly and there was no way to thread them through AgentexWorker.
Change
Adds an optional metrics_headers parameter to both AgentexWorker and get_temporal_client, passed through to OpenTelemetryConfig.headers in the Temporal runtime.
Behavior
Usage
Once wired up on the caller side, metrics like temporal_workflow_task_execution_latency, temporal_activity_schedule_to_start_latency, and temporal_worker_task_slots_available will appear in Dynatrace alongside the existing application traces.
Greptile Summary
The PR adds optional authentication headers for Temporal SDK OTLP metric exports while preserving existing positional API compatibility.
Confidence Score: 5/5
The PR appears safe to merge.
The previously reported positional compatibility issue is fixed by appending the new parameter after all existing parameters, and no blocking failure remains.
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart LR A[AgentexWorker metrics_headers] --> B[get_temporal_client] B --> C[OpenTelemetryConfig headers] C --> D[Temporal OTLP metrics exporter]Reviews (2): Last reviewed commit: "fix param ordering" | Re-trigger Greptile