Files
grafana/pkg/tsdb/tempo/standalone/datasource.go
T
Gareth 7bebd62446 Tempo: small refactor to tempo backend (#109581)
* update datasource info struct name

* remove unnecessary abstraction

* update error messages
2025-08-14 10:23:44 +01:00

43 lines
1.3 KiB
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"
tempo "github.com/grafana/grafana/pkg/tsdb/tempo"
)
var (
_ backend.QueryDataHandler = (*Datasource)(nil)
_ backend.StreamHandler = (*Datasource)(nil)
)
type Datasource struct {
Service *tempo.Service
}
func NewDatasource(c context.Context, b backend.DataSourceInstanceSettings) (instancemgmt.Instance, error) {
return &Datasource{
Service: tempo.ProvideService(httpclient.NewProvider()),
}, nil
}
func (d *Datasource) QueryData(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error) {
return d.Service.QueryData(ctx, req)
}
func (d *Datasource) SubscribeStream(ctx context.Context, req *backend.SubscribeStreamRequest) (*backend.SubscribeStreamResponse, error) {
return d.Service.SubscribeStream(ctx, req)
}
func (d *Datasource) PublishStream(ctx context.Context, req *backend.PublishStreamRequest) (*backend.PublishStreamResponse, error) {
return d.Service.PublishStream(ctx, req)
}
func (d *Datasource) RunStream(ctx context.Context, req *backend.RunStreamRequest, sender *backend.StreamSender) error {
return d.Service.RunStream(ctx, req, sender)
}