Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hairyhenderson/caddyprom
⚠️ DEPRECATED - use the core metrics supported in Caddy v2.2.0-rc.2+
https://github.com/hairyhenderson/caddyprom
Last synced: 5 days ago
JSON representation
⚠️ DEPRECATED - use the core metrics supported in Caddy v2.2.0-rc.2+
- Host: GitHub
- URL: https://github.com/hairyhenderson/caddyprom
- Owner: hairyhenderson
- License: mit
- Archived: true
- Created: 2020-04-27T02:04:53.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-09-26T00:43:20.000Z (about 4 years ago)
- Last Synced: 2024-06-24T00:05:29.339Z (5 months ago)
- Language: Go
- Homepage: https://caddyserver.com/docs/metrics
- Size: 436 KB
- Stars: 27
- Watchers: 5
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# :warning: This module is deprecated! Caddy v2.2.0 (and later) contains built-in metrics support.
:mega: _Now that Caddy v2.2.0 has been released, I will be archiving this repository. Thanks to everyone for using and contributing to this module! It has been invaluable in making decisions toward metrics in Caddy's core!_
# Prometheus metrics module for Caddy v2
This implements a [Caddy v2 module](https://caddyserver.com/docs/extending-caddy)
that exposes metrics in the [Prometheus](https://prometheus.io/) format.To use this module, you must build a Caddy binary with the module compiled in. Use [xcaddy](https://github.com/caddyserver/xcaddy#install) for this.
## Usage
### Caddyfile
The simplest use could be in a Caddyfile like:
```
{
order prometheus first
}localhost
prometheus
```### JSON config
Here is an example that tracks metrics for Caddy's `reverse_proxy` module as well:
```json
{
"apps": {
"http": {
"servers": {
"srv0": {
"listen": [
":443"
],
"routes": [
{
"handle": [
{
"handler": "subroute",
"routes": [
{
"handle": [
{
"handler": "prometheus"
},
{
"handler": "reverse_proxy",
"upstreams": [
{
"dial": "10.0.0.1:80"
},
{
"dial": "10.0.0.2:80"
}
]
}
]
}
]
}
],
"match": [
{
"host": [
"redacted.mycompany.com"
]
}
],
"terminal": true
}
]
}
}
}
}
}
```## Get metrics
Then, when using a Caddy server with this module enabled:
```console
$ curl localhost/
$ curl localhost:9180/metrics
...
caddy_http_response_size_bytes_sum{code="418",method="get"} 42
...
```## License
[The MIT License](http://opensource.org/licenses/MIT)
Copyright (c) 2020 Dave Henderson