Skip to content

feat: add ip_version, stale, and uncached metrics to cfetchdns#41

Open
shreekarshetty wants to merge 8 commits into
developfrom
shreekar/dns-observability-pr-a
Open

feat: add ip_version, stale, and uncached metrics to cfetchdns#41
shreekarshetty wants to merge 8 commits into
developfrom
shreekar/dns-observability-pr-a

Conversation

@shreekarshetty

@shreekarshetty shreekarshetty commented Jun 25, 2026

Copy link
Copy Markdown

Adds three new DNS metrics via dnsAnalyticsAdaptiveGroups:

  • cloudflare_zone_dns_queries_total gains ip_version label (v4/v6)
  • cloudflare_zone_dns_stale_total{zone} — stale response counter (INC-482 class signal)
  • cloudflare_zone_dns_uncached_total{zone} — uncached response counter

Moves all metric name strings into a shared metricnames package (single source of truth across cfetch, cfetchdns and prometheus).

Also adds CODEOWNERS and integration test docs to README.

NET-363

Extends dnsAnalyticsAdaptiveGroups query with ipVersion dimension and
sum { countStale countNotCachedAndNotStale } fields.

- cloudflare_zone_dns_queries_total gains ip_version label (~2x series to ~600)
- cloudflare_zone_dns_stale_total{zone} — zone-level counter, spikes when CF
  serves stale records due to NS reachability issues (INC-482 class)
- cloudflare_zone_dns_uncached_total{zone} — zone-level counter, baseline ~98%
  of queries; useful for cache hit rate tracking

Stale and uncached are aggregated per (zone, bucket) in flattenDNSGroups so
each emits one observation per minute-bucket regardless of (responseCode,
queryType, ipVersion) fan-out.

NET-363
@shreekarshetty shreekarshetty force-pushed the shreekar/dns-observability-pr-a branch from bd7aa91 to 8f4b64e Compare June 26, 2026 10:40
Comment thread cfetchdns/cfetchdns.go Outdated
Comment thread prometheus.go Outdated
…c name strings

Moves all metric name string literals out of cfetch, cfetchdns and prometheus into
a shared metricnames package. prometheus.go MetricName constants now reference the
package for the 18 metrics that cfetch also emits via converge, and for the 3 DNS
metrics that exist in both cfetchdns and converge.go. Eliminates the duplication
Marcus flagged in PR review.
@shreekarshetty shreekarshetty enabled auto-merge (squash) June 26, 2026 16:11

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't use the constants here, because this means introducing a breaking change in metric names wouldn't make the integration test fail. Putting the raw string into tests is a best practice imho

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.

2 participants