Title: fix(otel): exported logs and spans will now have matching trace IDs by ericallam · Pull Request #2724 · triggerdotdev/trigger.dev · GitHub
Open Graph Title: fix(otel): exported logs and spans will now have matching trace IDs by ericallam · Pull Request #2724 · triggerdotdev/trigger.dev
X Title: fix(otel): exported logs and spans will now have matching trace IDs by ericallam · Pull Request #2724 · triggerdotdev/trigger.dev
Description: When using custom OTLP exporters via telemetry.exporters and This occurred when tasks were triggered without a parent trace context (e.g., via API or dashboard). In this scenario: - Spans were correctly rewritten to use the generated externalTraceId - Logs kept their original internal trace ID due to a bug in the early return logic Root Cause In ExternalLogRecordExporterWrapper.transformLogRecord(), the early return condition incorrectly included !this.externalTraceContext: if (!logRecord.spanContext || !this.externalTraceId || !this.externalTraceContext) { return logRecord; // Bug: Returns early when externalTraceContext is undefined } // This fallback logic was never reached: const externalTraceId = this.externalTraceContext ? this.externalTraceContext.traceId : this.externalTraceId; Fix Reordered logic in transformLogRecord(): Move the externalTraceId calculation before the early return, and check the culated value instead of this.externalTraceContext: const externalTraceId = this.externalTraceContext ? this.externalTraceContext.traceId : this.externalTraceId; if (!logRecord.spanContext || !externalTraceId) { return logRecord; } Clarified _isExternallySampled logic: Updated both ExternalSpanExporterWrapper and ExternalLogRecordExporterWrapper explicitly handle the case where there's no external trace context a generated externalTraceId exists: this._isExternallySampled = externalTraceContext ? isTraceFlagSampled(externalTraceContext.traceFlags) : !!externalTraceId; Impact Logs and spans from the same task run will now have matching trace IDs when exported to external observability tools, enabling proper trace correlation regardless of whether the task was triggered with or without a parent trace context. telemetry.logExporters in trigger.config.ts, logs and spans were exported with different trace IDs, breaking trace correlation in external observability tools like Datadog.
Open Graph Description: When using custom OTLP exporters via telemetry.exporters and This occurred when tasks were triggered without a parent trace context (e.g., via API or dashboard). In this scenario: - Spans were corr...
X Description: When using custom OTLP exporters via telemetry.exporters and This occurred when tasks were triggered without a parent trace context (e.g., via API or dashboard). In this scenario: - Spans were corr...
Opengraph URL: https://github.com/triggerdotdev/trigger.dev/pull/2724
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:bedc6f83-3760-09c7-50ca-28713e565f65 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 9DA4:BD35:2D3340:42CA5E:6AFAE18A |
| html-safe-nonce | 020ec17bc429480245cfbaf77906cbebaf1501a5220a23b6becc5908bf315310 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5REE0OkJEMzU6MkQzMzQwOjQyQ0E1RTo2QUZBRTE4QSIsInZpc2l0b3JfaWQiOiI2Nzk3NTg2NzU0ODIwNTYzMzM4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 7b506cdcbc307452355b08bd3baf93f164015943cffff32cdeedcdce6f1acc25 |
| hovercard-subject-tag | pull_request:3063702715 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/triggerdotdev/trigger.dev/pull/2724/files |
| twitter:image | https://avatars.githubusercontent.com/u/534?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/534?s=400&v=4 |
| og:image:alt | When using custom OTLP exporters via telemetry.exporters and This occurred when tasks were triggered without a parent trace context (e.g., via API or dashboard). In this scenario: - Spans were corr... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9d9bd51a568909a83d1abb9d6f74d68f0c87ca85fe3a56d3f5d70d8b89add9f2 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/triggerdotdev/trigger.dev git https://github.com/triggerdotdev/trigger.dev.git |
| octolytics-dimension-user_id | 95297378 |
| octolytics-dimension-user_login | triggerdotdev |
| octolytics-dimension-repository_id | 572570113 |
| octolytics-dimension-repository_nwo | triggerdotdev/trigger.dev |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 572570113 |
| octolytics-dimension-repository_network_root_nwo | triggerdotdev/trigger.dev |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 4a7ae932999cc6d511008dbf980ff9efad2a31f7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width