mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-28 06:59:40 -08:00
Make scheme relabelable via discovery
This commit is contained in:
parent
e324910ff2
commit
da4c50a6cf
4
Godeps/_workspace/src/github.com/prometheus/client_golang/model/labelname.go
generated
vendored
4
Godeps/_workspace/src/github.com/prometheus/client_golang/model/labelname.go
generated
vendored
|
@ -29,6 +29,10 @@ const (
|
||||||
// timeseries.
|
// timeseries.
|
||||||
MetricNameLabel LabelName = "__name__"
|
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
|
// AddressLabel is the name of the label that holds the address of
|
||||||
// a scrape target.
|
// a scrape target.
|
||||||
AddressLabel LabelName = "__address__"
|
AddressLabel LabelName = "__address__"
|
||||||
|
|
|
@ -177,7 +177,8 @@ type Target struct {
|
||||||
func NewTarget(cfg *config.ScrapeConfig, baseLabels, metaLabels clientmodel.LabelSet) *Target {
|
func NewTarget(cfg *config.ScrapeConfig, baseLabels, metaLabels clientmodel.LabelSet) *Target {
|
||||||
t := &Target{
|
t := &Target{
|
||||||
url: &url.URL{
|
url: &url.URL{
|
||||||
Host: string(baseLabels[clientmodel.AddressLabel]),
|
Scheme: string(baseLabels[clientmodel.SchemeLabel]),
|
||||||
|
Host: string(baseLabels[clientmodel.AddressLabel]),
|
||||||
},
|
},
|
||||||
status: &TargetStatus{},
|
status: &TargetStatus{},
|
||||||
scraperStopping: make(chan struct{}),
|
scraperStopping: make(chan struct{}),
|
||||||
|
@ -205,7 +206,7 @@ func (t *Target) Update(cfg *config.ScrapeConfig, baseLabels, metaLabels clientm
|
||||||
}
|
}
|
||||||
t.httpClient = httpClient
|
t.httpClient = httpClient
|
||||||
|
|
||||||
t.url.Scheme = cfg.Scheme
|
t.url.Scheme = string(baseLabels[clientmodel.SchemeLabel])
|
||||||
t.url.Path = string(baseLabels[clientmodel.MetricsPathLabel])
|
t.url.Path = string(baseLabels[clientmodel.MetricsPathLabel])
|
||||||
params := url.Values{}
|
params := url.Values{}
|
||||||
for k, v := range cfg.Params {
|
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.MetricsPathLabel] = clientmodel.LabelValue(t.url.Path)
|
||||||
lset[clientmodel.AddressLabel] = clientmodel.LabelValue(t.url.Host)
|
lset[clientmodel.AddressLabel] = clientmodel.LabelValue(t.url.Host)
|
||||||
|
lset[clientmodel.SchemeLabel] = clientmodel.LabelValue(t.url.Scheme)
|
||||||
return lset
|
return lset
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -426,6 +426,7 @@ func TestURLParams(t *testing.T) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
clientmodel.LabelSet{
|
clientmodel.LabelSet{
|
||||||
|
clientmodel.SchemeLabel: clientmodel.LabelValue(serverURL.Scheme),
|
||||||
clientmodel.AddressLabel: clientmodel.LabelValue(serverURL.Host),
|
clientmodel.AddressLabel: clientmodel.LabelValue(serverURL.Host),
|
||||||
"__param_foo": "bar",
|
"__param_foo": "bar",
|
||||||
},
|
},
|
||||||
|
|
|
@ -339,6 +339,7 @@ func (tm *TargetManager) targetsFromGroup(tg *config.TargetGroup, cfg *config.Sc
|
||||||
labelsets := []clientmodel.LabelSet{
|
labelsets := []clientmodel.LabelSet{
|
||||||
tg.Labels,
|
tg.Labels,
|
||||||
{
|
{
|
||||||
|
clientmodel.SchemeLabel: clientmodel.LabelValue(cfg.Scheme),
|
||||||
clientmodel.MetricsPathLabel: clientmodel.LabelValue(cfg.MetricsPath),
|
clientmodel.MetricsPathLabel: clientmodel.LabelValue(cfg.MetricsPath),
|
||||||
clientmodel.JobLabel: clientmodel.LabelValue(cfg.JobName),
|
clientmodel.JobLabel: clientmodel.LabelValue(cfg.JobName),
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue