Merge pull request #1534 from crosbymichael/metricsv1

Add v1 to metrics API endpoint
This commit is contained in:
Phil Estes 2017-09-21 15:48:14 -04:00 committed by GitHub
commit 2146feec26
3 changed files with 11 additions and 2 deletions

View File

@ -189,6 +189,15 @@ enumerating the support services and messages. See [api/](api) for details.
Note that new services may be added in _minor_ releases. New service methods
and new fields on messages may be added if they are optional.
### Metrics API
The metrics API that outputs prometheus style metrics will be versioned independently,
prefixed with the API version. i.e. `/v1/metrics`, `/v2/metrics`.
The metrics API version will be incremented when breaking changes are made to the prometheus
output. New metrics can be added to the output in a backwards compatible manner without
bumping the API version.
#### Error Codes
Error codes will not change in a patch release, unless a missing error code

View File

@ -257,7 +257,7 @@ Waiting on things like the container's exit status and cgroup metrics are setup
If you are familiar with prometheus you can curl the containerd metrics endpoint (in the `config.toml` that we created) to see your container's metrics:
```bash
> curl 127.0.0.1:1338/metrics
> curl 127.0.0.1:1338/v1/metrics
```
Pretty cool right?

View File

@ -136,7 +136,7 @@ func (s *Server) ServeGRPC(l net.Listener) error {
// ServeMetrics provides a prometheus endpoint for exposing metrics
func (s *Server) ServeMetrics(l net.Listener) error {
m := http.NewServeMux()
m.Handle("/metrics", metrics.Handler())
m.Handle("/v1/metrics", metrics.Handler())
return trapClosedConnErr(http.Serve(l, m))
}