Expressions: use datasource model from the query (#41376)

* refactor datasource loading

* refactor datasource loading

* pass uid

* use dscache in alerting to get DS

* remove expr/translate pacakge

* remove dup injection entry

* fix DS type on metrics endpoint, remove SQL DS lookup inside SSE

* update test and adapter

* comment fix

* Make eval run as admin when getting datasource info

Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>

* fmt and comment

* remove unncessary/redundant code

Co-authored-by: Kyle Brandt <kyle@grafana.com>
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
Co-authored-by: Santiago <santiagohernandez.1997@gmail.com>
This commit is contained in:
Ryan McKinley
2021-12-16 13:51:46 -03:00
committed by GitHub
co-authored by Marcus Efraimsson Kyle Brandt Santiago
parent 1745cd8186
commit 2754e4fdf0
15 changed files with 119 additions and 1088 deletions
+1 -4
View File
@@ -87,10 +87,7 @@ func (s *Service) handleExpressions(ctx context.Context, user *models.SignedInUs
RefID: pq.query.RefID,
MaxDataPoints: pq.query.MaxDataPoints,
QueryType: pq.query.QueryType,
Datasource: expr.DataSourceRef{
Type: pq.datasource.Type,
UID: pq.datasource.Uid,
},
DataSource: pq.datasource,
TimeRange: expr.TimeRange{
From: pq.query.TimeRange.From,
To: pq.query.TimeRange.To,