TSDB: add deprecation comments to many tsdb structs (#33281)

This commit is contained in:
Ryan McKinley
2021-04-23 03:03:11 +02:00
committed by GitHub
parent aa5bdff97d
commit 7627b55ef4
44 changed files with 124 additions and 12 deletions
@@ -43,6 +43,7 @@ func (cp *corePlugin) Logger() log.Logger {
return cp.logger
}
//nolint: staticcheck // plugins.DataResponse deprecated
func (cp *corePlugin) DataQuery(ctx context.Context, dsInfo *models.DataSource,
tsdbQuery plugins.DataQuery) (plugins.DataResponse, error) {
// TODO: Inline the adapter, since it shouldn't be necessary
@@ -11,6 +11,7 @@ import (
"github.com/grafana/grafana/pkg/plugins/adapters"
)
// nolint:staticcheck // plugins.DataPlugin deprecated
func newQueryEndpointAdapter(pluginID string, logger log.Logger, handler backend.QueryDataHandler) plugins.DataPlugin {
return &queryEndpointAdapter{
pluginID: pluginID,
@@ -45,6 +46,7 @@ func modelToInstanceSettings(ds *models.DataSource) (*backend.DataSourceInstance
}, nil
}
// nolint:staticcheck // plugins.DataQuery deprecated
func (a *queryEndpointAdapter) DataQuery(ctx context.Context, ds *models.DataSource, query plugins.DataQuery) (
plugins.DataResponse, error) {
instanceSettings, err := modelToInstanceSettings(ds)
@@ -113,6 +113,7 @@ func (m *manager) getAWSEnvironmentVariables() []string {
return variables
}
//nolint: staticcheck // plugins.DataPlugin deprecated
func (m *manager) GetDataPlugin(pluginID string) interface{} {
plugin := m.plugins[pluginID]
if plugin == nil {
+1
View File
@@ -664,6 +664,7 @@ func collectPluginFilesWithin(rootDir string) ([]string, error) {
}
// GetDataPlugin gets a DataPlugin with a certain name. If none is found, nil is returned.
//nolint: staticcheck // plugins.DataPlugin deprecated
func (pm *PluginManager) GetDataPlugin(id string) plugins.DataPlugin {
if p, exists := pm.dataSources[id]; exists && p.CanHandleDataQueries() {
return p
+6 -2
View File
@@ -16,7 +16,7 @@ import (
"github.com/timberio/go-datemath"
)
// DataSubQuery represents a data sub-query.
// DataSubQuery represents a data sub-query. New work should use the plugin SDK.
type DataSubQuery struct {
RefID string `json:"refId"`
Model *simplejson.Json `json:"model,omitempty"`
@@ -26,7 +26,7 @@ type DataSubQuery struct {
QueryType string `json:"queryType"`
}
// DataQuery contains all information about a data query request.
// DataQuery contains all information about a data query request. New work should use the plugin SDK.
type DataQuery struct {
TimeRange *DataTimeRange
Queries []DataSubQuery
@@ -55,6 +55,7 @@ type DataTimeSeriesPoints []DataTimePoint
type DataTimeSeriesSlice []DataTimeSeries
type DataRowValues []interface{}
// Deprecated: DataQueryResult should use backend.QueryDataResponse
type DataQueryResult struct {
Error error `json:"-"`
ErrorString string `json:"error,omitempty"`
@@ -179,12 +180,14 @@ func (r *DataQueryResult) UnmarshalJSON(b []byte) error {
return nil
}
// DataTimeSeries -- this structure is deprecated, all new work should use DataFrames from the SDK
type DataTimeSeries struct {
Name string `json:"name"`
Points DataTimeSeriesPoints `json:"points"`
Tags map[string]string `json:"tags,omitempty"`
}
// Deprecated: DataResponse -- this structure is deprecated, all new work should use backend.QueryDataResponse
type DataResponse struct {
Results map[string]DataQueryResult `json:"results"`
Message string `json:"message,omitempty"`
@@ -228,6 +231,7 @@ func (r DataResponse) ToBackendDataResponse() (*backend.QueryDataResponse, error
return qdr, nil
}
// Deprecated: use the plugin SDK
type DataPlugin interface {
DataQuery(ctx context.Context, ds *models.DataSource, query DataQuery) (DataResponse, error)
}