native

package
v0.0.0-...-9649366 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2019 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CompleteTagsURL is the url for searching tags.
	CompleteTagsURL = handler.RoutePrefixV1 + "/search"

	// CompleteTagsHTTPMethod is the HTTP method used with this resource.
	CompleteTagsHTTPMethod = http.MethodGet
)
View Source
const (
	// PromParseURL is the url for native prom parse handler, this parses out the
	// query and returns a JSON representation of the execution DAG.
	PromParseURL = handler.RoutePrefixV1 + "/parse"

	// PromParseHTTPMethod is the HTTP method used with this resource.
	PromParseHTTPMethod = http.MethodGet
)
View Source
const (
	// PromThresholdURL is the url for native prom threshold handler, this  parses
	// out the  query and returns a JSON representation of the execution DAG.
	PromThresholdURL = handler.RoutePrefixV1 + "/threshold"

	// PromThresholdHTTPMethod is the HTTP method used with this resource.
	PromThresholdHTTPMethod = http.MethodGet
)
View Source
const (
	// PromReadURL is the url for native prom read handler, this matches the
	// default URL for the query range endpoint found on a Prometheus server
	PromReadURL = handler.RoutePrefixV1 + "/query_range"

	// PromReadHTTPMethod is the HTTP method used with this resource.
	PromReadHTTPMethod = http.MethodGet
)
View Source
const (
	// PromReadInstantURL is the url for native instantaneous prom read
	// handler, this matches the  default URL for the query endpoint
	// found on a Prometheus server
	PromReadInstantURL = handler.RoutePrefixV1 + "/query"

	// PromReadInstantHTTPMethod is the HTTP method used with this resource.
	PromReadInstantHTTPMethod = http.MethodGet
)
View Source
const (
	// ListTagsURL is the url for listing tags.
	ListTagsURL = handler.RoutePrefixV1 + "/labels"
)

Variables

View Source
var (
	// ListTagsHTTPMethods are the HTTP methods used with this resource.
	ListTagsHTTPMethods = []string{http.MethodGet, http.MethodPost}
)

Functions

func NewCompleteTagsHandler

func NewCompleteTagsHandler(
	storage storage.Storage,
	fetchOptionsBuilder handler.FetchOptionsBuilder,
	instrumentOpts instrument.Options,
) http.Handler

NewCompleteTagsHandler returns a new instance of handler.

func NewListTagsHandler

func NewListTagsHandler(
	storage storage.Storage,
	fetchOptionsBuilder handler.FetchOptionsBuilder,
	nowFn clock.NowFn,
	instrumentOpts instrument.Options,
) http.Handler

NewListTagsHandler returns a new instance of handler.

func NewPromParseHandler

func NewPromParseHandler(
	instrumentOpts instrument.Options,
) http.Handler

NewPromParseHandler returns a new instance of handler.

func NewPromThresholdHandler

func NewPromThresholdHandler(
	instrumentOpts instrument.Options,
) http.Handler

NewPromThresholdHandler returns a new instance of handler.

Types

type CompleteTagsHandler

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

CompleteTagsHandler represents a handler for search tags endpoint.

func (*CompleteTagsHandler) ServeHTTP

func (h *CompleteTagsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type FunctionNode

type FunctionNode struct {
	// Name is the name of the function node.
	Name string `json:"name,omitempty"`
	// Children are any children this function node has.
	Children []FunctionNode `json:"children,omitempty"`
	// contains filtered or unexported fields
}

FunctionNode is a JSON representation of a function.

func (FunctionNode) QueryRepresentation

func (n FunctionNode) QueryRepresentation() (QueryRepresentation, error)

QueryRepresentation gives the query representation of the function node.

func (FunctionNode) String

func (n FunctionNode) String() string

String prints the string representation of a function node.

type ListTagsHandler

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

ListTagsHandler represents a handler for list tags endpoint.

func (*ListTagsHandler) ServeHTTP

func (h *ListTagsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type PromReadHandler

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

PromReadHandler represents a handler for prometheus read endpoint.

func NewPromReadHandler

func NewPromReadHandler(
	engine executor.Engine,
	fetchOptionsBuilder handler.FetchOptionsBuilder,
	tagOpts models.TagOptions,
	limitsCfg *config.LimitsConfiguration,
	timeoutOpts *prometheus.TimeoutOpts,
	keepNans bool,
	instrumentOpts instrument.Options,
) *PromReadHandler

NewPromReadHandler returns a new instance of handler.

func (*PromReadHandler) ServeHTTP

func (h *PromReadHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*PromReadHandler) ServeHTTPWithEngine

func (h *PromReadHandler) ServeHTTPWithEngine(
	w http.ResponseWriter,
	r *http.Request,
	engine executor.Engine,
	opts *executor.QueryOptions,
	fetchOpts *storage.FetchOptions,
) (ServeResult, *RespError)

ServeHTTPWithEngine returns query results from the storage

type PromReadInstantHandler

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

PromReadInstantHandler represents a handler for prometheus instantaneous read endpoint.

func NewPromReadInstantHandler

func NewPromReadInstantHandler(
	engine executor.Engine,
	fetchOptionsBuilder handler.FetchOptionsBuilder,
	tagOpts models.TagOptions,
	timeoutOpts *prometheus.TimeoutOpts,
	instrumentOpts instrument.Options,
) *PromReadInstantHandler

NewPromReadInstantHandler returns a new instance of handler.

func (*PromReadInstantHandler) ServeHTTP

type QueryRepresentation

type QueryRepresentation struct {
	// Query is the non-threshold part of a query.
	Query FunctionNode `json:"query,omitempty"`
	// Threshold is any detected threshold (top level comparison functions).
	// NB: this is a pointer so it does not have to be present in output if unset.
	Thresold *Threshold `json:"threshold,omitempty"`
}

QueryRepresentation is a JSON representation of a query after attempting to extract any threshold-specific parameters.

NB: this is always presented with the threshold value (if present) as appearing on the right of the query. e.g. `1 > up` will instead be inverted to `up < 1`

type ReadResponse

type ReadResponse struct {
	Results []ts.Series `json:"results,omitempty"`
}

ReadResponse is the response that gets returned to the user

type RespError

type RespError struct {
	Err  error
	Code int
}

RespError wraps error and status code

type ServeResult

type ServeResult struct {
	SeriesList    []*ts.Series
	ExemplarsList ts.SeriesExemplarList
	RequestParams models.RequestParams
}

ServeResult returns the results from a query call.

type Threshold

type Threshold struct {
	// Comparator is the threshold comparator.
	Comparator string `json:"comparator"`
	// Value is the threshold value.
	Value float64 `json:"value"`
}

Threshold is a JSON representation of a threshold, represented by a top level comparison function.

Jump to

Keyboard shortcuts

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