CoreDNS Metrics API

Prometheus-compatible metrics endpoints exposing DNS query statistics, cache performance, latency histograms, and build information.

OpenAPI Specification

coredns-metrics-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: CoreDNS Health Metrics API
  description: The CoreDNS health plugin exposes an HTTP health check endpoint at /health on port 8080 by default. It reports the overall health of the CoreDNS process and is used by Kubernetes liveness and readiness probes to determine if the DNS server is operational. When lameduck mode is enabled, the health endpoint returns HTTP 503 for a configurable duration before shutdown to allow graceful traffic draining.
  version: 2.x
  contact:
    name: CoreDNS Community
    url: https://coredns.io/community/
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0
servers:
- url: http://localhost:8080
  description: CoreDNS Health HTTP server (default port, configurable)
tags:
- name: Metrics
  description: Prometheus-compatible metrics endpoints exposing DNS query statistics, cache performance, latency histograms, and build information.
paths:
  /metrics:
    get:
      operationId: getMetrics
      summary: CoreDNS Get Prometheus metrics
      description: Returns all CoreDNS metrics in Prometheus text exposition format (version 0.0.4). The response includes counters, gauges, histograms, and summaries covering DNS request rates by server and zone, response code distributions, DNS query type breakdowns, cache hit rates, panics, and plugin-specific metrics such as forward latency and health check state. Requires the prometheus plugin to be configured in the Corefile.
      tags:
      - Metrics
      responses:
        '200':
          description: Prometheus text format metrics.
          content:
            text/plain:
              schema:
                type: string
                description: Prometheus exposition format text, one metric per line with HELP and TYPE comments followed by sample lines. Key metrics include coredns_dns_requests_total, coredns_dns_responses_total, coredns_dns_request_duration_seconds, coredns_cache_hits_total, coredns_cache_misses_total, coredns_forward_requests_total, and coredns_build_info.
              example: '# HELP coredns_build_info A metric with a constant ''1'' value labeled by version, revision, and goversion from which CoreDNS was built.

                # TYPE coredns_build_info gauge

                coredns_build_info{goversion="go1.21.0",revision="abcdef",version="1.11.1"} 1

                # HELP coredns_dns_requests_total Counter of DNS requests made per zone, protocol and family.

                # TYPE coredns_dns_requests_total counter

                coredns_dns_requests_total{family="1",proto="udp",server="dns://:53",type="A",zone="."} 42

                # HELP coredns_dns_request_duration_seconds Histogram of the time (in seconds) each request took per zone.

                # TYPE coredns_dns_request_duration_seconds histogram

                coredns_dns_request_duration_seconds_bucket{le="0.00025",server="dns://:53",type="A",zone="."} 10

                '
externalDocs:
  description: CoreDNS Health Plugin Documentation
  url: https://coredns.io/plugins/health/