Introduce TSDB service (#31520)

* Introduce TSDB service

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

Co-authored-by: Erik Sundell <erik.sundell87@gmail.com>
Co-authored-by: Will Browne <will.browne@grafana.com>
Co-authored-by: Torkel Ödegaard <torkel@grafana.org>
Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
Co-authored-by: Zoltán Bedi <zoltan.bedi@gmail.com>
This commit is contained in:
Arve Knudsen
2021-03-08 07:02:49 +01:00
committed by GitHub
co-authored by Erik Sundell Will Browne Torkel Ödegaard Will Browne Zoltán Bedi
parent c899bf3592
commit b79e61656a
203 changed files with 5269 additions and 4776 deletions
+9 -6
View File
@@ -6,6 +6,7 @@ import (
"github.com/grafana/grafana/pkg/components/gtime"
"github.com/grafana/grafana/pkg/setting"
"github.com/grafana/grafana/pkg/tsdb/tsdbifaces"
"github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/infra/log"
@@ -33,9 +34,10 @@ type DashboardProvisioningService interface {
}
// NewService factory for creating a new dashboard service
var NewService = func() DashboardService {
var NewService = func(reqHandler tsdbifaces.RequestHandler) DashboardService {
return &dashboardServiceImpl{
log: log.New("dashboard-service"),
log: log.New("dashboard-service"),
reqHandler: reqHandler,
}
}
@@ -56,9 +58,10 @@ type SaveDashboardDTO struct {
}
type dashboardServiceImpl struct {
orgId int64
user *models.SignedInUser
log log.Logger
orgId int64
user *models.SignedInUser
log log.Logger
reqHandler tsdbifaces.RequestHandler
}
func (dr *dashboardServiceImpl) GetProvisionedDashboardData(name string) ([]*models.DashboardProvisioning, error) {
@@ -386,7 +389,7 @@ func (s *FakeDashboardService) DeleteDashboard(dashboardId int64, orgId int64) e
}
func MockDashboardService(mock *FakeDashboardService) {
NewService = func() DashboardService {
NewService = func(tsdbifaces.RequestHandler) DashboardService {
return mock
}
}