Skip to content

Commit 9177f33

Browse files
authored
fix: crash when updating import.http config (#2204)
* fix: crash when updating import.http config
1 parent 8c5320d commit 9177f33

2 files changed

Lines changed: 13 additions & 10 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ Main (unreleased)
6767

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

70+
- Fixed a crash when updating the configuration of `remote.http`. (@kinolaev)
71+
7072
### Other changes
7173

7274
- Change the stability of the `livedebugging` feature from "experimental" to "generally available". (@wildum)

internal/runtime/internal/importsource/import_http.go

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,18 @@ func (im *ImportHTTP) Evaluate(scope *vm.Scope) error {
6666
if err := im.eval.Evaluate(scope, &arguments); err != nil {
6767
return fmt.Errorf("decoding configuration: %w", err)
6868
}
69+
remoteHttpArguments := remote_http.Arguments{
70+
URL: arguments.URL,
71+
PollFrequency: arguments.PollFrequency,
72+
PollTimeout: arguments.PollTimeout,
73+
Method: arguments.Method,
74+
Headers: arguments.Headers,
75+
Body: arguments.Body,
76+
Client: arguments.Client,
77+
}
6978
if im.managedRemoteHTTP == nil {
7079
var err error
71-
im.managedRemoteHTTP, err = remote_http.New(im.managedOpts, remote_http.Arguments{
72-
URL: arguments.URL,
73-
PollFrequency: arguments.PollFrequency,
74-
PollTimeout: arguments.PollTimeout,
75-
Method: arguments.Method,
76-
Headers: arguments.Headers,
77-
Body: arguments.Body,
78-
Client: arguments.Client,
79-
})
80+
im.managedRemoteHTTP, err = remote_http.New(im.managedOpts, remoteHttpArguments)
8081
if err != nil {
8182
return fmt.Errorf("creating http component: %w", err)
8283
}
@@ -88,7 +89,7 @@ func (im *ImportHTTP) Evaluate(scope *vm.Scope) error {
8889
}
8990

9091
// Update the existing managed component
91-
if err := im.managedRemoteHTTP.Update(arguments); err != nil {
92+
if err := im.managedRemoteHTTP.Update(remoteHttpArguments); err != nil {
9293
return fmt.Errorf("updating component: %w", err)
9394
}
9495
im.arguments = arguments

0 commit comments

Comments
 (0)