Search trace spans from the Vercel CLI
Vercel CLI now allows developers to search project trace spans directly from the terminal, enabling faster debugging without using the dashboard.
Vercel has introduced a new command, vercel traces search, which lets users query trace spans from the terminal instead of the dashboard. Each span represents a single step in a request, making it easier to diagnose errors, latency issues, or security-related behavior. By default, the command returns up to 100 spans from the last hour, sorted by recency, eliminating the need to locate a specific request or trace ID beforehand.
The search supports multiple filters, including environment, service, span name, status, deployment ID, request ID, trace ID, or span ID. Users can also narrow results by time using the --since and --until flags. For more advanced filtering, the --query option supports a subset of Kibana Query Language (KQL), allowing searches based on fields like duration or span attributes.
Developers can output results in JSON format using the --json flag, which provides structured data suitable for scripting and agent-based analysis. This feature streamlines integration with automated tools and simplifies data processing for further investigation.
To use the new search functionality, users must update to the latest Vercel CLI by running vercel upgrade. The command’s full capabilities can be reviewed with vercel traces search --help, and additional details are available in the official documentation.