Documentation ¶
Overview ¶
Package irondb provides proxy origin support for IRONdb databases.
Index ¶
- func NewClient(name string, oc *oo.Options, router http.Handler, cache cache.Cache) (origins.Client, error)
- type Client
- func (c *Client) CAQLHandler(w http.ResponseWriter, r *http.Request)
- 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) FetchHandler(w http.ResponseWriter, r *http.Request)
- func (c *Client) FindHandler(w http.ResponseWriter, r *http.Request)
- 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) HistogramHandler(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) RawHandler(w http.ResponseWriter, r *http.Request)
- func (c *Client) RollupHandler(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) StateHandler(w http.ResponseWriter, r *http.Request)
- func (c *Client) TextHandler(w http.ResponseWriter, r *http.Request)
- func (c Client) UnmarshalInstantaneous(data []byte) (timeseries.Timeseries, error)
- func (c *Client) UnmarshalTimeseries(data []byte) (timeseries.Timeseries, error)
- type DF4Info
- type DF4SeriesEnvelope
- func (se *DF4SeriesEnvelope) Clone() timeseries.Timeseries
- func (se *DF4SeriesEnvelope) CropToRange(e timeseries.Extent)
- func (se *DF4SeriesEnvelope) CropToSize(sz int, t time.Time, lur timeseries.Extent)
- func (se *DF4SeriesEnvelope) Extents() timeseries.ExtentList
- func (se *DF4SeriesEnvelope) Merge(sort bool, collection ...timeseries.Timeseries)
- func (se *DF4SeriesEnvelope) SeriesCount() int
- func (se *DF4SeriesEnvelope) SetExtents(extents timeseries.ExtentList)
- func (se *DF4SeriesEnvelope) SetStep(step time.Duration)
- func (se *DF4SeriesEnvelope) Size() int
- func (se *DF4SeriesEnvelope) Sort()
- func (se *DF4SeriesEnvelope) Step() time.Duration
- func (se *DF4SeriesEnvelope) TimestampCount() int
- func (se *DF4SeriesEnvelope) ValueCount() int
- type DataPoint
- type DataPoints
- type SeriesEnvelope
- func (se *SeriesEnvelope) Clone() timeseries.Timeseries
- func (se *SeriesEnvelope) CropToRange(e timeseries.Extent)
- func (se *SeriesEnvelope) CropToSize(sz int, t time.Time, lur timeseries.Extent)
- func (se *SeriesEnvelope) Extents() timeseries.ExtentList
- func (se *SeriesEnvelope) MarshalJSON() ([]byte, error)
- func (se *SeriesEnvelope) Merge(sort bool, collection ...timeseries.Timeseries)
- func (se *SeriesEnvelope) SeriesCount() int
- func (se *SeriesEnvelope) SetExtents(extents timeseries.ExtentList)
- func (se *SeriesEnvelope) SetStep(step time.Duration)
- func (se *SeriesEnvelope) Size() int
- func (se *SeriesEnvelope) Sort()
- func (se *SeriesEnvelope) Step() time.Duration
- func (se *SeriesEnvelope) TimestampCount() int
- func (se *SeriesEnvelope) UnmarshalJSON(b []byte) error
- func (se *SeriesEnvelope) ValueCount() int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client values provide access to IRONdb and implement the Trickster proxy client interface.
func (*Client) CAQLHandler ¶
func (c *Client) CAQLHandler(w http.ResponseWriter, r *http.Request)
CAQLHandler handles CAQL requests for timeseries data and processes them through the delta proxy cache.
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) FetchHandler ¶
func (c *Client) FetchHandler(w http.ResponseWriter, r *http.Request)
FetchHandler handles requests for numeric timeseries data with specified spans and processes them through the delta proxy cache.
func (*Client) FindHandler ¶
func (c *Client) FindHandler(w http.ResponseWriter, r *http.Request)
FindHandler handles requests to find metirc information and processes them through the object proxy cache.
func (*Client) HTTPClient ¶
HTTPClient returns the HTTP Transport this 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) HistogramHandler ¶
func (c *Client) HistogramHandler(w http.ResponseWriter, r *http.Request)
HistogramHandler handles requests for historgam timeseries data and processes them through the delta proxy cache.
func (*Client) MarshalTimeseries ¶
func (c *Client) MarshalTimeseries(ts timeseries.Timeseries) ([]byte, error)
MarshalTimeseries converts a Timeseries into a JSON blob for cache storage.
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 for non-cacheable API calls.
func (*Client) RawHandler ¶
func (c *Client) RawHandler(w http.ResponseWriter, r *http.Request)
RawHandler handles requests for raw numeric timeseries data and processes them through the delta proxy cache.
func (*Client) RollupHandler ¶
func (c *Client) RollupHandler(w http.ResponseWriter, r *http.Request)
RollupHandler handles requests for numeric timeseries data with specified spans 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) 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) StateHandler ¶
func (c *Client) StateHandler(w http.ResponseWriter, r *http.Request)
StateHandler handles requests for state data and processes them through the basic reverse proxy to the origin for non-cacheable API calls.
func (*Client) TextHandler ¶
func (c *Client) TextHandler(w http.ResponseWriter, r *http.Request)
TextHandler handles requests for text timeseries data and processes them through the delta proxy cache.
func (Client) UnmarshalInstantaneous ¶
func (c Client) UnmarshalInstantaneous( data []byte) (timeseries.Timeseries, error)
UnmarshalInstantaneous is not used for IRONdb origins and is here to conform to the Client interface.
func (*Client) UnmarshalTimeseries ¶
func (c *Client) UnmarshalTimeseries(data []byte) (timeseries.Timeseries, error)
UnmarshalTimeseries converts a JSON blob into a Timeseries value.
type DF4Info ¶
type DF4Info struct { Count int64 `json:"count"` Start int64 `json:"start"` Period int64 `json:"period"` }
DF4Info values contain information about the timestamps of the data elements in DF4 data series.
type DF4SeriesEnvelope ¶
type DF4SeriesEnvelope struct { Data [][]interface{} `json:"data"` Meta []map[string]interface{} `json:"meta,omitempty"` Ver string `json:"version,omitempty"` Head DF4Info `json:"head"` StepDuration time.Duration `json:"step,omitempty"` ExtentList timeseries.ExtentList `json:"extents,omitempty"` }
DF4SeriesEnvelope values represent DF4 format time series data from the IRONdb API.
func (*DF4SeriesEnvelope) Clone ¶
func (se *DF4SeriesEnvelope) Clone() timeseries.Timeseries
Clone returns a perfect copy of the base Timeseries.
func (*DF4SeriesEnvelope) CropToRange ¶
func (se *DF4SeriesEnvelope) CropToRange(e timeseries.Extent)
CropToRange crops down a Timeseries value to the provided Extent. Crop assumes the base Timeseries is already sorted, and will corrupt an unsorted Timeseries.
func (*DF4SeriesEnvelope) CropToSize ¶
func (se *DF4SeriesEnvelope) 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 (*DF4SeriesEnvelope) Extents ¶
func (se *DF4SeriesEnvelope) Extents() timeseries.ExtentList
Extents returns the Timeseries's extent list.
func (*DF4SeriesEnvelope) Merge ¶
func (se *DF4SeriesEnvelope) 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 (*DF4SeriesEnvelope) SeriesCount ¶
func (se *DF4SeriesEnvelope) SeriesCount() int
SeriesCount returns the number of individual series in the Timeseries value.
func (*DF4SeriesEnvelope) SetExtents ¶
func (se *DF4SeriesEnvelope) SetExtents(extents timeseries.ExtentList)
SetExtents overwrites a Timeseries's known extents with the provided extent list.
func (*DF4SeriesEnvelope) SetStep ¶
func (se *DF4SeriesEnvelope) SetStep(step time.Duration)
SetStep sets the step for the Timeseries.
func (*DF4SeriesEnvelope) Size ¶
func (se *DF4SeriesEnvelope) Size() int
Size returns the approximate memory utilization in bytes of the timeseries
func (*DF4SeriesEnvelope) Sort ¶
func (se *DF4SeriesEnvelope) Sort()
Sort sorts all data in the Timeseries chronologically by their timestamp.
func (*DF4SeriesEnvelope) Step ¶
func (se *DF4SeriesEnvelope) Step() time.Duration
Step returns the step for the Timeseries.
func (*DF4SeriesEnvelope) TimestampCount ¶
func (se *DF4SeriesEnvelope) TimestampCount() int
TimestampCount returns the number of unique timestamps across the timeseries.
func (*DF4SeriesEnvelope) ValueCount ¶
func (se *DF4SeriesEnvelope) ValueCount() int
ValueCount returns the count of all data values across all Series in the Timeseries value.
type DataPoint ¶
DataPoint values represent a single data element of a time series data response from the IRONdb API.
func (*DataPoint) MarshalJSON ¶
MarshalJSON encodes a data point value into a JSON byte slice.
func (*DataPoint) UnmarshalJSON ¶
UnmarshalJSON decodes a JSON byte slice into this data point value.
type DataPoints ¶
type DataPoints []DataPoint
DataPoints values represent sortable slices of data point values.
func (DataPoints) Len ¶
func (dps DataPoints) Len() int
Len returns the length of an array of Prometheus model.Times
func (DataPoints) Less ¶
func (dps DataPoints) Less(i, j int) bool
Less returns true if the value at index i comes before the value at index j.
func (DataPoints) Swap ¶
func (dps DataPoints) Swap(i, j int)
Swap modifies a slice of data tuples by swapping the values in indexes i and j.
type SeriesEnvelope ¶
type SeriesEnvelope struct { Data DataPoints `json:"data"` ExtentList timeseries.ExtentList `json:"extents,omitempty"` StepDuration time.Duration `json:"step,omitempty"` }
SeriesEnvelope values represent a time series data response from the IRONdb API.
func (*SeriesEnvelope) Clone ¶
func (se *SeriesEnvelope) Clone() timeseries.Timeseries
Clone returns a perfect copy of the base Timeseries.
func (*SeriesEnvelope) CropToRange ¶
func (se *SeriesEnvelope) CropToRange(e timeseries.Extent)
CropToRange crops down a Timeseries value to the provided Extent. Crop assumes the base Timeseries is already sorted, and will corrupt an unsorted Timeseries.
func (*SeriesEnvelope) CropToSize ¶
func (se *SeriesEnvelope) 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 (*SeriesEnvelope) Extents ¶
func (se *SeriesEnvelope) Extents() timeseries.ExtentList
Extents returns the Timeseries's extent list.
func (*SeriesEnvelope) MarshalJSON ¶
func (se *SeriesEnvelope) MarshalJSON() ([]byte, error)
MarshalJSON encodes a series envelope value into a JSON byte slice.
func (*SeriesEnvelope) Merge ¶
func (se *SeriesEnvelope) 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 (*SeriesEnvelope) SeriesCount ¶
func (se *SeriesEnvelope) SeriesCount() int
SeriesCount returns the number of individual series in the Timeseries value.
func (*SeriesEnvelope) SetExtents ¶
func (se *SeriesEnvelope) SetExtents(extents timeseries.ExtentList)
SetExtents overwrites a Timeseries's known extents with the provided extent list.
func (*SeriesEnvelope) SetStep ¶
func (se *SeriesEnvelope) SetStep(step time.Duration)
SetStep sets the step for the Timeseries.
func (*SeriesEnvelope) Size ¶
func (se *SeriesEnvelope) Size() int
Size returns the approximate memory utilization in bytes of the timeseries
func (*SeriesEnvelope) Sort ¶
func (se *SeriesEnvelope) Sort()
Sort sorts all data in the Timeseries chronologically by their timestamp.
func (*SeriesEnvelope) Step ¶
func (se *SeriesEnvelope) Step() time.Duration
Step returns the step for the Timeseries.
func (*SeriesEnvelope) TimestampCount ¶
func (se *SeriesEnvelope) TimestampCount() int
TimestampCount returns the number of unique timestamps across the timeseries.
func (*SeriesEnvelope) UnmarshalJSON ¶
func (se *SeriesEnvelope) UnmarshalJSON(b []byte) error
UnmarshalJSON decodes a JSON byte slice into this data point value.
func (*SeriesEnvelope) ValueCount ¶
func (se *SeriesEnvelope) ValueCount() int
ValueCount returns the count of all data values across all Series in the Timeseries value.