Documentation ¶
Index ¶
Constants ¶
const (
DefaultRunInterval = time.Second
)
Default values for aspects of interval computation.
const ( // NoChunkingSize specifies when not to chunk results. When planning // a select statement, passing zero tells it not to chunk results. // Only applies to raw queries. NoChunkingSize = 0 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Enables logging in CQ service to display when CQ's are processed and how many points are wrote. LogEnabled bool `toml:"log-enabled"` // If this flag is set to false, both the brokers and data nodes should ignore any CQ processing. Enabled bool `toml:"enabled"` // Run interval for checking continuous queries. This should be set to the least common factor // of the interval for running continuous queries. If you only aggregate continuous queries // every minute, this should be set to 1 minute. The default is set to '1s' so the interval // is compatible with most aggregations. RunInterval toml.Duration `toml:"run-interval"` }
Config represents a configuration for the continuous query service.
type ContinuousQuerier ¶
type ContinuousQuerier interface { // Run executes the named query in the named database. Blank database or name matches all. Run(database, name string, t time.Time) error }
ContinuousQuerier represents a service that executes continuous queries.
type ContinuousQuery ¶
type ContinuousQuery struct { Database string Info *meta.ContinuousQueryInfo HasRun bool LastRun time.Time Resample ResampleOptions // contains filtered or unexported fields }
ContinuousQuery is a local wrapper / helper around continuous queries.
func NewContinuousQuery ¶
func NewContinuousQuery(database string, cqi *meta.ContinuousQueryInfo) (*ContinuousQuery, error)
NewContinuousQuery returns a ContinuousQuery object with a parsed influxql.CreateContinuousQueryStatement
type ResampleOptions ¶
type ResampleOptions struct { // The query will be resampled at this time interval. The first query will be // performed at this time interval. If this option is not given, the resample // interval is set to the group by interval. Every time.Duration // The query will continue being resampled for this time duration. If this // option is not given, the resample duration is the same as the group by // interval. A bucket's time is calculated based on the bucket's start time, // so a 40m resample duration with a group by interval of 10m will resample // the bucket 4 times (using the default time interval). For time.Duration }
Customizes the resampling intervals and duration of this continuous query.
type RunRequest ¶
type RunRequest struct { // Now tells the CQ serivce what the current time is. Now time.Time // CQs tells the CQ service which queries to run. // If nil, all queries will be run. CQs []string }
RunRequest is a request to run one or more CQs.
type Service ¶
type Service struct { MetaClient metaClient QueryExecutor *influxql.QueryExecutor Config *Config RunInterval time.Duration // RunCh can be used by clients to signal service to run CQs. RunCh chan *RunRequest Logger *log.Logger // contains filtered or unexported fields }
Service manages continuous query execution.
func (*Service) ExecuteContinuousQuery ¶
func (s *Service) ExecuteContinuousQuery(dbi *meta.DatabaseInfo, cqi *meta.ContinuousQueryInfo, now time.Time) error
ExecuteContinuousQuery executes a single CQ.
func (*Service) SetLogOutput ¶
SetLogOutput sets the writer to which all logs are written. It must not be called after Open is called.