diff --git a/Godeps/_workspace/src/github.com/prometheus/client_golang/model/labelname.go b/Godeps/_workspace/src/github.com/prometheus/client_golang/model/labelname.go index f41b7ff4a..bcb8f8906 100644 --- a/Godeps/_workspace/src/github.com/prometheus/client_golang/model/labelname.go +++ b/Godeps/_workspace/src/github.com/prometheus/client_golang/model/labelname.go @@ -29,6 +29,10 @@ const ( // timeseries. MetricNameLabel LabelName = "__name__" + // SchemeLabel is the name of the label that holds the scheme on which to + // scrape a target. + SchemeLabel LabelName = "__scheme__" + // AddressLabel is the name of the label that holds the address of // a scrape target. AddressLabel LabelName = "__address__" diff --git a/retrieval/target.go b/retrieval/target.go index d9502b025..67d14b389 100644 --- a/retrieval/target.go +++ b/retrieval/target.go @@ -177,7 +177,8 @@ type Target struct { func NewTarget(cfg *config.ScrapeConfig, baseLabels, metaLabels clientmodel.LabelSet) *Target { t := &Target{ url: &url.URL{ - Host: string(baseLabels[clientmodel.AddressLabel]), + Scheme: string(baseLabels[clientmodel.SchemeLabel]), + Host: string(baseLabels[clientmodel.AddressLabel]), }, status: &TargetStatus{}, scraperStopping: make(chan struct{}), @@ -205,7 +206,7 @@ func (t *Target) Update(cfg *config.ScrapeConfig, baseLabels, metaLabels clientm } t.httpClient = httpClient - t.url.Scheme = cfg.Scheme + t.url.Scheme = string(baseLabels[clientmodel.SchemeLabel]) t.url.Path = string(baseLabels[clientmodel.MetricsPathLabel]) params := url.Values{} for k, v := range cfg.Params { @@ -510,6 +511,7 @@ func (t *Target) fullLabels() clientmodel.LabelSet { } lset[clientmodel.MetricsPathLabel] = clientmodel.LabelValue(t.url.Path) lset[clientmodel.AddressLabel] = clientmodel.LabelValue(t.url.Host) + lset[clientmodel.SchemeLabel] = clientmodel.LabelValue(t.url.Scheme) return lset } diff --git a/retrieval/target_test.go b/retrieval/target_test.go index c03a47c25..69a6e390c 100644 --- a/retrieval/target_test.go +++ b/retrieval/target_test.go @@ -426,6 +426,7 @@ func TestURLParams(t *testing.T) { }, }, clientmodel.LabelSet{ + clientmodel.SchemeLabel: clientmodel.LabelValue(serverURL.Scheme), clientmodel.AddressLabel: clientmodel.LabelValue(serverURL.Host), "__param_foo": "bar", }, diff --git a/retrieval/targetmanager.go b/retrieval/targetmanager.go index 1a18b0236..271307b74 100644 --- a/retrieval/targetmanager.go +++ b/retrieval/targetmanager.go @@ -339,6 +339,7 @@ func (tm *TargetManager) targetsFromGroup(tg *config.TargetGroup, cfg *config.Sc labelsets := []clientmodel.LabelSet{ tg.Labels, { + clientmodel.SchemeLabel: clientmodel.LabelValue(cfg.Scheme), clientmodel.MetricsPathLabel: clientmodel.LabelValue(cfg.MetricsPath), clientmodel.JobLabel: clientmodel.LabelValue(cfg.JobName), },