From 8af0bbb3a0a5fbbb217dbc91d77e61b48faed9d4 Mon Sep 17 00:00:00 2001 From: Bernerd Schaefer Date: Fri, 12 Apr 2013 14:50:44 +0200 Subject: [PATCH] Set job label for targets registered through the API This is set when jobs are statically registered (see retrieval/targetmanager.go#L92), and should be set here, too. --- web/api/targets.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/web/api/targets.go b/web/api/targets.go index 8140c4120..aa74ce9f3 100644 --- a/web/api/targets.go +++ b/web/api/targets.go @@ -33,7 +33,9 @@ func (serv MetricsService) SetTargets(targetGroups []TargetGroup, jobName string newTargets := []retrieval.Target{} for _, targetGroup := range targetGroups { // Do mandatory map type conversion due to Go shortcomings. - baseLabels := model.LabelSet{} + baseLabels := model.LabelSet{ + model.LabelName("job"): model.LabelValue(job.Name), + } for label, value := range targetGroup.BaseLabels { baseLabels[model.LabelName(label)] = model.LabelValue(value) }