mirror of
https://github.com/prometheus/prometheus
synced 2025-01-30 19:55:53 +00:00
Merge pull request #1783 from knyar/json
Allow URLs in targets defined via a JSON file
This commit is contained in:
commit
be596f82b4
@ -575,9 +575,6 @@ func (tg *TargetGroup) UnmarshalJSON(b []byte) error {
|
|||||||
}
|
}
|
||||||
tg.Targets = make([]model.LabelSet, 0, len(g.Targets))
|
tg.Targets = make([]model.LabelSet, 0, len(g.Targets))
|
||||||
for _, t := range g.Targets {
|
for _, t := range g.Targets {
|
||||||
if strings.Contains(t, "/") {
|
|
||||||
return fmt.Errorf("%q is not a valid hostname", t)
|
|
||||||
}
|
|
||||||
tg.Targets = append(tg.Targets, model.LabelSet{
|
tg.Targets = append(tg.Targets, model.LabelSet{
|
||||||
model.AddressLabel: model.LabelValue(t),
|
model.AddressLabel: model.LabelValue(t),
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user