mirror of
https://github.com/grafana/grafana.git
synced 2025-08-06 20:59:35 +08: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:

committed by
GitHub

parent
d6ed5d295e
commit
baab021fec
@ -26,6 +26,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/plugins"
|
||||
"github.com/grafana/grafana/pkg/plugins/backendplugin/coreplugin"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
"github.com/grafana/grafana/pkg/tsdb/legacydata"
|
||||
"github.com/opentracing/opentracing-go"
|
||||
)
|
||||
|
||||
@ -297,7 +298,7 @@ func epochMStoGraphiteTime(tr backend.TimeRange) (string, string) {
|
||||
/**
|
||||
* Graphite should always return timestamp as a number but values might be nil when data is missing
|
||||
*/
|
||||
func parseDataTimePoint(dataTimePoint plugins.DataTimePoint) (time.Time, *float64, error) {
|
||||
func parseDataTimePoint(dataTimePoint legacydata.DataTimePoint) (time.Time, *float64, error) {
|
||||
if !dataTimePoint[1].Valid {
|
||||
return time.Time{}, nil, errors.New("failed to parse data point timestamp")
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
package graphite
|
||||
|
||||
import "github.com/grafana/grafana/pkg/plugins"
|
||||
import "github.com/grafana/grafana/pkg/tsdb/legacydata"
|
||||
|
||||
type TargetResponseDTO struct {
|
||||
Target string `json:"target"`
|
||||
DataPoints plugins.DataTimeSeriesPoints `json:"datapoints"`
|
||||
Target string `json:"target"`
|
||||
DataPoints legacydata.DataTimeSeriesPoints `json:"datapoints"`
|
||||
// Graphite <=1.1.7 may return some tags as numbers requiring extra conversion. See https://github.com/grafana/grafana/issues/37614
|
||||
Tags map[string]interface{} `json:"tags"`
|
||||
}
|
||||
|
Reference in New Issue
Block a user