Skip to content

fix(cloudflare): read DNS analytics from the GraphQL Analytics API - #9187

Draft
volodymyrshk wants to merge 1 commit into
simstudioai:mainfrom
volodymyrshk:fix/cloudflare-dns-analytics-graphql
Draft

volodymyrshk wants to merge 1 commit into
simstudioai:mainfrom
volodymyrshk:fix/cloudflare-dns-analytics-graphql

Conversation

@volodymyrshk

Copy link
Copy Markdown

Closes #9186.

Cloudflare removes GET /zones/{zone_id}/dns_analytics/report on December 1, 2026 (https://developers.cloudflare.com/fundamentals/api/reference/deprecations/), so cloudflare_dns_analytics would fail for every workflow using it.

What this does:

  • The tool POSTs to the GraphQL Analytics API (dnsAnalyticsAdaptiveGroups) and maps the grouped rows back onto the existing report output (totals, data rows with parallel dimensions/metrics arrays, rows, query echo), so saved workflows keep reading the same fields.
  • Existing params keep working where GraphQL has an equivalent: dimensions queryName/queryType/responseCode; metric queryCount; filters field==value joined by ;; sort like -queryCount; since/until as ISO dates or relative (-7d), now filtered by day; limit (default 100, max 10000).
  • Metrics and dimensions the GraphQL dataset doesn't have (cache counts, response times, coloName, ...) are rejected with a clear error instead of being reported as zero, matching the tool's "absent means not measured" rule.
  • Block AI-assist hints now list only the supported metrics, dimensions and filters.
  • Query values are inlined as validated, JSON-escaped GraphQL literals; only $zoneTag is a variable.

Tests: replaced the REST-envelope DNS analytics tests with GraphQL ones (request URL/method/body, validation errors, mapping, GraphQL error). I ran the tool logic under Node with stubbed imports (passes); I couldn't run vitest, tsc or Biome locally, so CI is the real check.

Not verified against a live zone: field names come from Cloudflare's docs examples. Happy to adjust if the schema explorer says otherwise, or if you'd prefer a new tool and version over changing this one.

Cloudflare removes GET /zones/{zone_id}/dns_analytics/report on 2026-12-01. The cloudflare_dns_analytics tool now queries dnsAnalyticsAdaptiveGroups and maps it back onto the report output shape, so existing workflows keep their outputs. Metrics and dimensions the GraphQL dataset lacks are rejected with a clear error instead of returning zeros; block hints updated to the supported set. Refs simstudioai#9186.
@vercel

vercel Bot commented Oct 18, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Oct 18, 2026 1:52am UTC

Request Review

This branch was previously deployed

1 inactive deployment
Preview — 1b68b8e5 Deployed Oct 18, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cloudflare_dns_analytics tool calls an endpoint Cloudflare removes on Dec 1

1 participant