Documentation ¶
Overview ¶
Package prometheus provides the Prometheus Origin Type
Index ¶
- Constants
- func NewClient(name string, oc *oo.Options, router http.Handler, cache cache.Cache) (origins.Client, error)
- type Client
- func (c *Client) Cache() cache.Cache
- func (c *Client) Configuration() *oo.Options
- func (c *Client) DefaultPathConfigs(oc *oo.Options) map[string]*po.Options
- func (c *Client) FastForwardRequest(r *http.Request) (*http.Request, error)
- func (c *Client) HTTPClient() *http.Client
- func (c *Client) Handlers() map[string]http.Handler
- func (c *Client) HealthHandler(w http.ResponseWriter, r *http.Request)
- func (c *Client) MarshalTimeseries(ts timeseries.Timeseries) ([]byte, error)
- func (c *Client) Name() string
- func (c *Client) ObjectProxyCacheHandler(w http.ResponseWriter, r *http.Request)
- func (c *Client) ParseTimeRangeQuery(r *http.Request) (*timeseries.TimeRangeQuery, error)
- 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) Router() http.Handler
- func (c *Client) SeriesHandler(w http.ResponseWriter, r *http.Request)
- func (c *Client) SetCache(cc cache.Cache)
- func (c *Client) SetExtent(r *http.Request, trq *timeseries.TimeRangeQuery, extent *timeseries.Extent)
- func (c *Client) UnmarshalInstantaneous(data []byte) (timeseries.Timeseries, error)
- func (c *Client) UnmarshalTimeseries(data []byte) (timeseries.Timeseries, error)
- type MatrixData
- type MatrixEnvelope
- func (me *MatrixEnvelope) Clone() timeseries.Timeseries
- func (me *MatrixEnvelope) CropToRange(e timeseries.Extent)
- func (me *MatrixEnvelope) CropToSize(sz int, t time.Time, lur timeseries.Extent)
- func (me *MatrixEnvelope) Extents() timeseries.ExtentList
- func (me *MatrixEnvelope) Merge(sort bool, collection ...timeseries.Timeseries)
- func (me *MatrixEnvelope) SeriesCount() int
- func (me *MatrixEnvelope) SetExtents(extents timeseries.ExtentList)
- func (me *MatrixEnvelope) SetStep(step time.Duration)
- func (me *MatrixEnvelope) Size() int
- func (me *MatrixEnvelope) Sort()
- func (me *MatrixEnvelope) Step() time.Duration
- func (me *MatrixEnvelope) TimestampCount() int
- func (me *MatrixEnvelope) ValueCount() int
- type VectorData
- type VectorEnvelope
Constants ¶
const (
APIPath = "/api/v1/"
)
Prometheus API
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client Implements Proxy Client Interface
func (*Client) Configuration ¶
Configuration returns the upstream Configuration for this Client
func (*Client) DefaultPathConfigs ¶
DefaultPathConfigs returns the default PathConfigs for the given OriginType
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) HTTPClient ¶
HTTPClient returns the HTTP Client for this origin
func (*Client) HealthHandler ¶
func (c *Client) HealthHandler(w http.ResponseWriter, r *http.Request)
HealthHandler checks the health of the Configured Upstream Origin
func (*Client) MarshalTimeseries ¶
func (c *Client) MarshalTimeseries(ts timeseries.Timeseries) ([]byte, error)
MarshalTimeseries converts a Timeseries into a JSON blob
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, error)
ParseTimeRangeQuery parses the key parts of a TimeRangeQuery from the inbound HTTP Request
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) Router ¶
Router returns the http.Handler that handles request routing for this Client
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) SetCache ¶
SetCache sets the Cache object the client will use for caching origin content
func (*Client) SetExtent ¶
func (c *Client) SetExtent(r *http.Request, trq *timeseries.TimeRangeQuery, extent *timeseries.Extent)
SetExtent will change the upstream request query to use the provided Extent
func (*Client) UnmarshalInstantaneous ¶
func (c *Client) UnmarshalInstantaneous(data []byte) (timeseries.Timeseries, error)
UnmarshalInstantaneous converts a JSON blob into an Instantaneous Data Point
func (*Client) UnmarshalTimeseries ¶
func (c *Client) UnmarshalTimeseries(data []byte) (timeseries.Timeseries, error)
UnmarshalTimeseries converts a JSON blob into a Timeseries
type MatrixData ¶
type MatrixData struct { ResultType string `json:"resultType"` Result model.Matrix `json:"result"` }
MatrixData represents the Data body of a Matrix response object from the Prometheus HTTP API
type MatrixEnvelope ¶
type MatrixEnvelope struct { Status string `json:"status"` Data MatrixData `json:"data"` ExtentList timeseries.ExtentList `json:"extents,omitempty"` StepDuration time.Duration `json:"step,omitempty"` // contains filtered or unexported fields }
MatrixEnvelope represents a Matrix response object from the Prometheus HTTP API
func (*MatrixEnvelope) Clone ¶
func (me *MatrixEnvelope) Clone() timeseries.Timeseries
Clone returns a perfect copy of the base Timeseries
func (*MatrixEnvelope) CropToRange ¶
func (me *MatrixEnvelope) CropToRange(e timeseries.Extent)
CropToRange reduces the Timeseries down to timestamps contained within the provided Extents (inclusive). CropToRange assumes the base Timeseries is already sorted, and will corrupt an unsorted Timeseries
func (*MatrixEnvelope) CropToSize ¶
func (me *MatrixEnvelope) CropToSize(sz int, t time.Time, lur timeseries.Extent)
CropToSize reduces the number of elements in the Timeseries to the provided count, by evicting elements using a least-recently-used methodology. Any timestamps newer than the provided time are removed before sizing, in order to support backfill tolerance. The provided extent will be marked as used during crop.
func (*MatrixEnvelope) Extents ¶
func (me *MatrixEnvelope) Extents() timeseries.ExtentList
Extents returns the Timeseries's ExentList
func (*MatrixEnvelope) Merge ¶
func (me *MatrixEnvelope) Merge(sort bool, collection ...timeseries.Timeseries)
Merge merges the provided Timeseries list into the base Timeseries (in the order provided) and optionally sorts the merged Timeseries
func (*MatrixEnvelope) SeriesCount ¶
func (me *MatrixEnvelope) SeriesCount() int
SeriesCount returns the number of individual Series in the Timeseries object
func (*MatrixEnvelope) SetExtents ¶
func (me *MatrixEnvelope) SetExtents(extents timeseries.ExtentList)
SetExtents overwrites a Timeseries's known extents with the provided extent list
func (*MatrixEnvelope) SetStep ¶
func (me *MatrixEnvelope) SetStep(step time.Duration)
SetStep sets the step for the Timeseries
func (*MatrixEnvelope) Size ¶
func (me *MatrixEnvelope) Size() int
Size returns the approximate memory utilization in bytes of the timeseries
func (*MatrixEnvelope) Sort ¶
func (me *MatrixEnvelope) Sort()
Sort sorts all Values in each Series chronologically by their timestamp
func (*MatrixEnvelope) Step ¶
func (me *MatrixEnvelope) Step() time.Duration
Step returns the step for the Timeseries
func (*MatrixEnvelope) TimestampCount ¶
func (me *MatrixEnvelope) TimestampCount() int
TimestampCount returns the number of unique timestamps across the timeseries
func (*MatrixEnvelope) ValueCount ¶
func (me *MatrixEnvelope) ValueCount() int
ValueCount returns the count of all values across all Series in the Timeseries object
type VectorData ¶
type VectorData struct { ResultType string `json:"resultType"` Result model.Vector `json:"result"` }
VectorData represents the Data body of a Vector response object from the Prometheus HTTP API
type VectorEnvelope ¶
type VectorEnvelope struct { Status string `json:"status"` Data VectorData `json:"data"` }
VectorEnvelope represents a Vector response object from the Prometheus HTTP API
func (*VectorEnvelope) ToMatrix ¶
func (ve *VectorEnvelope) ToMatrix() *MatrixEnvelope
ToMatrix converts a VectorEnvelope to a MatrixEnvelope