bug: trace id shared between different runs triggered by cron in DEV env

Offen
#4,313 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

@dubeyharshit0605 arbeitet bereits daran.

Seit 22.7.2026.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
62/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Ruhig
Tech-Stack
grafana, typescript
Bereich
observability

Rechercherichtung

Start with the OpenTelemetry processor change linked in the issue, especially where externalTraceId is set once at app startup and applied to task spans. Check how trace context is selected when attempts run; done means concurrent cron tasks without a parent context each appear as separate root traces, rather than sharing one trace ID.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Provide environment information

System:
OS: macOS 26.2
CPU: (10) arm64 Apple M1 Max
Memory: 2.03 GB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 24.9.0 - /Users/awinn/.node_versions/bin/node
Yarn: 4.17.0 - /Users/awinn/projects/work/cal/node_modules/.bin/yarn
npm: 11.6.0 - /Users/awinn/.node_versions/bin/npm
Deno: 2.8.0 - /opt/homebrew/bin/deno

Describe the bug

I am in running on a development branch and have multiple tasks scheduled to run with cron schedules.

After enabling tracing in the environment I noticed traces in grafana that had two "Attempt 1" spans for different tasks.

I was able to inspect the otel processors at runtime during task execution and log the externalTraceId here: https://github.com/triggerdotdev/trigger.dev/pull/3768/changes#diff-ce510b575f0568e5e9854cedbca289205f363324a89085ae9b668c3cc334cd93R437 which is set once when the app starts up. That generated trace id was used to replace the existing trace IDs of the spans for both tasks.

I don't think it ever makes sense to replace the trace IDs of multiple spans with one global persistent value like this. If a parent trace context is not found it's better for each attempt to become the root span of it's own trace.

Reproduction repo

na

To reproduce
  1. create two distinct tasks the run at the same time via CRON.
  2. configure otel export to any compatible service
  3. start trigger.dev in development and observe the traces your provider shows for those tasks
Additional information

No response

Vorherrschende Sprache
TypeScript
Sterne
16.5k
Forks
1.5k
Ø Merge
1 T. 15 Std.
Gemergte PRs (30 T.)
17

Entwicklungsumgebung

Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus triggerdotdev/trigger.dev

Alle Issues in triggerdotdev/trigger.dev

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.