Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
Signed-off-by: liguozhong <[email protected]>

Signed-off-by: fuling <[email protected]>
  • Loading branch information
liguozhong committed Oct 11, 2023
1 parent 8ad0e90 commit 74dfd89
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions notifier/notifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -631,28 +631,30 @@ type Target struct {
}

func (a Target) Labels() labels.Labels {
lset := labels.Labels{}
for _, l := range a.labels {
lb := labels.NewBuilder(labels.EmptyLabels())
a.labels.Range(func(l labels.Label) {
if !strings.HasPrefix(l.Name, model.ReservedLabelPrefix) {
lset = append(lset, l)
lb.Set(l.Name, l.Value)
}
}
})
url := url.URL{
Scheme: a.labels.Get(model.SchemeLabel),
Host: a.labels.Get(model.AddressLabel),
Path: a.labels.Get(pathLabel),
}
instance := url.String()
if instance != "" {
lset = append(lset, labels.Label{Name: model.InstanceLabel, Value: instance})
lb.Set(model.InstanceLabel, instance)
}
return lset
return lb.Labels()
}

func (a Target) DiscoveredLabels() labels.Labels {
lset := labels.Labels{}
lset = append(lset, a.discoveredLabels...)
return lset
lb := labels.NewBuilder(labels.EmptyLabels())
a.discoveredLabels.Range(func(l labels.Label) {
lb.Set(l.Name, l.Value)
})
return lb.Labels()
}

func (n *Manager) TargetsAll() map[string][]Target {
Expand Down

0 comments on commit 74dfd89

Please sign in to comment.