Documentation
a project

metrics

Configures a Prometheus metrics exposition endpoint so the gathered metrics can be exposed for scraping. Metrics must be turned on in your global options first.

Note that a /metrics endpoint is also attached to the admin API, which is not configurable, and is not available when the admin API is disabled.

This endpoint will return metrics in the Prometheus exposition format or, if negotiated, in the OpenMetrics exposition format (application/openmetrics-text).

See also Monitoring Caddy with Prometheus metrics.

Syntax

metrics [<matcher>] {
	disable_openmetrics
}
  • disable_openmetrics disables OpenMetrics negotiation. Usually not necessary except when needing to work around parsing bugs.

Examples

Expose metrics at the default /metrics path:

metrics /metrics

Expose metrics at another path:

metrics /foo/bar/baz

Serve metrics at a separate subdomain:

metrics.example.com {
	metrics
}

Disable OpenMetrics negotiation:

metrics /metrics {
	disable_openmetrics
}