prom

package
Version: v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2022 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Overview

Package prom provides custom handlers that support the prometheus query endpoints.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyRangeWarnings added in v0.15.16

func ApplyRangeWarnings(
	query string, meta *block.ResultMetadata,
) error

ApplyRangeWarnings applies warnings encountered during execution.

func NewReadHandler

func NewReadHandler(hOpts options.HandlerOptions, options ...Option) (http.Handler, error)

NewReadHandler creates a handler to handle PromQL requests.

func Respond added in v1.0.1

func Respond(w http.ResponseWriter, data interface{}, warnings promstorage.Warnings) error

Respond responds with HTTP OK status code and writes response JSON to response body.

Types

type NewQueryFn added in v1.0.1

type NewQueryFn func(params models.RequestParams) (promql.Query, error)

NewQueryFn creates a new promql Query.

type Option added in v1.0.1

type Option func(*opts) error

Option is a Prometheus handler option.

func WithEngine added in v1.0.1

func WithEngine(promQLEngineFn options.PromQLEngineFn) Option

WithEngine sets the PromQL engine.

func WithInstantEngine added in v1.0.1

func WithInstantEngine(promQLEngineFn options.PromQLEngineFn) Option

WithInstantEngine sets the PromQL instant engine.

type QueryData added in v1.0.1

type QueryData struct {
	ResultType promql.ValueType `json:"resultType"`
	Result     promql.Value     `json:"result"`
}

QueryData struct to be used when responding from HTTP handler.

Jump to

Keyboard shortcuts

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