Documentation ¶
Overview ¶
Package tsdbexec is the top level package for serving tsdb requests. Each function in this package corresponds to a TSDB API call. Each function takes a request value along with scotty datastructures as parameters and returns a response value along with an error.
Index ¶
- Variables
- func NewHandler(handlerFunc interface{}) http.Handler
- func Query(request *tsdbjson.QueryRequest, endpoints *machine.EndpointStore, ...) (result []tsdbjson.TimeSeries, err error)
- func RunParsedQueries(requests []tsdbjson.ParsedQuery, endpoints *machine.EndpointStore, ...) ([]*tsdb.TaggedTimeSeriesSet, error)
- func Suggest(params url.Values, suggesterMap map[string]suggest.Suggester) (result []string, err error)
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func NewHandler ¶
NewHandler creates a handler to service a particular TSDB API endpoint.
The parameter, handlerFunc, is a function that handles the API requests to the endpoint. handlerFunc must be a function that takes one parameter, the input to the API, and returns 2 values, the output and error.
If the handlerFunc parameter is a slice, map, or pointer to a struct, the returned handler will translate the input stream into a value that can be passed to handlerFunc using the encoding/json package.
If the handlerFunc parameter is a url.Values type, the returned handler will pass the URL parameters of the API request to handlerFunc.
The returned handler sends the value that handlerFunc returns as JSON by encoding it using the encoding/JSON package. If handlerFunc returns a non-nil error, the returned handler sends appropriate JSON for the error along with a 400 status code.
func Query ¶
func Query( request *tsdbjson.QueryRequest, endpoints *machine.EndpointStore, minDownSampleTime time.Duration) ( result []tsdbjson.TimeSeries, err error)
Query corresponds to the /api/query TSDB API call.
func RunParsedQueries ¶
func RunParsedQueries( requests []tsdbjson.ParsedQuery, endpoints *machine.EndpointStore, minDownSampleTime time.Duration) ( []*tsdb.TaggedTimeSeriesSet, error)
RunParsedQueries works like Query except that it accepts a slice of tsdbjson.ParseQuery instances and returns a slice of tsdb.TaggedTimeSeriesSet instances. This metod can be used to support other protocols such as influx db. The indexes in the returned slice match the indexes of the requests slice. In particular an element of the returned slice will be nil if the corresponding element in the requests slice yields no results.
Types ¶
This section is empty.