Skip to content

Commit

Permalink
Fix support bundle generation (grafana#4830)
Browse files Browse the repository at this point in the history
* Use the created HTTPClient, which uses the DialContextFunc defined in entrypoint

* Change in memory address for support handler to regular listen address
  • Loading branch information
spartan0x117 committed Aug 16, 2023
1 parent b1a3685 commit c9f1ca0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ Main (unreleased)

- Fix issue where Agent crashes when a blackbox modules config file is specified for blackbox integration. (@marctc)

- Fix issue where getting the support bundle failed due to using an HTTP Client that was not able to access the agent in-memory address. (@spartan0x117)

v0.35.4 (2023-08-14)
--------------------

Expand Down
2 changes: 1 addition & 1 deletion cmd/grafana-agent/entrypoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ func (ep *Entrypoint) supportHandler(rw http.ResponseWriter, r *http.Request) {
ep.mut.Lock()
var (
enabledFeatures = ep.cfg.EnabledFeatures
httpSrvAddress = ep.cfg.ServerFlags.HTTP.InMemoryAddr
httpSrvAddress = ep.cfg.ServerFlags.HTTP.ListenAddress
)
ep.mut.Unlock()

Expand Down
2 changes: 1 addition & 1 deletion pkg/supportbundle/supportbundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func Export(ctx context.Context, enabledFeatures []string, cfg []byte, srvAddres
return nil, fmt.Errorf("failed to read Agent logs instances: %s", err)
}

resp, err = http.DefaultClient.Get("http://" + srvAddress + "/agent/api/v1/logs/targets")
resp, err = httpClient.Get("http://" + srvAddress + "/agent/api/v1/logs/targets")
if err != nil {
return nil, fmt.Errorf("failed to get Agent logs targets: %s", err)
}
Expand Down

0 comments on commit c9f1ca0

Please sign in to comment.