Adhere to telemetry schema 0.0.2
* The schema and version of telemetry data is exposed through the Content-Type header instead of through a custom HTTP Header. See [Prometheus Client Data Exposition Format][1] for more details. [1]: https://docs.google.com/a/soundcloud.com/document/d/1ZjyKiKxZV83VI9ZKAXRGKaUKK2BIWCT7oiGBKDBpjEY/edit#heading=h.wnviarbnyxcj
This commit is contained in:
parent
04c7f7bc7f
commit
f60c783b29
|
@ -24,12 +24,10 @@ const (
|
||||||
|
|
||||||
// The format of the exported data. This will match this library's version,
|
// The format of the exported data. This will match this library's version,
|
||||||
// which subscribes to the Semantic Versioning scheme.
|
// which subscribes to the Semantic Versioning scheme.
|
||||||
APIVersion = "0.0.1"
|
APIVersion = "0.0.2"
|
||||||
|
|
||||||
// When reporting telemetric data over the HTTP web services interface, a web
|
// The content type and schema information set on telemetry data responses.
|
||||||
// services interface shall include this header along with APIVersion as its
|
TelemetryContentType = `application/json; schema="prometheus/telemetry"; version=` + APIVersion
|
||||||
// value.
|
|
||||||
ProtocolVersionHeader = "X-Prometheus-API-Version"
|
|
||||||
|
|
||||||
// The customary web services endpoint on which telemetric data is exposed.
|
// The customary web services endpoint on which telemetric data is exposed.
|
||||||
ExpositionResource = "/metrics.json"
|
ExpositionResource = "/metrics.json"
|
||||||
|
|
|
@ -240,8 +240,7 @@ func (registry registry) Handler() http.HandlerFunc {
|
||||||
|
|
||||||
if strings.HasSuffix(url.Path, jsonSuffix) {
|
if strings.HasSuffix(url.Path, jsonSuffix) {
|
||||||
header := w.Header()
|
header := w.Header()
|
||||||
header.Set(ProtocolVersionHeader, APIVersion)
|
header.Set(contentTypeHeader, TelemetryContentType)
|
||||||
header.Set(contentTypeHeader, jsonContentType)
|
|
||||||
|
|
||||||
writer := decorateWriter(r, w)
|
writer := decorateWriter(r, w)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue