adds query params for vmalert (#1094)

remoteWrite.url now accepts query params at provided url
https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1087
This commit is contained in:
Nikolay 2021-02-27 13:04:58 +03:00 committed by GitHub
parent 4f8a72806a
commit 317b0cbed2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -94,7 +94,7 @@ func NewClient(ctx context.Context, cfg Config) (*Client, error) {
Timeout: cfg.WriteTimeout, Timeout: cfg.WriteTimeout,
Transport: cfg.Transport, Transport: cfg.Transport,
}, },
addr: strings.TrimSuffix(cfg.Addr, "/") + writePath, addr: strings.TrimSuffix(cfg.Addr, "/"),
baUser: cfg.BasicAuthUser, baUser: cfg.BasicAuthUser,
baPass: cfg.BasicAuthPass, baPass: cfg.BasicAuthPass,
flushInterval: cfg.FlushInterval, flushInterval: cfg.FlushInterval,
@ -231,6 +231,7 @@ func (c *Client) send(ctx context.Context, data []byte) error {
if c.baPass != "" { if c.baPass != "" {
req.SetBasicAuth(c.baUser, c.baPass) req.SetBasicAuth(c.baUser, c.baPass)
} }
req.URL.Path += writePath
resp, err := c.c.Do(req.WithContext(ctx)) resp, err := c.c.Do(req.WithContext(ctx))
if err != nil { if err != nil {
return fmt.Errorf("error while sending request to %s: %w; Data len %d(%d)", return fmt.Errorf("error while sending request to %s: %w; Data len %d(%d)",