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

Ouverte
#4,313 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

@dubeyharshit0605 y travaille déjà.

Depuis le 22/7/2026.

Évaluation

Difficulté
3/5
Temps estimé
1-2 jours
Accessibilité débutants
62/100
Type d'issue
Bug
Clarté
Plutôt claire
Activité
Calme
Stack technique
grafana, typescript
Domaine
observability

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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

Langage dominant
TypeScript
Étoiles
16.5k
Forks
1.5k
Merge moyen
1 j 15 h
PR mergées (30 j)
17

Préparer son environnement

Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de triggerdotdev/trigger.dev

Toutes les issues de triggerdotdev/trigger.dev

Issues similaires

Plus d'issues TypeScript

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.