Use Content-Type to specify protocol and version.
This commit is contained in:
parent
a087e013a5
commit
4321769f6d
|
@ -28,9 +28,9 @@ const (
|
|||
APIVersion = "0.0.1"
|
||||
|
||||
// When reporting telemetric data over the HTTP web services interface, a web
|
||||
// services interface shall include this header along with APIVersion as its
|
||||
// services interface shall include this Content-Type along with APIVersion as its
|
||||
// value.
|
||||
ProtocolVersionHeader = "X-Prometheus-API-Version"
|
||||
ProtocolContentType = "Content-Type: application/json; protocol=prometheus_telemetry; version=" + APIVersion
|
||||
|
||||
// The customary web services endpoint on which telemetric data is exposed.
|
||||
ExpositionResource = "/metrics.json"
|
||||
|
|
|
@ -31,7 +31,6 @@ const (
|
|||
contentTypeHeader = "Content-Type"
|
||||
gzipAcceptEncodingValue = "gzip"
|
||||
gzipContentEncodingValue = "gzip"
|
||||
jsonContentType = "application/json"
|
||||
jsonSuffix = ".json"
|
||||
)
|
||||
|
||||
|
@ -277,8 +276,7 @@ func (registry registry) Handler() http.HandlerFunc {
|
|||
|
||||
if strings.HasSuffix(url.Path, jsonSuffix) {
|
||||
header := w.Header()
|
||||
header.Set(ProtocolVersionHeader, APIVersion)
|
||||
header.Set(contentTypeHeader, jsonContentType)
|
||||
header.Set(contentTypeHeader, ProtocolContentType)
|
||||
|
||||
writer := decorateWriter(r, w)
|
||||
|
||||
|
|
Loading…
Reference in New Issue