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 <mohammed@caffeinatedwonders.com>

* Update src/docs/markdown/metrics.md

Co-authored-by: Mohammed Al Sahaf <mohammed@caffeinatedwonders.com>

* Update src/docs/markdown/caddyfile/options.md

---------

Co-authored-by: Mohammed Al Sahaf <mohammed@caffeinatedwonders.com>
Co-authored-by: Francis Lavoie <lavofr@gmail.com>
This commit is contained in:
Camerin Figueroa 2025-03-02 19:36:13 -05:00 committed by GitHub
parent 470b984b0b
commit 6740472fab
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 23 additions and 4 deletions

View file

@ -76,7 +76,9 @@ Possible options are (click on each option to jump to its documentation):
}
grace_period <duration>
shutdown_delay <duration>
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`

View file

@ -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