Documentation
¶
Overview ¶
Package prometheus provides the Prometheus Backend provider
Index ¶
- Constants
- func MergeablePaths() []string
- func NewClient(name string, o *bo.Options, router http.Handler, cache cache.Cache, ...) (backends.Backend, error)
- type Client
- func (c *Client) AlertsHandler(w http.ResponseWriter, r *http.Request)
- func (c *Client) ClassifyMerge(query string) (strategy int, needsDualQuery bool, warning string)
- func (c *Client) DefaultHealthCheckConfig() *ho.Options
- func (c *Client) DefaultPathConfigs(o *bo.Options) po.List
- func (c *Client) FastForwardRequest(r *http.Request) (*http.Request, error)
- func (c *Client) FinalizeTSMMerge(query string, ts timeseries.Timeseries)
- func (c *Client) LabelsHandler(w http.ResponseWriter, r *http.Request)
- func (c *Client) MergeablePaths() []string
- func (c *Client) ObjectProxyCacheHandler(w http.ResponseWriter, r *http.Request)
- func (c *Client) ParseTimeRangeQuery(r *http.Request) (*timeseries.TimeRangeQuery, *timeseries.RequestOptions, bool, error)
- func (c *Client) ProcessTransformations(ts timeseries.Timeseries)
- func (c *Client) ProxyHandler(w http.ResponseWriter, r *http.Request)
- func (c *Client) QueryHandler(w http.ResponseWriter, r *http.Request)
- func (c *Client) QueryRangeHandler(w http.ResponseWriter, r *http.Request)
- func (c *Client) RegisterHandlers(handlers.Lookup)
- func (c *Client) RewriteForTSMMerge(r *http.Request, query string) (*http.Request, string)
- func (c *Client) RewriteForWeightedAvg(r *http.Request, query string) (*http.Request, *http.Request)
- func (c *Client) SeriesHandler(w http.ResponseWriter, r *http.Request)
- func (c *Client) SetExtent(r *http.Request, _ *timeseries.TimeRangeQuery, extent *timeseries.Extent)
- func (c *Client) UnsupportedHandler(w http.ResponseWriter, _ *http.Request)
Constants ¶
const (
APIPath = "/api/v1/"
)
Prometheus API
Variables ¶
This section is empty.
Functions ¶
func MergeablePaths ¶
func MergeablePaths() []string
MergeablePaths returns the list of Prometheus Paths for which Trickster supports merging multiple documents into a single response
Types ¶
type Client ¶
type Client struct {
backends.TimeseriesBackend
// contains filtered or unexported fields
}
Client Implements Proxy Client Interface
func (*Client) AlertsHandler ¶
func (c *Client) AlertsHandler(w http.ResponseWriter, r *http.Request)
AlertsHandler proxies requests for path /alerts to the origin by way of the object proxy cache
func (*Client) ClassifyMerge ¶ added in v2.0.2
ClassifyMerge implements backends.TSMMergeProvider for the Prometheus backend. It inspects the outermost PromQL aggregation operator and returns the merge strategy (as the int value of dataset.MergeStrategy), whether a dual-query weighted average is required, and an optional warning for operators whose results cannot be correctly merged across shards.
func (*Client) DefaultHealthCheckConfig ¶
DefaultHealthCheckConfig returns the default HealthCheck Config for this backend provider
func (*Client) DefaultPathConfigs ¶
DefaultPathConfigs returns the default PathConfigs for the given Provider
func (*Client) FastForwardRequest ¶
FastForwardRequest returns an *http.Request crafted to collect Fast Forward data from the Origin, based on the provided HTTP Request
func (*Client) FinalizeTSMMerge ¶ added in v2.0.3
func (c *Client) FinalizeTSMMerge(query string, ts timeseries.Timeseries)
FinalizeTSMMerge applies Prometheus-only merge finalization after TSM fanout has accumulated the rewritten inner-query responses. The rank step belongs here so topk/bottomk operate on globally merged values, not per-backend ranks.
func (*Client) LabelsHandler ¶
func (c *Client) LabelsHandler(w http.ResponseWriter, r *http.Request)
LabelsHandler proxies requests for path /label and /labels to the origin by way of the object proxy cache
func (*Client) MergeablePaths ¶
MergeablePaths returns the list of Prometheus Paths for which Trickster supports merging multiple documents into a single response
func (*Client) ObjectProxyCacheHandler ¶
func (c *Client) ObjectProxyCacheHandler(w http.ResponseWriter, r *http.Request)
ObjectProxyCacheHandler handles calls to /query (for instantaneous values)
func (*Client) ParseTimeRangeQuery ¶
func (c *Client) ParseTimeRangeQuery(r *http.Request) (*timeseries.TimeRangeQuery, *timeseries.RequestOptions, bool, error, )
ParseTimeRangeQuery parses the key parts of a TimeRangeQuery from the inbound HTTP Request
func (*Client) ProcessTransformations ¶
func (c *Client) ProcessTransformations(ts timeseries.Timeseries)
func (*Client) ProxyHandler ¶
func (c *Client) ProxyHandler(w http.ResponseWriter, r *http.Request)
ProxyHandler sends a request through the basic reverse proxy to the origin, and services non-cacheable Prometheus API calls.
func (*Client) QueryHandler ¶
func (c *Client) QueryHandler(w http.ResponseWriter, r *http.Request)
QueryHandler handles calls to /query (for instantaneous values)
func (*Client) QueryRangeHandler ¶
func (c *Client) QueryRangeHandler(w http.ResponseWriter, r *http.Request)
QueryRangeHandler handles timeseries requests for Prometheus and processes them through the delta proxy cache
func (*Client) RegisterHandlers ¶
func (*Client) RewriteForTSMMerge ¶ added in v2.0.3
RewriteForTSMMerge rewrites Prometheus rank aggregations before TSM fanout. The shards receive the inner query; FinalizeTSMMerge later applies the original topk/bottomk operation to the merged inner result.
func (*Client) RewriteForWeightedAvg ¶ added in v2.0.2
func (c *Client) RewriteForWeightedAvg(r *http.Request, query string) (*http.Request, *http.Request)
RewriteForWeightedAvg implements backends.TSMMergeProvider for the Prometheus backend. It returns two copies of r — one with the outer "avg" aggregator replaced by "sum" and one by "count" — with the rewritten expression injected into the Prometheus "query" parameter. Both GET (query string) and POST (request body) encodings are handled transparently by params.SetRequestValues.
func (*Client) SeriesHandler ¶
func (c *Client) SeriesHandler(w http.ResponseWriter, r *http.Request)
SeriesHandler proxies requests for path /series to the origin by way of the object proxy cache
func (*Client) SetExtent ¶
func (c *Client) SetExtent(r *http.Request, _ *timeseries.TimeRangeQuery, extent *timeseries.Extent, )
SetExtent will change the upstream request query to use the provided Extent
func (*Client) UnsupportedHandler ¶
func (c *Client) UnsupportedHandler(w http.ResponseWriter, _ *http.Request)
UnsupportedHandler responds to endpoints like /api/v1/admin