4e050267c7
* enable linting rules for opentsdb * remove core imports * update plugin.json * write backend standalone files * remove frontend core imports * add yarn workspace * remove core import for the plugin * update grafana dependency * update package.json * add jest config
29 lines
748 B
Go
29 lines
748 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/grafana/grafana-plugin-sdk-go/backend"
|
|
"github.com/grafana/grafana-plugin-sdk-go/backend/httpclient"
|
|
"github.com/grafana/grafana-plugin-sdk-go/backend/instancemgmt"
|
|
opentsdb "github.com/grafana/grafana/pkg/tsdb/opentsdb"
|
|
)
|
|
|
|
var (
|
|
_ backend.QueryDataHandler = (*Datasource)(nil)
|
|
)
|
|
|
|
type Datasource struct {
|
|
Service *opentsdb.Service
|
|
}
|
|
|
|
func NewDatasource(context.Context, backend.DataSourceInstanceSettings) (instancemgmt.Instance, error) {
|
|
return &Datasource{
|
|
Service: opentsdb.ProvideService(httpclient.NewProvider()),
|
|
}, nil
|
|
}
|
|
|
|
func (d *Datasource) QueryData(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error) {
|
|
return d.Service.QueryData(ctx, req)
|
|
}
|