Documentation ¶
Index ¶
- func NewRulesHandler(client rules.UnaryClient, enablePartialResponse bool) func(*http.Request) (interface{}, []error, *ApiError)
- func Respond(w http.ResponseWriter, data interface{}, warnings []error)
- func RespondError(w http.ResponseWriter, apiErr *ApiError, data interface{})
- func SetCORS(w http.ResponseWriter)
- type API
- type ApiError
- type ApiFunc
- type ErrorType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewRulesHandler ¶ added in v0.14.0
func NewRulesHandler(client rules.UnaryClient, enablePartialResponse bool) func(*http.Request) (interface{}, []error, *ApiError)
NewRulesHandler created handler compatible with HTTP /api/v1/rules https://prometheus.io/docs/prometheus/latest/querying/api/#rules which uses gRPC Unary Rules API.
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{})
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, storeSet *query.StoreSet, qe *promql.Engine, c query.QueryableCreator, ruleGroups rules.UnaryClient, enableAutodownsampling bool, enableQueryPartialResponse bool, enableRulePartialResponse bool, replicaLabels []string, flagsMap map[string]string, defaultInstantQueryMaxSourceResolution time.Duration, maxConcurrentQueries int, ) *API
NewAPI returns an initialized API type.
func (*API) Register ¶
func (api *API) Register(r *route.Router, tracer opentracing.Tracer, logger log.Logger, ins extpromhttp.InstrumentationMiddleware)
Register the API's endpoints in the given router.
Click to show internal directories.
Click to hide internal directories.