feat(worker): add optional metrics_headers param to AgentexWorker and get_temporal_client - #501
Open
alvinkam2001 wants to merge 2 commits into
Open
feat(worker): add optional metrics_headers param to AgentexWorker and get_temporal_client#501alvinkam2001 wants to merge 2 commits into
alvinkam2001 wants to merge 2 commits into
Conversation
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.
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.
AgentexWorkeralready exposed ametrics_urlparameter 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 ingestApplication-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'sOpenTelemetryConfigrequires auth headers to be passed explicitly and there was no way to thread them throughAgentexWorker.Change
Adds an optional
metrics_headersparameter to bothAgentexWorkerandget_temporal_client, passed through toOpenTelemetryConfig.headersin the Temporal runtime.Behavior
metrics_headers=None(default): identical to current behavior, no impact on existing deploymentsmetrics_headers={...}: headers are forwarded to the Rust bridge's OTel exporter alongsidemetrics_urlUsage
Once wired up on the caller side, metrics like
temporal_workflow_task_execution_latency,temporal_activity_schedule_to_start_latency, andtemporal_worker_task_slots_availablewill 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.
metrics_headersto both public call signatures.OpenTelemetryConfig.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