Loki: Apply scopes to expression if feature toggle is enabled. (#95917)
Signed-off-by: bergquist <carl.bergquist@gmail.com> Co-authored-by: Kyle Brandt <kyle@grafana.com>
This commit is contained in:
co-authored by
Kyle Brandt
parent
8148f0c3bb
commit
c7b6822a5e
@@ -125,7 +125,7 @@ func parseSupportingQueryType(jsonPointerValue *string) SupportingQueryType {
|
||||
}
|
||||
}
|
||||
|
||||
func parseQuery(queryContext *backend.QueryDataRequest) ([]*lokiQuery, error) {
|
||||
func parseQuery(queryContext *backend.QueryDataRequest, logqlScopesEnabled bool) ([]*lokiQuery, error) {
|
||||
qs := []*lokiQuery{}
|
||||
for _, query := range queryContext.Queries {
|
||||
model, err := parseQueryModel(query.JSON)
|
||||
@@ -171,6 +171,13 @@ func parseQuery(queryContext *backend.QueryDataRequest) ([]*lokiQuery, error) {
|
||||
legendFormat = *model.LegendFormat
|
||||
}
|
||||
|
||||
if logqlScopesEnabled {
|
||||
rewrittenExpr, err := ApplyScopes(expr, model.Scopes)
|
||||
if err == nil {
|
||||
expr = rewrittenExpr
|
||||
}
|
||||
}
|
||||
|
||||
supportingQueryType := parseSupportingQueryType(model.SupportingQueryType)
|
||||
|
||||
qs = append(qs, &lokiQuery{
|
||||
@@ -184,6 +191,7 @@ func parseQuery(queryContext *backend.QueryDataRequest) ([]*lokiQuery, error) {
|
||||
End: end,
|
||||
RefID: query.RefID,
|
||||
SupportingQueryType: supportingQueryType,
|
||||
Scopes: model.Scopes,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user