Correlations: Add usage stats about correlations (#66021)

* Add usage stats about correlations

* Add stats.correlations.count to collected stats

* Expose grafana_stat_totals_correlations metric

* Organize imports
This commit is contained in:
Piotr Jamróz
2023-04-11 08:53:34 +02:00
committed by GitHub
parent b302cc2297
commit b68be999f7
7 changed files with 62 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
package correlationstest
import (
"github.com/grafana/grafana/pkg/api/routing"
"github.com/grafana/grafana/pkg/services/accesscontrol/acimpl"
"github.com/grafana/grafana/pkg/services/correlations"
"github.com/grafana/grafana/pkg/services/datasources"
fakeDatasources "github.com/grafana/grafana/pkg/services/datasources/fakes"
"github.com/grafana/grafana/pkg/services/quota/quotatest"
"github.com/grafana/grafana/pkg/services/sqlstore"
"github.com/grafana/grafana/pkg/setting"
)
func New(sqlStore *sqlstore.SQLStore) *correlations.CorrelationsService {
ds := &fakeDatasources.FakeDataSourceService{
DataSources: []*datasources.DataSource{
{ID: 1, UID: "graphite", Type: datasources.DS_GRAPHITE},
},
}
correlationsSvc, _ := correlations.ProvideService(sqlStore, routing.NewRouteRegister(), ds, acimpl.ProvideAccessControl(setting.NewCfg()), sqlStore.Bus(), quotatest.New(false, nil), sqlStore.Cfg)
return correlationsSvc
}