2016-06-06 03:31:21 -05:00
|
|
|
package tsdb
|
|
|
|
|
2017-03-31 04:45:25 -05:00
|
|
|
import (
|
|
|
|
"context"
|
2017-09-21 11:04:06 -05:00
|
|
|
|
|
|
|
"github.com/grafana/grafana/pkg/models"
|
2017-03-31 04:45:25 -05:00
|
|
|
)
|
2016-07-20 07:28:02 -05:00
|
|
|
|
2017-09-21 11:04:06 -05:00
|
|
|
type HandleRequestFunc func(ctx context.Context, dsInfo *models.DataSource, req *TsdbQuery) (*Response, error)
|
2016-10-03 02:38:03 -05:00
|
|
|
|
2017-09-21 11:04:06 -05:00
|
|
|
func HandleRequest(ctx context.Context, dsInfo *models.DataSource, req *TsdbQuery) (*Response, error) {
|
|
|
|
endpoint, err := getTsdbQueryEndpointFor(dsInfo)
|
2016-06-06 03:31:21 -05:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
2017-09-21 11:04:06 -05:00
|
|
|
return endpoint.Query(ctx, dsInfo, req)
|
2016-06-06 03:31:21 -05:00
|
|
|
}
|