v1

package
v0.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 4, 2019 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorInternal = "internal"
)

Variables

This section is empty.

Functions

func Respond added in v0.3.2

func Respond(w http.ResponseWriter, data interface{}, warnings []error)

func RespondError added in v0.3.2

func RespondError(w http.ResponseWriter, apiErr *ApiError, data interface{})

func SetCORS added in v0.3.2

func SetCORS(w http.ResponseWriter)

Enables cross-site script calls.

Types

type API

type API struct {
	// contains filtered or unexported fields
}

API can register a set of endpoints in a router and handle them using the provided storage and query engine.

func NewAPI

func NewAPI(
	logger log.Logger,
	reg *prometheus.Registry,
	qe *promql.Engine,
	c query.QueryableCreator,
	enableAutodownsampling bool,
	enablePartialResponse bool,
) *API

NewAPI returns an initialized API type.

func (*API) Register

func (api *API) Register(r *route.Router, tracer opentracing.Tracer, logger log.Logger)

Register the API's endpoints in the given router.

type ApiError added in v0.3.2

type ApiError struct {
	Typ ErrorType
	Err error
}

func (*ApiError) Error added in v0.3.2

func (e *ApiError) Error() string

type ApiFunc added in v0.3.2

type ApiFunc func(r *http.Request) (interface{}, []error, *ApiError)

type ErrorType added in v0.3.2

type ErrorType string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL