Skip to content

Commit f23edd3

Browse files
committed
Add v1 to metrics API endpoint
Fixes containerd#1399 This versions the prometheus metrics API so we can manage backwards incompatible changes in the future more easily. Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
1 parent 9934acb commit f23edd3

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

RELEASES.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,15 @@ enumerating the support services and messages. See [api/](api) for details.
189189
Note that new services may be added in _minor_ releases. New service methods
190190
and new fields on messages may be added if they are optional.
191191

192+
### Metrics API
193+
194+
The metrics API that outputs prometheus style metrics will be versioned independently,
195+
prefixed with the API version. i.e. `/v1/metrics`, `/v2/metrics`.
196+
197+
The metrics API version will be incremented when breaking changes are made to the prometheus
198+
output. New metrics can be added to the output in a backwards compatible manner without
199+
bumping the API version.
200+
192201
#### Error Codes
193202

194203
Error codes will not change in a patch release, unless a missing error code

docs/getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ Waiting on things like the container's exit status and cgroup metrics are setup
257257
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:
258258

259259
```bash
260-
> curl 127.0.0.1:1338/metrics
260+
> curl 127.0.0.1:1338/v1/metrics
261261
```
262262

263263
Pretty cool right?

server/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ func (s *Server) ServeGRPC(l net.Listener) error {
136136
// ServeMetrics provides a prometheus endpoint for exposing metrics
137137
func (s *Server) ServeMetrics(l net.Listener) error {
138138
m := http.NewServeMux()
139-
m.Handle("/metrics", metrics.Handler())
139+
m.Handle("/v1/metrics", metrics.Handler())
140140
return trapClosedConnErr(http.Serve(l, m))
141141
}
142142

0 commit comments

Comments
 (0)