mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: use raw query data in provisioning to bypass interpolation of macros (#54293)
This commit is contained in:
committed by
GitHub
parent
49b1182f34
commit
a932428057
@@ -151,7 +151,12 @@ func (queryV1 *QueryV1) mapToModel() (models.AlertQuery, error) {
|
||||
// in json.RawMessage. We do this as we cannot use
|
||||
// json.RawMessage with a yaml files and have to use
|
||||
// JSONValue that supports both, json and yaml.
|
||||
encoded, err := json.Marshal(queryV1.Model.Value())
|
||||
//
|
||||
// We have to use the Raw field here, as Value would
|
||||
// try to interpolate macros like `$__timeFilter`, resulting
|
||||
// in missing macros in the SQL queries as they would be
|
||||
// replaced by an empty string.
|
||||
encoded, err := json.Marshal(queryV1.Model.Raw)
|
||||
if err != nil {
|
||||
return models.AlertQuery{}, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user