From 80cdb0121d5a8435b0c52ee44a107c5c77f752e1 Mon Sep 17 00:00:00 2001 From: Julius Volz Date: Fri, 18 Jan 2013 01:05:14 +0100 Subject: [PATCH] Add support for configured job base labels. --- retrieval/target.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/retrieval/target.go b/retrieval/target.go index edb02a64d..5ab302393 100644 --- a/retrieval/target.go +++ b/retrieval/target.go @@ -162,7 +162,10 @@ func (t *target) Scrape(earliest time.Time, results chan Result) (err error) { 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 { 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 { - m[model.LabelName(baseK)] = model.LabelValue(baseV) + m[baseK] = baseV } 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 { - m[model.LabelName(baseK)] = model.LabelValue(baseV) + m[baseK] = baseV } result.Samples = append(result.Samples, s)