From f60c783b292ae3db9e5abaf74aa136c304b3181e Mon Sep 17 00:00:00 2001 From: Bernerd Schaefer Date: Thu, 25 Apr 2013 17:43:03 +0200 Subject: [PATCH] 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 --- prometheus/constants.go | 8 +++----- prometheus/registry.go | 3 +-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/prometheus/constants.go b/prometheus/constants.go index 58dc855..3879587 100644 --- a/prometheus/constants.go +++ b/prometheus/constants.go @@ -24,12 +24,10 @@ const ( // The format of the exported data. This will match this library's version, // 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 - // services interface shall include this header along with APIVersion as its - // value. - ProtocolVersionHeader = "X-Prometheus-API-Version" + // The content type and schema information set on telemetry data responses. + TelemetryContentType = `application/json; schema="prometheus/telemetry"; version=` + APIVersion // The customary web services endpoint on which telemetric data is exposed. ExpositionResource = "/metrics.json" diff --git a/prometheus/registry.go b/prometheus/registry.go index ebe9871..7adb487 100644 --- a/prometheus/registry.go +++ b/prometheus/registry.go @@ -240,8 +240,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, TelemetryContentType) writer := decorateWriter(r, w)