Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: crash when updating import.http config #2204

Merged
merged 2 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ Main (unreleased)

- Updated `prometheus.write.queue` to fix issue with TTL comparing different scales of time. (@mattdurham)

- Fixed a crash when updating import.http config that occurred because `importsource.HTTPArguments` was passed to `component/remote/http.Update` instead of `component/remote/http.Arguments`
kinolaev marked this conversation as resolved.
Show resolved Hide resolved

### Other changes

- Change the stability of the `livedebugging` feature from "experimental" to "generally available". (@wildum)
Expand Down
21 changes: 11 additions & 10 deletions internal/runtime/internal/importsource/import_http.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,18 @@ func (im *ImportHTTP) Evaluate(scope *vm.Scope) error {
if err := im.eval.Evaluate(scope, &arguments); err != nil {
return fmt.Errorf("decoding configuration: %w", err)
}
remoteHttpArguments := remote_http.Arguments{
URL: arguments.URL,
PollFrequency: arguments.PollFrequency,
PollTimeout: arguments.PollTimeout,
Method: arguments.Method,
Headers: arguments.Headers,
Body: arguments.Body,
Client: arguments.Client,
}
if im.managedRemoteHTTP == nil {
var err error
im.managedRemoteHTTP, err = remote_http.New(im.managedOpts, remote_http.Arguments{
URL: arguments.URL,
PollFrequency: arguments.PollFrequency,
PollTimeout: arguments.PollTimeout,
Method: arguments.Method,
Headers: arguments.Headers,
Body: arguments.Body,
Client: arguments.Client,
})
im.managedRemoteHTTP, err = remote_http.New(im.managedOpts, remoteHttpArguments)
if err != nil {
return fmt.Errorf("creating http component: %w", err)
}
Expand All @@ -88,7 +89,7 @@ func (im *ImportHTTP) Evaluate(scope *vm.Scope) error {
}

// Update the existing managed component
if err := im.managedRemoteHTTP.Update(arguments); err != nil {
if err := im.managedRemoteHTTP.Update(remoteHttpArguments); err != nil {
return fmt.Errorf("updating component: %w", err)
}
im.arguments = arguments
Expand Down
Loading