Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions pkg/storage/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,6 @@ func Prometheus(prometheusAPIURL string, customHeaders map[string]string) Driver
}

func (promCli *prometheusStorageClient) init() {
if viper.IsSet("maia.proxy") {
proxyURL, err := url.Parse(viper.GetString("maia.proxy"))
if err != nil {
panic(fmt.Errorf("could not set proxy: %s .\n%s", proxyURL, err.Error()))
} else {
promCli.httpClient = &http.Client{Transport: &http.Transport{Proxy: http.ProxyURL(proxyURL)}}
return
}
}
promCli.httpClient = &http.Client{}

// if federateURL is configured, this will direct /federate requests to another host URL
if viper.IsSet("maia.federate_url") {
parsedURL, err := url.Parse(viper.GetString("maia.federate_url"))
Expand All @@ -58,6 +47,16 @@ func (promCli *prometheusStorageClient) init() {
} else {
promCli.federateURL = promCli.url
}

if viper.IsSet("maia.proxy") {
proxyURL, err := url.Parse(viper.GetString("maia.proxy"))
if err != nil {
panic(fmt.Errorf("could not set proxy: %s .\n%s", proxyURL, err.Error()))
}
promCli.httpClient = &http.Client{Transport: &http.Transport{Proxy: http.ProxyURL(proxyURL)}}
return
}
Comment on lines +51 to +58

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with Copilot

promCli.httpClient = &http.Client{}
}

func (promCli *prometheusStorageClient) Query(query, time, timeout, acceptContentType string) (*http.Response, error) {
Expand Down
Loading