feat(observability): export Trigger.dev telemetry to Grafana Cloud OTLP#4583
Conversation
Wire OTLP HTTP exporters for traces, logs, and metrics from the Trigger.dev runtime to Grafana Cloud. Auth uses Basic with instance ID and API token. Gated behind GRAFANA_OTLP_ENDPOINT, GRAFANA_INSTANCE_ID, and GRAFANA_API_TOKEN — all three must be set together or all unset; partial config throws at startup.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Introduces new env vars ( Reviewed by Cursor Bugbot for commit 2892b4f. Bugbot is set up for automated code reviews on this repo. Configure here. |
Greptile SummaryThis PR wires three OTLP HTTP exporters (traces, logs, metrics) from the Trigger.dev runtime to Grafana Cloud, gated behind three env vars with a fail-fast guard that throws at startup if only a subset is configured.
Confidence Score: 4/5Safe to merge; the change is additive and fully inert when the three env vars are absent. The logic is straightforward config-glue with a solid partial-config guard. The only notable oddity is that the metrics exporter uses Protobuf encoding while traces and logs use JSON-over-HTTP, which introduces a minor inconsistency in the signal pipeline and an extra package dependency. apps/sim/trigger.config.ts and apps/sim/package.json — specifically the choice of exporter-metrics-otlp-proto vs the HTTP/JSON variant used for the other two exporters. Important Files Changed
Sequence DiagramsequenceDiagram
participant T as Trigger.dev Runtime
participant TC as trigger.config.ts
participant TE as OTLPTraceExporter (HTTP/JSON)
participant LE as OTLPLogExporter (HTTP/JSON)
participant ME as OTLPMetricExporter (HTTP/Proto)
participant G as Grafana Cloud OTLP Gateway
TC->>TC: "Read GRAFANA_* env vars"
alt Partially configured
TC-->>TC: throw Error (fail-fast)
else Fully configured
TC->>TC: Compute Basic auth header
TC->>TE: new OTLPTraceExporter
TC->>LE: new OTLPLogExporter
TC->>ME: new OTLPMetricExporter
end
T->>TE: Export spans
TE->>G: POST /v1/traces (application/json)
T->>LE: Export logs
LE->>G: POST /v1/logs (application/json)
T->>ME: Export metrics
ME->>G: POST /v1/metrics (application/x-protobuf)
Reviews (1): Last reviewed commit: "feat(observability): export Trigger.dev ..." | Re-trigger Greptile |
…tency with traces and logs
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 2892b4f. Configure here.

Summary
GRAFANA_OTLP_ENDPOINT,GRAFANA_INSTANCE_ID,GRAFANA_API_TOKEN; all three must be set together or all unset (partial config throws at startup, fail-fast)ctx.environment.typeresource attribute — no extra env var neededType of Change
Testing
bun run type-checkclean,bun run lintcleanctx.environment.typeChecklist