mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
app/vmalert: follow-up after 7a9ae9de0d
(#4381)
7a9ae9de0d
Signed-off-by: hagen1778 <roman@victoriametrics.com> (cherry picked from commiteccecdf177
)
This commit is contained in:
parent
bab0808a7f
commit
e082c3dd27
2 changed files with 14 additions and 12 deletions
|
@ -73,6 +73,7 @@ test-vmalert:
|
||||||
go test -v -race -cover ./app/vmalert/notifier
|
go test -v -race -cover ./app/vmalert/notifier
|
||||||
go test -v -race -cover ./app/vmalert/config
|
go test -v -race -cover ./app/vmalert/config
|
||||||
go test -v -race -cover ./app/vmalert/remotewrite
|
go test -v -race -cover ./app/vmalert/remotewrite
|
||||||
|
go test -v -race -cover ./app/vmalert/utils
|
||||||
|
|
||||||
run-vmalert: vmalert
|
run-vmalert: vmalert
|
||||||
./bin/vmalert -rule=app/vmalert/config/testdata/rules/rules2-good.rules \
|
./bin/vmalert -rule=app/vmalert/config/testdata/rules/rules2-good.rules \
|
||||||
|
|
|
@ -28,6 +28,7 @@ func toDatasourceType(s string) datasourceType {
|
||||||
}
|
}
|
||||||
|
|
||||||
// VMStorage represents vmstorage entity with ability to read and write metrics
|
// VMStorage represents vmstorage entity with ability to read and write metrics
|
||||||
|
// WARN: when adding a new field, remember to update Clone() method.
|
||||||
type VMStorage struct {
|
type VMStorage struct {
|
||||||
c *http.Client
|
c *http.Client
|
||||||
authCfg *promauth.Config
|
authCfg *promauth.Config
|
||||||
|
@ -57,11 +58,16 @@ func (s *VMStorage) Clone() *VMStorage {
|
||||||
c: s.c,
|
c: s.c,
|
||||||
authCfg: s.authCfg,
|
authCfg: s.authCfg,
|
||||||
datasourceURL: s.datasourceURL,
|
datasourceURL: s.datasourceURL,
|
||||||
|
appendTypePrefix: s.appendTypePrefix,
|
||||||
lookBack: s.lookBack,
|
lookBack: s.lookBack,
|
||||||
queryStep: s.queryStep,
|
queryStep: s.queryStep,
|
||||||
appendTypePrefix: s.appendTypePrefix,
|
|
||||||
dataSourceType: s.dataSourceType,
|
dataSourceType: s.dataSourceType,
|
||||||
|
evaluationInterval: s.evaluationInterval,
|
||||||
extraParams: s.extraParams,
|
extraParams: s.extraParams,
|
||||||
|
extraHeaders: s.extraHeaders,
|
||||||
|
|
||||||
|
debug: s.debug,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,23 +75,18 @@ func (s *VMStorage) Clone() *VMStorage {
|
||||||
func (s *VMStorage) ApplyParams(params QuerierParams) *VMStorage {
|
func (s *VMStorage) ApplyParams(params QuerierParams) *VMStorage {
|
||||||
s.dataSourceType = toDatasourceType(params.DataSourceType)
|
s.dataSourceType = toDatasourceType(params.DataSourceType)
|
||||||
s.evaluationInterval = params.EvaluationInterval
|
s.evaluationInterval = params.EvaluationInterval
|
||||||
if len(params.QueryParams) != 0 {
|
|
||||||
for k, vl := range params.QueryParams {
|
for k, vl := range params.QueryParams {
|
||||||
if s.extraParams.Has(k) {
|
for _, v := range vl { // custom query params are prior to default ones
|
||||||
s.extraParams.Del(k)
|
s.extraParams.Set(k, v)
|
||||||
}
|
|
||||||
for _, v := range vl {
|
|
||||||
s.extraParams.Add(k, v)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
s.debug = params.Debug
|
|
||||||
if params.Headers != nil {
|
if params.Headers != nil {
|
||||||
for key, value := range params.Headers {
|
for key, value := range params.Headers {
|
||||||
kv := keyValue{key: key, value: value}
|
kv := keyValue{key: key, value: value}
|
||||||
s.extraHeaders = append(s.extraHeaders, kv)
|
s.extraHeaders = append(s.extraHeaders, kv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
s.debug = params.Debug
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue