mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
feat(alerting): enable loki query optimization by default (#74739)
This commit is contained in:
parent
99be6fb747
commit
f3b6d01306
@ -117,7 +117,6 @@ Experimental features might be changed or removed without prior notice.
|
|||||||
| `exploreScrollableLogsContainer` | Improves the scrolling behavior of logs in Explore |
|
| `exploreScrollableLogsContainer` | Improves the scrolling behavior of logs in Explore |
|
||||||
| `recordedQueriesMulti` | Enables writing multiple items from a single query within Recorded Queries |
|
| `recordedQueriesMulti` | Enables writing multiple items from a single query within Recorded Queries |
|
||||||
| `pluginsDynamicAngularDetectionPatterns` | Enables fetching Angular detection patterns for plugins from GCOM and fallback to hardcoded ones |
|
| `pluginsDynamicAngularDetectionPatterns` | Enables fetching Angular detection patterns for plugins from GCOM and fallback to hardcoded ones |
|
||||||
| `alertingLokiRangeToInstant` | Rewrites eligible loki range queries to instant queries |
|
|
||||||
| `vizAndWidgetSplit` | Split panels between vizualizations and widgets |
|
| `vizAndWidgetSplit` | Split panels between vizualizations and widgets |
|
||||||
| `prometheusIncrementalQueryInstrumentation` | Adds RudderStack events to incremental queries |
|
| `prometheusIncrementalQueryInstrumentation` | Adds RudderStack events to incremental queries |
|
||||||
| `logsExploreTableVisualisation` | A table visualisation for logs in Explore |
|
| `logsExploreTableVisualisation` | A table visualisation for logs in Explore |
|
||||||
|
@ -97,7 +97,6 @@ export interface FeatureToggles {
|
|||||||
exploreScrollableLogsContainer?: boolean;
|
exploreScrollableLogsContainer?: boolean;
|
||||||
recordedQueriesMulti?: boolean;
|
recordedQueriesMulti?: boolean;
|
||||||
pluginsDynamicAngularDetectionPatterns?: boolean;
|
pluginsDynamicAngularDetectionPatterns?: boolean;
|
||||||
alertingLokiRangeToInstant?: boolean;
|
|
||||||
vizAndWidgetSplit?: boolean;
|
vizAndWidgetSplit?: boolean;
|
||||||
prometheusIncrementalQueryInstrumentation?: boolean;
|
prometheusIncrementalQueryInstrumentation?: boolean;
|
||||||
logsExploreTableVisualisation?: boolean;
|
logsExploreTableVisualisation?: boolean;
|
||||||
|
@ -542,13 +542,6 @@ var (
|
|||||||
FrontendOnly: false,
|
FrontendOnly: false,
|
||||||
Owner: grafanaPluginsPlatformSquad,
|
Owner: grafanaPluginsPlatformSquad,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
Name: "alertingLokiRangeToInstant",
|
|
||||||
Description: "Rewrites eligible loki range queries to instant queries",
|
|
||||||
Stage: FeatureStageExperimental,
|
|
||||||
FrontendOnly: false,
|
|
||||||
Owner: grafanaAlertingSquad,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
Name: "vizAndWidgetSplit",
|
Name: "vizAndWidgetSplit",
|
||||||
Description: "Split panels between vizualizations and widgets",
|
Description: "Split panels between vizualizations and widgets",
|
||||||
|
@ -78,7 +78,6 @@ cloudWatchLogsMonacoEditor,preview,@grafana/aws-datasources,false,false,false,tr
|
|||||||
exploreScrollableLogsContainer,experimental,@grafana/observability-logs,false,false,false,true
|
exploreScrollableLogsContainer,experimental,@grafana/observability-logs,false,false,false,true
|
||||||
recordedQueriesMulti,experimental,@grafana/observability-metrics,false,false,false,false
|
recordedQueriesMulti,experimental,@grafana/observability-metrics,false,false,false,false
|
||||||
pluginsDynamicAngularDetectionPatterns,experimental,@grafana/plugins-platform-backend,false,false,false,false
|
pluginsDynamicAngularDetectionPatterns,experimental,@grafana/plugins-platform-backend,false,false,false,false
|
||||||
alertingLokiRangeToInstant,experimental,@grafana/alerting-squad,false,false,false,false
|
|
||||||
vizAndWidgetSplit,experimental,@grafana/dashboards-squad,false,false,false,true
|
vizAndWidgetSplit,experimental,@grafana/dashboards-squad,false,false,false,true
|
||||||
prometheusIncrementalQueryInstrumentation,experimental,@grafana/observability-metrics,false,false,false,true
|
prometheusIncrementalQueryInstrumentation,experimental,@grafana/observability-metrics,false,false,false,true
|
||||||
logsExploreTableVisualisation,experimental,@grafana/observability-logs,false,false,false,true
|
logsExploreTableVisualisation,experimental,@grafana/observability-logs,false,false,false,true
|
||||||
|
|
@ -323,10 +323,6 @@ const (
|
|||||||
// Enables fetching Angular detection patterns for plugins from GCOM and fallback to hardcoded ones
|
// Enables fetching Angular detection patterns for plugins from GCOM and fallback to hardcoded ones
|
||||||
FlagPluginsDynamicAngularDetectionPatterns = "pluginsDynamicAngularDetectionPatterns"
|
FlagPluginsDynamicAngularDetectionPatterns = "pluginsDynamicAngularDetectionPatterns"
|
||||||
|
|
||||||
// FlagAlertingLokiRangeToInstant
|
|
||||||
// Rewrites eligible loki range queries to instant queries
|
|
||||||
FlagAlertingLokiRangeToInstant = "alertingLokiRangeToInstant"
|
|
||||||
|
|
||||||
// FlagVizAndWidgetSplit
|
// FlagVizAndWidgetSplit
|
||||||
// Split panels between vizualizations and widgets
|
// Split panels between vizualizations and widgets
|
||||||
FlagVizAndWidgetSplit = "vizAndWidgetSplit"
|
FlagVizAndWidgetSplit = "vizAndWidgetSplit"
|
||||||
|
@ -10,7 +10,6 @@ import (
|
|||||||
|
|
||||||
"github.com/grafana/grafana/pkg/infra/db"
|
"github.com/grafana/grafana/pkg/infra/db"
|
||||||
"github.com/grafana/grafana/pkg/services/dashboards"
|
"github.com/grafana/grafana/pkg/services/dashboards"
|
||||||
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
|
||||||
"github.com/grafana/grafana/pkg/services/folder"
|
"github.com/grafana/grafana/pkg/services/folder"
|
||||||
ngmodels "github.com/grafana/grafana/pkg/services/ngalert/models"
|
ngmodels "github.com/grafana/grafana/pkg/services/ngalert/models"
|
||||||
"github.com/grafana/grafana/pkg/services/search/model"
|
"github.com/grafana/grafana/pkg/services/search/model"
|
||||||
@ -540,7 +539,6 @@ func (st DBstore) GetAlertRulesForScheduling(ctx context.Context, query *ngmodel
|
|||||||
st.Logger.Error("Unable to close rows session", "error", err)
|
st.Logger.Error("Unable to close rows session", "error", err)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
lokiRangeToInstantEnabled := st.FeatureToggles.IsEnabled(featuremgmt.FlagAlertingLokiRangeToInstant)
|
|
||||||
// Deserialize each rule separately in case any of them contain invalid JSON.
|
// Deserialize each rule separately in case any of them contain invalid JSON.
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
rule := new(ngmodels.AlertRule)
|
rule := new(ngmodels.AlertRule)
|
||||||
@ -553,7 +551,6 @@ func (st DBstore) GetAlertRulesForScheduling(ctx context.Context, query *ngmodel
|
|||||||
// In previous versions of Grafana, Loki datasources would default to range queries
|
// In previous versions of Grafana, Loki datasources would default to range queries
|
||||||
// instead of instant queries, sometimes creating unnecessary load. This is only
|
// instead of instant queries, sometimes creating unnecessary load. This is only
|
||||||
// done for Grafana Cloud.
|
// done for Grafana Cloud.
|
||||||
if lokiRangeToInstantEnabled {
|
|
||||||
if indices, migratable := canBeInstant(rule); migratable {
|
if indices, migratable := canBeInstant(rule); migratable {
|
||||||
if err := migrateToInstant(rule, indices); err != nil {
|
if err := migrateToInstant(rule, indices); err != nil {
|
||||||
st.Logger.Error("Could not migrate rule from range to instant query", "rule", rule.UID, "err", err)
|
st.Logger.Error("Could not migrate rule from range to instant query", "rule", rule.UID, "err", err)
|
||||||
@ -561,7 +558,6 @@ func (st DBstore) GetAlertRulesForScheduling(ctx context.Context, query *ngmodel
|
|||||||
st.Logger.Info("Migrated rule from range to instant query", "rule", rule.UID, "migrated_queries", len(indices))
|
st.Logger.Info("Migrated rule from range to instant query", "rule", rule.UID, "migrated_queries", len(indices))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
rules = append(rules, rule)
|
rules = append(rules, rule)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user