Documentation ¶
Overview ¶
Package clickhouse provides the ClickHouse origin type
Index ¶
- func ErrNotEnoughFields(count int) 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) FastForwardURL(r *http.Request) (*url.URL, 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) 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) 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 DataSet
- type FieldDefinition
- type Point
- type Points
- type Response
- type ResponseValue
- type ResultsEnvelope
- func (re *ResultsEnvelope) Clone() timeseries.Timeseries
- func (re *ResultsEnvelope) CropToRange(e timeseries.Extent)
- func (re *ResultsEnvelope) CropToSize(sz int, t time.Time, lur timeseries.Extent)
- func (re *ResultsEnvelope) Extents() timeseries.ExtentList
- func (re ResultsEnvelope) MarshalJSON() ([]byte, error)
- func (re *ResultsEnvelope) Merge(sort bool, collection ...timeseries.Timeseries)
- func (re *ResultsEnvelope) SeriesCount() int
- func (re *ResultsEnvelope) SetExtents(extents timeseries.ExtentList)
- func (re *ResultsEnvelope) SetStep(step time.Duration)
- func (re *ResultsEnvelope) Size() int
- func (re *ResultsEnvelope) Sort()
- func (re *ResultsEnvelope) Step() time.Duration
- func (re *ResultsEnvelope) TimestampCount() int
- func (re *ResultsEnvelope) UnmarshalJSON(b []byte) error
- func (re *ResultsEnvelope) ValueCount() int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrNotEnoughFields ¶
ErrNotEnoughFields returns an error when there are too few number of fields
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client Implements the Proxy Client Interface
func NewClient ¶
func NewClient(name string, oc *oo.Options, router http.Handler, cache cache.Cache) (*Client, error)
NewClient returns a new Client Instance
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) FastForwardURL ¶
FastForwardURL is not used for ClickHouse and is here to conform to the Proxy Client interface
func (*Client) HTTPClient ¶
HTTPClient returns the HTTP Transport the client is using
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) 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 InfluxDB API calls
func (*Client) QueryHandler ¶
func (c *Client) QueryHandler(w http.ResponseWriter, r *http.Request)
QueryHandler handles timeseries requests for ClickHouse and processes them through the delta proxy cache
func (*Client) QueryRangeHandler ¶
func (c *Client) QueryRangeHandler(w http.ResponseWriter, r *http.Request)
QueryRangeHandler is not used for ClickHouse and is here to conform to the Proxy Client interface
func (*Client) Router ¶
Router returns the http.Handler that handles request routing for this Client
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 is not used for ClickHouse and is here to conform to the Proxy Client interface
func (*Client) UnmarshalTimeseries ¶
func (c *Client) UnmarshalTimeseries(data []byte) (timeseries.Timeseries, error)
UnmarshalTimeseries converts a JSON blob into a Timeseries
type FieldDefinition ¶
FieldDefinition ...
type Points ¶
type Points []Point
Points ...
type Response ¶
type Response struct { Meta []FieldDefinition `json:"meta"` RawData []ResponseValue `json:"data"` Rows int `json:"rows"` Order []string `json:"-"` StepDuration time.Duration `json:"step,omitempty"` ExtentList timeseries.ExtentList `json:"extents,omitempty"` }
Response is the JSON responose document structure for ClickHouse query results
type ResponseValue ¶
type ResponseValue map[string]interface{}
ResponseValue ...
func (ResponseValue) Parts ¶
func (rv ResponseValue) Parts(timeKey, valKey string) (string, time.Time, float64, ResponseValue)
Parts ...
type ResultsEnvelope ¶
type ResultsEnvelope struct { Meta []FieldDefinition `json:"meta"` Data map[string]*DataSet `json:"data"` StepDuration time.Duration `json:"step,omitempty"` ExtentList timeseries.ExtentList `json:"extents,omitempty"` Serializers map[string]func(interface{}) `json:"-"` SeriesOrder []string `json:"series_order,omitempty"` // contains filtered or unexported fields }
ResultsEnvelope is the ClickHouse document structure optimized for time series manipulation
func (*ResultsEnvelope) Clone ¶
func (re *ResultsEnvelope) Clone() timeseries.Timeseries
Clone returns a perfect copy of the base Timeseries
func (*ResultsEnvelope) CropToRange ¶
func (re *ResultsEnvelope) 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 (*ResultsEnvelope) CropToSize ¶
func (re *ResultsEnvelope) 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 (*ResultsEnvelope) Extents ¶
func (re *ResultsEnvelope) Extents() timeseries.ExtentList
Extents returns the Timeseries's ExentList
func (ResultsEnvelope) MarshalJSON ¶
func (re ResultsEnvelope) MarshalJSON() ([]byte, error)
MarshalJSON ...
func (*ResultsEnvelope) Merge ¶
func (re *ResultsEnvelope) 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 (*ResultsEnvelope) SeriesCount ¶
func (re *ResultsEnvelope) SeriesCount() int
SeriesCount returns the number of individual Series in the Timeseries object
func (*ResultsEnvelope) SetExtents ¶
func (re *ResultsEnvelope) SetExtents(extents timeseries.ExtentList)
SetExtents overwrites a Timeseries's known extents with the provided extent list
func (*ResultsEnvelope) SetStep ¶
func (re *ResultsEnvelope) SetStep(step time.Duration)
SetStep sets the step for the Timeseries
func (*ResultsEnvelope) Size ¶
func (re *ResultsEnvelope) Size() int
Size returns the approximate memory utilization in bytes of the timeseries
func (*ResultsEnvelope) Sort ¶
func (re *ResultsEnvelope) Sort()
Sort sorts all Values in each Series chronologically by their timestamp
func (*ResultsEnvelope) Step ¶
func (re *ResultsEnvelope) Step() time.Duration
Step returns the step for the Timeseries
func (*ResultsEnvelope) TimestampCount ¶
func (re *ResultsEnvelope) TimestampCount() int
TimestampCount returns the number of unique timestamps across the timeseries
func (*ResultsEnvelope) UnmarshalJSON ¶
func (re *ResultsEnvelope) UnmarshalJSON(b []byte) error
UnmarshalJSON ...
func (*ResultsEnvelope) ValueCount ¶
func (re *ResultsEnvelope) ValueCount() int
ValueCount returns the count of all values across all Series in the Timeseries object