Skip to content

Commit

Permalink
fix: crash when updating import.http config
Browse files Browse the repository at this point in the history
  • Loading branch information
kinolaev committed Dec 2, 2024
1 parent 385ac8f commit 08e11e8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
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`

### 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

0 comments on commit 08e11e8

Please sign in to comment.