mirror of
https://github.com/grafana/grafana.git
synced 2026-08-18 17:15:08 -05:00
Chore: Refactor usage of legacy data contracts (#41218)
Refactor usage of legacy data contracts. Moves legacy data contracts to pkg/tsdb/legacydata package. Refactor pkg/expr to be a proper service/dependency that can be provided to wire to remove some unneeded dependencies to SSE in ngalert and other places. Refactor pkg/expr to not use the legacydata,RequestHandler and use backend.QueryDataHandler instead.
This commit is contained in:
+14
-4
@@ -7,6 +7,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/components/simplejson"
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
"github.com/grafana/grafana/pkg/plugins"
|
||||
"github.com/grafana/grafana/pkg/services/encryption"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
)
|
||||
|
||||
@@ -35,15 +36,24 @@ func IsDataSource(uid string) bool {
|
||||
|
||||
// Service is service representation for expression handling.
|
||||
type Service struct {
|
||||
Cfg *setting.Cfg
|
||||
DataService plugins.DataRequestHandler
|
||||
cfg *setting.Cfg
|
||||
dataService backend.QueryDataHandler
|
||||
encryptionService encryption.Service
|
||||
}
|
||||
|
||||
func ProvideService(cfg *setting.Cfg, pluginClient plugins.Client, encryptionService encryption.Service) *Service {
|
||||
return &Service{
|
||||
cfg: cfg,
|
||||
dataService: pluginClient,
|
||||
encryptionService: encryptionService,
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Service) isDisabled() bool {
|
||||
if s.Cfg == nil {
|
||||
if s.cfg == nil {
|
||||
return true
|
||||
}
|
||||
return !s.Cfg.ExpressionsEnabled
|
||||
return !s.cfg.ExpressionsEnabled
|
||||
}
|
||||
|
||||
// BuildPipeline builds a pipeline from a request.
|
||||
|
||||
Reference in New Issue
Block a user