Vercel Daemons 可將背景工作追蹤資料送到 Vercel Tracing
Daemons can now send traces to Vercel Tracing
背景工作程式出了狀況時,開發者需要檢視它做了哪些事,才能和專案其他追蹤資料一起排查。
- Vercel Daemons 現在可把 OpenTelemetry 追蹤資料送到 Vercel Tracing。
- Node.js Daemons 使用 @vercel/otel 2.3.0 以上版本和預設設定,就能自動送出追蹤資料。之後可透過 Vercel CLI 按服務名稱搜尋,並以 JSON 取得結果,讓開發者和 AI 助理檢視背景工作的執行情況。
AI 伴隨問答
針對這篇報導有疑問?可直接點選快捷問題或向 AI 追問背景脈絡與技術細節:
Vercel Daemons can now send OpenTelemetry traces to Vercel Tracing, allowing you and your agents to inspect background worker operations alongside the rest of your project's traces.
Vercel provides each daemon with a Unix socket for receiving OTLP/HTTP traces and sets the socket's path in VERCEL_OTEL_SOCKET_PATH.
Upgrading @vercel/otel to version 2.3.0 or later enables automatic trace export for Node.js daemons using the default configuration. The SDK detects this socket and sends the spans your worker records to Vercel.
worker.ts
import { registerOTel } from '@vercel/otel';
registerOTel({ serviceName: 'my-daemon' });
Initialize OpenTelemetry before the worker starts.
These spans are available through the Vercel CLI, which can search by service name within a project and return JSON for your agents.
terminal.sh
vercel traces search --project my-project --service my-daemon --json
Search daemon spans from the last hour as JSON.
Learn more in the daemon tracing documentation.