[v10.4.x] Annotations: Improve query performance when using dashboard filter (#83404)

Annotations: Improve query performance when using dashboard filter (#83112)

* Annotations: Improve query performance when using dashboard filter

* Add dashboard id filter

(cherry picked from commit e7a1ecca28)

Co-authored-by: Alexander Zobnin <alexanderzobnin@gmail.com>
This commit is contained in:
grafana-delivery-bot[bot]
2024-02-27 17:02:07 +01:00
committed by GitHub
co-authored by Alexander Zobnin
parent 8290d41f4b
commit ff860eb5d0
3 changed files with 22 additions and 8 deletions
@@ -5,15 +5,17 @@ import (
"fmt"
"testing"
"github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/components/simplejson"
"github.com/grafana/grafana/pkg/infra/db"
"github.com/grafana/grafana/pkg/services/accesscontrol"
"github.com/grafana/grafana/pkg/services/annotations"
"github.com/grafana/grafana/pkg/services/annotations/testutil"
"github.com/grafana/grafana/pkg/services/dashboards"
"github.com/grafana/grafana/pkg/services/featuremgmt"
"github.com/grafana/grafana/pkg/services/user"
"github.com/grafana/grafana/pkg/tests/testsuite"
"github.com/stretchr/testify/require"
)
func TestMain(m *testing.M) {
@@ -173,7 +175,8 @@ func TestIntegrationAuthorize(t *testing.T) {
authz := NewAuthService(sql, featuremgmt.WithFeatures(tc.featureToggle))
resources, err := authz.Authorize(context.Background(), 1, u)
query := &annotations.ItemQuery{SignedInUser: u}
resources, err := authz.Authorize(context.Background(), 1, query)
require.NoError(t, err)
if tc.expectedResources.Dashboards != nil {