diff --git a/.changeset/forward-worker-instance-name.md b/.changeset/forward-worker-instance-name.md new file mode 100644 index 00000000000..368645255e4 --- /dev/null +++ b/.changeset/forward-worker-instance-name.md @@ -0,0 +1,14 @@ +--- +"trigger.dev": patch +--- + +Forward `TRIGGER_WORKER_INSTANCE_NAME` into the managed run process env + +The Kubernetes workload manager already injects `TRIGGER_WORKER_INSTANCE_NAME` +(= `spec.nodeName`) into the run-controller container via the downward API, but +the managed run worker is forked with an explicit env allowlist +(`RunnerEnv.gatherProcessEnv()`) that dropped it. As a result the run process +could not attach the node as an OpenTelemetry `host.name` resource attribute, so +spans/logs exported to an off-node OTLP collector had no host (Datadog tags these +`issue_type:empty_hostname`). This forwards the value so `trigger.config.ts` +telemetry (or the worker itself) can surface the node/host. diff --git a/packages/cli-v3/src/entryPoints/managed/env.ts b/packages/cli-v3/src/entryPoints/managed/env.ts index 4da8361e863..18af293cf22 100644 --- a/packages/cli-v3/src/entryPoints/managed/env.ts +++ b/packages/cli-v3/src/entryPoints/managed/env.ts @@ -236,6 +236,11 @@ export class RunnerEnv { OTEL_EXPORTER_OTLP_ENDPOINT: this.OTEL_EXPORTER_OTLP_ENDPOINT, TRIGGER_OTEL_EXPORTER_OTLP_ENDPOINT: this.OTEL_EXPORTER_OTLP_ENDPOINT, UV_USE_IO_URING: this.UV_USE_IO_URING, + // Forward the worker instance name (spec.nodeName on k8s) into the run + // process so it can be attached as an OTEL host/node resource attribute. + // Without this, run spans/logs exported to an off-node OTLP collector + // have no host and Datadog tags them issue_type:empty_hostname. + TRIGGER_WORKER_INSTANCE_NAME: this.TRIGGER_WORKER_INSTANCE_NAME, }; // Filter out undefined values