Skip to content

fix: initialize federateURL before proxy setup#230

Open
notque wants to merge 1 commit into
masterfrom
fix/federate-url-init-order
Open

fix: initialize federateURL before proxy setup#230
notque wants to merge 1 commit into
masterfrom
fix/federate-url-init-order

Conversation

@notque

@notque notque commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Move the federateURL initialization above the proxy setup block so it runs on both code paths.

@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown

Merging this branch will not change overall coverage

Impacted Packages Coverage Δ 🤖
github.com/SAP-cloud-infrastructure/maia/pkg/storage 84.14% (ø)

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/SAP-cloud-infrastructure/maia/pkg/storage/prometheus.go 79.73% (ø) 370 295 75

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Copilot AI left a comment

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.

Pull request overview

This PR fixes initialization order in the Prometheus storage client so federateURL is always set, even when an HTTP proxy is configured.

Changes:

  • Move federateURL initialization above the proxy setup to ensure it runs on both code paths.
  • Keep proxy-specific HTTP client setup intact while avoiding early-return before federateURL is computed.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/storage/prometheus.go
Comment on lines +51 to +58
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
}

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants