Add support for configured job base labels.

This commit is contained in:
Julius Volz 2013-01-18 01:05:14 +01:00
parent 09d543de97
commit 80cdb0121d
1 changed files with 6 additions and 3 deletions

View File

@ -162,7 +162,10 @@ func (t *target) Scrape(earliest time.Time, results chan Result) (err error) {
return return
} }
baseLabels := map[string]string{"instance": t.Address()} baseLabels := model.LabelSet{"instance": model.LabelValue(t.Address())}
for baseK, baseV := range t.BaseLabels {
baseLabels[baseK] = baseV
}
for name, v := range intermediate { for name, v := range intermediate {
asMap, ok := v.(map[string]interface{}) asMap, ok := v.(map[string]interface{})
@ -187,7 +190,7 @@ func (t *target) Scrape(earliest time.Time, results chan Result) (err error) {
} }
for baseK, baseV := range baseLabels { for baseK, baseV := range baseLabels {
m[model.LabelName(baseK)] = model.LabelValue(baseV) m[baseK] = baseV
} }
result.Samples = append(result.Samples, s) result.Samples = append(result.Samples, s)
@ -219,7 +222,7 @@ func (t *target) Scrape(earliest time.Time, results chan Result) (err error) {
} }
for baseK, baseV := range baseLabels { for baseK, baseV := range baseLabels {
m[model.LabelName(baseK)] = model.LabelValue(baseV) m[baseK] = baseV
} }
result.Samples = append(result.Samples, s) result.Samples = append(result.Samples, s)