Documentation ¶
Overview ¶
A data pipeline processing engine.
See the README for more complete examples and guides.
Code Organization:
The pipeline package provides an API for how nodes can be connected to form a pipeline. The individual implementations of each node exist in this kapacitor package. The reason for the separation is to keep the exported API from the pipeline package clean as it is consumed via the TICKscripts (a DSL for Kapacitor).
Other Concepts:
Stream vs Batch -- Use of the word 'stream' indicates data arrives a single data point at a time. Use of the word 'batch' indicates data arrives in sets or batches or data points.
Task -- A task represents a concrete workload to perform. It consists of a pipeline and an identifying name. Basic CRUD operations can be performed on tasks.
Task Master -- Responsible for executing a task in a specific environment.
Replay -- Replays static datasets against tasks.
Index ¶
- Constants
- Variables
- func CreateDBRPMap(dbrps []DBRP) map[DBRP]bool
- func EvalPredicate(se *tick.StatefulExpr, fields models.Fields, tags map[string]string) (bool, error)
- func GetFloatVar(name string) float64
- func GetIntVar(name string) int64
- func GetStringVar(name string) string
- func NewStatistics(name string, tags map[string]string) *expvar.Map
- func Uptime() time.Duration
- func WriteBatchForRecording(w io.Writer, b models.Batch) error
- func WritePointForRecording(w io.Writer, p models.Point, precision string) error
- type AlertData
- type AlertHandler
- type AlertLevel
- type AlertNode
- type BatchCollector
- type BatchNode
- type DBRP
- type DerivativeNode
- type Edge
- func (e *Edge) Abort()
- func (e *Edge) Close()
- func (e *Edge) CollectBatch(b models.Batch) error
- func (e *Edge) CollectMaps(m *MapResult) error
- func (e *Edge) CollectPoint(p models.Point) error
- func (e *Edge) Next() (p models.PointInterface, ok bool)
- func (e *Edge) NextBatch() (b models.Batch, ok bool)
- func (e *Edge) NextMaps() (m *MapResult, ok bool)
- func (e *Edge) NextPoint() (p models.Point, ok bool)
- type EvalNode
- type ExecutingTask
- type GroupByNode
- type HTTPOutNode
- type InfluxDBOutNode
- type JoinNode
- type LogService
- type MapFunc
- type MapInfo
- type MapNode
- type MapResult
- type Node
- type Output
- type Query
- type ReduceFunc
- type ReduceNode
- type Replay
- type Result
- type SampleNode
- type SourceBatchNode
- type StatsData
- type StreamCollector
- type StreamNode
- type Task
- type TaskMaster
- func (tm *TaskMaster) BatchCollectors(name string) []BatchCollector
- func (tm *TaskMaster) Close() error
- func (tm *TaskMaster) DelFork(name string)
- func (tm *TaskMaster) Drain()
- func (tm *TaskMaster) IsExecuting(name string) bool
- func (tm *TaskMaster) New() *TaskMaster
- func (tm *TaskMaster) NewFork(taskName string, dbrps []DBRP) (*Edge, error)
- func (tm *TaskMaster) Open() (err error)
- func (tm *TaskMaster) StartTask(t *Task) (*ExecutingTask, error)
- func (tm *TaskMaster) StopTask(name string) error
- func (tm *TaskMaster) Stream(name string) (StreamCollector, error)
- func (tm *TaskMaster) WritePoints(pts *cluster.WritePointsRequest) error
- type TaskType
- type UnionNode
- type WhereNode
- type WindowNode
Constants ¶
const ( // List of names for top-level exported vars ClusterIDVarName = "cluster_id" ServerIDVarName = "server_id" HostVarName = "host" ProductVarName = "product" VersionVarName = "version" NumTasksVarName = "num_tasks" NumEnabledTasksVarName = "num_enabled_tasks" NumSubscriptionsVarName = "num_subscriptions" UptimeVarName = "uptime" // The name of the product Product = "kapacitor" )
Variables ¶
var ( // Global expvars NumTasks = &expvar.Int{} NumEnabledTasks = &expvar.Int{} NumSubscriptions = &expvar.Int{} )
var ErrAborted = errors.New("edged aborted")
var ErrTaskMasterClosed = errors.New("TaskMaster is closed")
var ErrTaskMasterOpen = errors.New("TaskMaster is open")
var ErrWrongTaskType = errors.New("wrong task type")
Functions ¶
func CreateDBRPMap ¶
func EvalPredicate ¶
func EvalPredicate(se *tick.StatefulExpr, fields models.Fields, tags map[string]string) (bool, error)
Evaluate a given expression as a boolean predicate against a set of fields and tags
func GetFloatVar ¶
Gets an exported var and returns its float value
func GetStringVar ¶
Gets an exported var and returns its unquoted string contents
func NewStatistics ¶
NewStatistics creates an expvar-based map. Within there "name" is the Measurement name, "tags" are the tags, and values are placed at the key "values". The "values" map is returned so that statistics can be set.
Types ¶
type AlertHandler ¶
type AlertHandler func(ad *AlertData)
type AlertLevel ¶
type AlertLevel int
const ( OKAlert AlertLevel = iota InfoAlert WarnAlert CritAlert )
func (AlertLevel) MarshalText ¶
func (l AlertLevel) MarshalText() ([]byte, error)
func (AlertLevel) String ¶
func (l AlertLevel) String() string
type BatchCollector ¶
type BatchNode ¶
type BatchNode struct {
// contains filtered or unexported fields
}
type DerivativeNode ¶
type DerivativeNode struct {
// contains filtered or unexported fields
}
type Edge ¶
type Edge struct {
// contains filtered or unexported fields
}
func (*Edge) Abort ¶ added in v0.2.1
func (e *Edge) Abort()
Abort all next and collect calls. Items in flight may or may not be processed.
func (*Edge) Close ¶
func (e *Edge) Close()
Close the edge, this can only be called after all collect calls to the edge have finished.
func (*Edge) CollectMaps ¶
type ExecutingTask ¶
type ExecutingTask struct { Task *Task // contains filtered or unexported fields }
A task that is ready for execution.
func NewExecutingTask ¶
func NewExecutingTask(tm *TaskMaster, t *Task) (*ExecutingTask, error)
Create a new task from a defined kapacitor.
func (*ExecutingTask) BatchCount ¶
func (et *ExecutingTask) BatchCount() (int, error)
func (*ExecutingTask) BatchQueries ¶
func (et *ExecutingTask) BatchQueries(start, stop time.Time) ([][]string, error)
Get the next `num` batch queries that the batcher will run starting at time `start`.
func (*ExecutingTask) Err ¶
func (et *ExecutingTask) Err() error
Wait till the task finishes and return any error
func (*ExecutingTask) GetOutput ¶
func (et *ExecutingTask) GetOutput(name string) (Output, error)
Get a named output.
func (*ExecutingTask) StartBatching ¶
func (et *ExecutingTask) StartBatching() error
Instruct source batch node to start querying and sending batches of data
type GroupByNode ¶
type GroupByNode struct {
// contains filtered or unexported fields
}
type HTTPOutNode ¶
type HTTPOutNode struct {
// contains filtered or unexported fields
}
func (*HTTPOutNode) Endpoint ¶
func (h *HTTPOutNode) Endpoint() string
type InfluxDBOutNode ¶
type InfluxDBOutNode struct {
// contains filtered or unexported fields
}
type Node ¶
type Node interface { pipeline.Node // wait for the node to finish processing and return any errors Err() error // contains filtered or unexported methods }
A node that can be in an executor.
type Output ¶
type Output interface {
Endpoint() string
}
An output of a pipeline. Still need to improve this interface to expose different types of outputs.
type Query ¶
type Query struct {
// contains filtered or unexported fields
}
func (*Query) Dimensions ¶
Set the dimensions on the query
func (*Query) Fill ¶
func (q *Query) Fill(option influxql.FillOption, value interface{})
type ReduceFunc ¶
type ReduceNode ¶
type ReduceNode struct {
// contains filtered or unexported fields
}
type Replay ¶
Replay engine that can replay static data sets against a specific executor and its tasks.
func (*Replay) ReplayBatch ¶
func (r *Replay) ReplayBatch(data []io.ReadCloser, batches []BatchCollector, recTime bool) <-chan error
Replay a data set against an executor. If source time is true then the replay will use the times stored in the recording instead of the clock time.
func (*Replay) ReplayStream ¶
func (r *Replay) ReplayStream(data io.ReadCloser, stream StreamCollector, recTime bool, precision string) <-chan error
Replay a data set against an executor.
type SampleNode ¶
type SampleNode struct {
// contains filtered or unexported fields
}
type SourceBatchNode ¶
type SourceBatchNode struct {
// contains filtered or unexported fields
}
func (*SourceBatchNode) Count ¶
func (s *SourceBatchNode) Count() int
func (*SourceBatchNode) DBRPs ¶
func (s *SourceBatchNode) DBRPs() ([]DBRP, error)
Return list of databases and retention policies the batcher will query.
func (*SourceBatchNode) Err ¶
func (s *SourceBatchNode) Err() error
func (*SourceBatchNode) Queries ¶
func (s *SourceBatchNode) Queries(start, stop time.Time) [][]string
func (*SourceBatchNode) Start ¶
func (s *SourceBatchNode) Start()
type StatsData ¶ added in v0.2.1
type StatsData struct { Name string `json:"name"` Tags map[string]string `json:"tags"` Values map[string]interface{} `json:"values"` }
func GetStatsData ¶
Return all stats data from the expvars.
type StreamCollector ¶
type StreamNode ¶
type StreamNode struct {
// contains filtered or unexported fields
}
type Task ¶
The complete definition of a task, its name, pipeline and type.
func NewBatcher ¶
Create a new batcher task from a script.
func NewStreamer ¶
Create a new streamer task from a script.
type TaskMaster ¶
type TaskMaster struct { HTTPDService interface { AddRoutes([]httpd.Route) error DelRoutes([]httpd.Route) URL() string } InfluxDBService interface { NewClient() (*client.Client, error) } SMTPService interface { Global() bool SendMail(to []string, subject string, msg string) } VictorOpsService interface { Global() bool Alert(routingKey, messageType, message, entityID string, t time.Time, extra interface{}) error } PagerDutyService interface { Global() bool Alert(incidentKey, desc string, details interface{}) error } SlackService interface { Global() bool Alert(channel, message string, level AlertLevel) error } LogService LogService // contains filtered or unexported fields }
An execution framework for a set of tasks.
func NewTaskMaster ¶
func NewTaskMaster(l LogService) *TaskMaster
Create a new Executor with a given clock.
func (*TaskMaster) BatchCollectors ¶
func (tm *TaskMaster) BatchCollectors(name string) []BatchCollector
func (*TaskMaster) Close ¶
func (tm *TaskMaster) Close() error
func (*TaskMaster) DelFork ¶
func (tm *TaskMaster) DelFork(name string)
func (*TaskMaster) Drain ¶ added in v0.2.1
func (tm *TaskMaster) Drain()
func (*TaskMaster) IsExecuting ¶ added in v0.2.1
func (tm *TaskMaster) IsExecuting(name string) bool
func (*TaskMaster) New ¶
func (tm *TaskMaster) New() *TaskMaster
Returns a new TaskMaster instance with the same services as the current one.
func (*TaskMaster) NewFork ¶
func (tm *TaskMaster) NewFork(taskName string, dbrps []DBRP) (*Edge, error)
func (*TaskMaster) Open ¶
func (tm *TaskMaster) Open() (err error)
func (*TaskMaster) StartTask ¶
func (tm *TaskMaster) StartTask(t *Task) (*ExecutingTask, error)
func (*TaskMaster) StopTask ¶
func (tm *TaskMaster) StopTask(name string) error
func (*TaskMaster) Stream ¶
func (tm *TaskMaster) Stream(name string) (StreamCollector, error)
func (*TaskMaster) WritePoints ¶ added in v0.2.1
func (tm *TaskMaster) WritePoints(pts *cluster.WritePointsRequest) error
type WindowNode ¶
type WindowNode struct {
// contains filtered or unexported fields
}
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
A clock that provides blocking calls that wait until absolute times have occurred.
|
A clock that provides blocking calls that wait until absolute times have occurred. |
cmd
|
|
Contains integration and end-to-end tests
|
Contains integration and end-to-end tests |
Provides a set of structures for passing data around Kapacitor.
|
Provides a set of structures for passing data around Kapacitor. |
Provides an API for constructing data processing pipelines.
|
Provides an API for constructing data processing pipelines. |
services
|
|
httpd
Provides an HTTP API exposing many components of Kapacitor.
|
Provides an HTTP API exposing many components of Kapacitor. |
reporting
Sends anonymous reports to InfluxData
|
Sends anonymous reports to InfluxData |
stats
The stats service collects the exported stats and submits them to the Kapacitor stream under the configured database and retetion policy.
|
The stats service collects the exported stats and submits them to the Kapacitor stream under the configured database and retetion policy. |
TICKscript is a simple invocation chaining DSL.
|
TICKscript is a simple invocation chaining DSL. |
cmd/tickdoc
Tickdoc is a simple utility similiar to godoc that generates documentation from comments.
|
Tickdoc is a simple utility similiar to godoc that generates documentation from comments. |
Provides an io.Writer that filters log messages based on a log level.
|
Provides an io.Writer that filters log messages based on a log level. |