docs: Monitoring and metrics (#86)

* metrics: Adding docs for metrics

Signed-off-by: Dave Henderson <dhenderson@gmail.com>

* Addressing review comments

Signed-off-by: Dave Henderson <dhenderson@gmail.com>

* Apply suggestions from code review

Co-authored-by: Matt Holt <mholt@users.noreply.github.com>

* Update src/docs/markdown/metrics.md

Co-authored-by: Dave Henderson <dhenderson@gmail.com>

Co-authored-by: Matt Holt <mholt@users.noreply.github.com>
This commit is contained in:
Dave Henderson 2020-09-22 22:12:24 -04:00 committed by GitHub
parent 2c6a8a0f9f
commit 30084b98b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 303 additions and 2 deletions

View file

@ -0,0 +1,45 @@
---
title: metrics (Caddyfile directive)
---
# metrics
Configures a Prometheus metrics exposition endpoint so the gathered metrics can
be exposed for scraping.
Note that a `/metrics` endpoint is also attached to the [admin API](/docs/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](https://prometheus.io/docs/instrumenting/exposition_formats/#text-based-format)
or, if negotiated, in the [OpenMetrics exposition format](https://pkg.go.dev/github.com/prometheus/client_golang@v1.7.1/prometheus/promhttp#HandlerOpts)
(`application/openmetrics-text`).
See also [Monitoring Caddy with Prometheus metrics](/docs/metrics).
## Syntax
```caddy-d
metrics [<matcher>]
```
## Examples
Expose metrics at the default `/metrics` path:
```caddy-d
metrics /metrics
```
Expose metrics at another path:
```caddy-d
metrics /foo/bar/baz
```
Serve metrics at a separate subdomain:
```caddy
metrics.example.com {
metrics
}
```