#354

vercel-optimize: make metric queries work on current Vercel CLIs

Draftnicdillonwants to merge intofrom

Metric queries were written against CLI v53.4.0. Current CLIs (seen on 62.5.0 and 65.2.0) changed three things, so 16 of 32 queries failed with invalid_request, including the Observability Plus canary in collect-signals. Audits then reported Observability Plus as unusable (blocker=all_failed_other) on teams that have it.

  1. *.count metrics allow only count/unique; the skill used sum.
  2. Dimensions are camelCase (originHostname, cacheResult, botCategory, requestPath, sourceImageHostname, wafAction, ...).
  3. Metrics were renamed: speed_insights_metric.{lcp,inp,cls,ttfb_ms} -> speed_insights.{lcp_ms,inp_ms,cls,ttfb_ms}; speed_insights_metric.count was removed (sample volume now comes from the count of LCP samples); middleware_invocation.duration_ms -> request_duration_ms.

queryMetric now retries a rejected query in the current form (modernizeMetricQuery) and maps the response back to the legacy metric, aggregation, and dimension names (restoreLegacyMetricShape). Callers, gates, and the v53.4.0 fixtures are unchanged, and older CLIs keep the original query.

Verified against vercel metrics schema <metric> on CLI 65.2.0. With the first part of this fix, the canary passed and request-count queries returned 56 rows on a team with Observability Plus.

Repro: vercel metrics vercel.request.count --format json -a sum --since 14d --limit 1 -> {"error":{"code":"invalid_request"}} vercel metrics vercel.request.count --format json --since 14d --limit 1 -> summary [{ vercel_request_count_count: 257 }]

Activity

4
vercel[bot]15d ago

The latest updates on your projects. Learn more about Vercel for GitHub.

ProjectDeploymentActionsUpdated
agent-skills ReadyPreview, v0Oct 28, 2026 3:41pm UTC
vercel[bot]reviewed15d ago
byVerbelapproved changes12d ago

This pull request is a draft

Merging is unavailable until it is marked ready for review.