From 6740472fabe777eb8c9f36cfa5493b02162bd22d Mon Sep 17 00:00:00 2001 From: Camerin Figueroa Date: Sun, 2 Mar 2025 19:36:13 -0500 Subject: [PATCH] Add metrics per_host documentation to caddy website. (#455) * Update metrics.md * Added per_host documentation to options.md * Updated list of all options to include per_host metrics option * Update metrics code block to reflect change Per mohammed90 The metrics config is now moved outside of the servers option. * Fixed indentation issue options.md * Update src/docs/markdown/caddyfile/options.md Co-authored-by: Mohammed Al Sahaf * Update src/docs/markdown/metrics.md Co-authored-by: Mohammed Al Sahaf * Update src/docs/markdown/caddyfile/options.md --------- Co-authored-by: Mohammed Al Sahaf Co-authored-by: Francis Lavoie --- src/docs/markdown/caddyfile/options.md | 13 ++++++++++++- src/docs/markdown/metrics.md | 14 +++++++++++--- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/docs/markdown/caddyfile/options.md b/src/docs/markdown/caddyfile/options.md index 8daa55f..2e91de1 100644 --- a/src/docs/markdown/caddyfile/options.md +++ b/src/docs/markdown/caddyfile/options.md @@ -76,7 +76,9 @@ Possible options are (click on each option to jump to its documentation): } grace_period shutdown_delay - metrics + metrics { + per_host + } # TLS Options auto_https off|disable_redirects|ignore_loaded_certs|disable_certs @@ -969,6 +971,15 @@ Enables Prometheus metrics collection; necessary before scraping metrics. Note t } ``` +You can add the `per_host` option to label metrics with the host name of the metric. + +```caddy +{ + metrics { + per_host + } +} +``` ##### `trace` diff --git a/src/docs/markdown/metrics.md b/src/docs/markdown/metrics.md index 7a14283..0a59acf 100644 --- a/src/docs/markdown/metrics.md +++ b/src/docs/markdown/metrics.md @@ -17,14 +17,22 @@ If using a Caddyfile, enable metrics [in global options](/docs/caddyfile/options ```caddy { - servers { - metrics - } + metrics } ``` If using JSON, add `"metrics": {}` to your [`apps > http > servers` configuration](/docs/json/apps/http/servers/). +To add per-host metrics you can insert the `per_host` option. Host specific metrics will now have a Host tag. + +```caddy +{ + metrics { + per_host + } +} +``` + ## Prometheus [Prometheus](https://prometheus.io) is a monitoring platform that collects