From e6616c74a2e115042de0c622cca0adf50bcfbb30 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Sat, 11 Feb 2023 14:41:00 -0800 Subject: [PATCH] lib/promscrape/discovery/openstack: use port 80 for the discovered target by default if it isnt specified in the config --- lib/promscrape/discovery/openstack/api.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/promscrape/discovery/openstack/api.go b/lib/promscrape/discovery/openstack/api.go index 4dbc741ad5..b97fffd949 100644 --- a/lib/promscrape/discovery/openstack/api.go +++ b/lib/promscrape/discovery/openstack/api.go @@ -69,6 +69,10 @@ func getAPIConfig(sdc *SDConfig, baseDir string) (*apiConfig, error) { } func newAPIConfig(sdc *SDConfig, baseDir string) (*apiConfig, error) { + port := sdc.Port + if port == 0 { + port = 80 + } cfg := &apiConfig{ client: &http.Client{ Transport: &http.Transport{ @@ -78,7 +82,7 @@ func newAPIConfig(sdc *SDConfig, baseDir string) (*apiConfig, error) { availability: sdc.Availability, region: sdc.Region, allTenants: sdc.AllTenants, - port: sdc.Port, + port: port, } if sdc.TLSConfig != nil { opts := &promauth.Options{