Skip to content

Commit

Permalink
Merge pull request #55 from kongfei605/prom_support_env
Browse files Browse the repository at this point in the history
support env var for prom instances
  • Loading branch information
kongfei605 authored Jun 28, 2022
2 parents 6fa7e57 + aaf201b commit d9455a1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions inputs/prometheus/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ func (ins *Instance) Init() error {
} else if len(ins.URLs) == 0 {
return types.ErrInstancesEmpty
}
for i, u := range ins.URLs {
ins.URLs[i] = strings.Replace(u, "$hostname", config.Config.GetHostname(), -1)
ins.URLs[i] = strings.Replace(u, "$ip", config.Config.Global.IP, -1)
ins.URLs[i] = os.Expand(u, config.GetEnv)
}

if ins.Timeout <= 0 {
ins.Timeout = config.Duration(time.Second * 3)
Expand Down

0 comments on commit d9455a1

Please sign in to comment.