kapacitor

package module
v0.0.0-...-298395c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 25, 2019 License: MIT Imports: 70 Imported by: 0

README

Kapacitor Circle CI Docker pulls

Open source framework for processing, monitoring, and alerting on time series data

Installation

Kapacitor has two binaries:

  • kapacitor – a CLI program for calling the Kapacitor API.
  • kapacitord – the Kapacitor server daemon.

You can either download the binaries directly from the downloads page or go get them:

go get github.com/influxdata/kapacitor/cmd/kapacitor
go get github.com/influxdata/kapacitor/cmd/kapacitord

Configuration

An example configuration file can be found here

Kapacitor can also provide an example config for you using this command:

kapacitord config

Getting Started

This README gives you a high level overview of what Kapacitor is and what its like to use it. As well as some details of how it works. To get started using Kapacitor see this guide. After you finish the getting started exercise you can check out the TICKscripts for different Telegraf plugins.

Basic Example

Kapacitor uses a DSL named TICKscript to define tasks.

A simple TICKscript that alerts on high cpu usage looks like this:

stream
    |from()
        .measurement('cpu_usage_idle')
        .groupBy('host')
    |window()
        .period(1m)
        .every(1m)
    |mean('value')
    |eval(lambda: 100.0 - "mean")
        .as('used')
    |alert()
        .message('{{ .Level}}: {{ .Name }}/{{ index .Tags "host" }} has high cpu usage: {{ index .Fields "used" }}')
        .warn(lambda: "used" > 70.0)
        .crit(lambda: "used" > 85.0)

        // Send alert to hander of choice.

        // Slack
        .slack()
        .channel('#alerts')

        // VictorOps
        .victorOps()
        .routingKey('team_rocket')

        // PagerDuty
        .pagerDuty()

Place the above script into a file cpu_alert.tick then run these commands to start the task:

# Define the task (assumes cpu data is in db 'telegraf')
kapacitor define \
    cpu_alert \
    -type stream \
    -dbrp telegraf.default \
    -tick ./cpu_alert.tick
# Start the task
kapacitor enable cpu_alert

For more complete examples see the documentation.

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

View Source
const (
	MainTaskMaster = "main"
)

Variables

View Source
var ErrAborted = errors.New("edged aborted")
View Source
var ErrTaskMasterClosed = errors.New("TaskMaster is closed")
View Source
var ErrTaskMasterOpen = errors.New("TaskMaster is open")
View Source
var ErrWrongTaskType = errors.New("wrong task type")

Functions

func ConvertResultTimes

func ConvertResultTimes(r *Result)

func CreateDBRPMap

func CreateDBRPMap(dbrps []DBRP) map[DBRP]bool

func EvalPredicate

func EvalPredicate(se stateful.Expression, scopePool stateful.ScopePool, p edge.FieldsTagsTimeGetter) (bool, error)

EvalPredicate - Evaluate a given expression as a boolean predicate against a set of fields and tags

func ReplayBatchFromChan

func ReplayBatchFromChan(clck clock.Clock, batches []<-chan edge.BufferedBatchMessage, collectors []BatchCollector, recTime bool) <-chan error

Replay batch data from a channel source.

func ReplayBatchFromIO

func ReplayBatchFromIO(clck clock.Clock, data []io.ReadCloser, collectors []BatchCollector, recTime bool) <-chan error

Replay batch data from an IO source.

func ReplayStreamFromChan

func ReplayStreamFromChan(clck clock.Clock, points <-chan edge.PointMessage, collector StreamCollector, recTime bool) <-chan error

Replay stream data from a channel source.

func ReplayStreamFromIO

func ReplayStreamFromIO(clck clock.Clock, data io.ReadCloser, collector StreamCollector, recTime bool, precision string) <-chan error

Replay stream data from an IO source.

func WriteBatchForRecording

func WriteBatchForRecording(w io.Writer, b edge.BufferedBatchMessage) error

func WritePointForRecording

func WritePointForRecording(w io.Writer, p edge.PointMessage, precision string) error

Types

type AlertNode

type AlertNode struct {
	// contains filtered or unexported fields
}

func (*AlertNode) NewGroup

func (n *AlertNode) NewGroup(group edge.GroupInfo, first edge.PointMeta) (edge.Receiver, error)

func (*AlertNode) Wait

func (n *AlertNode) Wait() error

type AutoscaleNode

type AutoscaleNode struct {
	// contains filtered or unexported fields
}

func (*AutoscaleNode) NewGroup

func (n *AutoscaleNode) NewGroup(group edge.GroupInfo, first edge.PointMeta) (edge.Receiver, error)

func (*AutoscaleNode) Wait

func (n *AutoscaleNode) Wait() error

type BarrierNode

type BarrierNode struct {
	// contains filtered or unexported fields
}

func (*BarrierNode) NewGroup

func (n *BarrierNode) NewGroup(group edge.GroupInfo, first edge.PointMeta) (edge.Receiver, error)

func (*BarrierNode) Wait

func (n *BarrierNode) Wait() error

type BatchCollector

type BatchCollector interface {
	CollectBatch(edge.BufferedBatchMessage) error
	Close() error
}

type BatchNode

type BatchNode struct {
	// contains filtered or unexported fields
}

func (*BatchNode) Abort

func (n *BatchNode) Abort()

func (*BatchNode) Count

func (n *BatchNode) Count() int

func (*BatchNode) DBRPs

func (n *BatchNode) DBRPs() ([]DBRP, error)

Return list of databases and retention policies the batcher will query.

func (*BatchNode) Queries

func (n *BatchNode) Queries(start, stop time.Time) ([]BatchQueries, error)

func (*BatchNode) Start

func (n *BatchNode) Start()

func (*BatchNode) Wait

func (n *BatchNode) Wait() error

type BatchQueries

type BatchQueries struct {
	Queries            []*Query
	Cluster            string
	GroupByMeasurement bool
}

type ChangeDetectNode

type ChangeDetectNode struct {
	// contains filtered or unexported fields
}

func (*ChangeDetectNode) NewGroup

func (n *ChangeDetectNode) NewGroup(group edge.GroupInfo, first edge.PointMeta) (edge.Receiver, error)

func (*ChangeDetectNode) Wait

func (n *ChangeDetectNode) Wait() error

type CombineNode

type CombineNode struct {
	// contains filtered or unexported fields
}

func (*CombineNode) NewGroup

func (n *CombineNode) NewGroup(group edge.GroupInfo, first edge.PointMeta) (edge.Receiver, error)

func (*CombineNode) Wait

func (n *CombineNode) Wait() error

type DBRP

type DBRP struct {
	Database        string `json:"db"`
	RetentionPolicy string `json:"rp"`
}

func (DBRP) String

func (d DBRP) String() string

type DefaultNode

type DefaultNode struct {
	// contains filtered or unexported fields
}

func (*DefaultNode) Barrier

func (n *DefaultNode) Barrier(b edge.BarrierMessage) (edge.Message, error)

func (*DefaultNode) BatchPoint

func (n *DefaultNode) BatchPoint(bp edge.BatchPointMessage) (edge.Message, error)

func (*DefaultNode) BeginBatch

func (n *DefaultNode) BeginBatch(begin edge.BeginBatchMessage) (edge.Message, error)

func (*DefaultNode) DeleteGroup

func (n *DefaultNode) DeleteGroup(d edge.DeleteGroupMessage) (edge.Message, error)

func (*DefaultNode) Done

func (n *DefaultNode) Done()

func (*DefaultNode) EndBatch

func (n *DefaultNode) EndBatch(end edge.EndBatchMessage) (edge.Message, error)

func (*DefaultNode) Point

func (n *DefaultNode) Point(p edge.PointMessage) (edge.Message, error)

func (*DefaultNode) Wait

func (n *DefaultNode) Wait() error

type DeleteNode

type DeleteNode struct {
	// contains filtered or unexported fields
}

func (*DeleteNode) Barrier

func (n *DeleteNode) Barrier(b edge.BarrierMessage) (edge.Message, error)

func (*DeleteNode) BatchPoint

func (n *DeleteNode) BatchPoint(bp edge.BatchPointMessage) (edge.Message, error)

func (*DeleteNode) BeginBatch

func (n *DeleteNode) BeginBatch(begin edge.BeginBatchMessage) (edge.Message, error)

func (*DeleteNode) DeleteGroup

func (n *DeleteNode) DeleteGroup(d edge.DeleteGroupMessage) (edge.Message, error)

func (*DeleteNode) Done

func (n *DeleteNode) Done()

func (*DeleteNode) EndBatch

func (n *DeleteNode) EndBatch(end edge.EndBatchMessage) (edge.Message, error)

func (*DeleteNode) Point

func (n *DeleteNode) Point(p edge.PointMessage) (edge.Message, error)

func (*DeleteNode) Wait

func (n *DeleteNode) Wait() error

type DerivativeNode

type DerivativeNode struct {
	// contains filtered or unexported fields
}

func (*DerivativeNode) NewGroup

func (n *DerivativeNode) NewGroup(group edge.GroupInfo, first edge.PointMeta) (edge.Receiver, error)

func (*DerivativeNode) Wait

func (n *DerivativeNode) Wait() error

type Diagnostic

type Diagnostic interface {
	WithTaskContext(task string) TaskDiagnostic
	WithTaskMasterContext(tm string) Diagnostic
	WithNodeContext(node string) NodeDiagnostic
	WithEdgeContext(task, parent, child string) EdgeDiagnostic

	TaskMasterOpened()
	TaskMasterClosed()

	StartingTask(id string)
	StartedTask(id string)

	StoppedTask(id string)
	StoppedTaskWithError(id string, err error)

	TaskMasterDot(d string)
}

type Edge

type Edge struct {
	edge.StatsEdge
	// contains filtered or unexported fields
}

func (*Edge) Close

func (e *Edge) Close() error

type EdgeDiagnostic

type EdgeDiagnostic interface {
	ClosingEdge(collected, emitted int64)
}

type EvalNode

type EvalNode struct {
	// contains filtered or unexported fields
}

func (*EvalNode) NewGroup

func (n *EvalNode) NewGroup(group edge.GroupInfo, first edge.PointMeta) (edge.Receiver, error)

func (*EvalNode) Wait

func (n *EvalNode) Wait() error

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) ([]BatchQueries, error)

Get the next `num` batch queries that the batcher will run starting at time `start`.

func (*ExecutingTask) EDot

func (et *ExecutingTask) EDot(labels bool) []byte

Return a graphviz .dot formatted byte array. Label edges with relavant execution information.

func (*ExecutingTask) ExecutionStats

func (et *ExecutingTask) ExecutionStats() (ExecutionStats, error)

func (*ExecutingTask) GetOutput

func (et *ExecutingTask) GetOutput(name string) (Output, error)

Get a named output.

func (*ExecutingTask) Snapshot

func (et *ExecutingTask) Snapshot() (*TaskSnapshot, error)

func (*ExecutingTask) StartBatching

func (et *ExecutingTask) StartBatching() error

Instruct source batch node to start querying and sending batches of data

func (*ExecutingTask) StopStats

func (et *ExecutingTask) StopStats()

Stop all stats nodes

func (*ExecutingTask) Wait

func (et *ExecutingTask) Wait() error

Wait till the task finishes and return any error

type ExecutionStats

type ExecutionStats struct {
	TaskStats map[string]interface{}
	NodeStats map[string]map[string]interface{}
}

type FlattenNode

type FlattenNode struct {
	// contains filtered or unexported fields
}

func (*FlattenNode) NewGroup

func (n *FlattenNode) NewGroup(group edge.GroupInfo, first edge.PointMeta) (edge.Receiver, error)

func (*FlattenNode) Wait

func (n *FlattenNode) Wait() error

type FromNode

type FromNode struct {
	// contains filtered or unexported fields
}

func (*FromNode) Barrier

func (n *FromNode) Barrier(b edge.BarrierMessage) (edge.Message, error)

func (*FromNode) BatchPoint

func (n *FromNode) BatchPoint(edge.BatchPointMessage) (edge.Message, error)

func (*FromNode) BeginBatch

func (n *FromNode) BeginBatch(edge.BeginBatchMessage) (edge.Message, error)

func (*FromNode) DeleteGroup

func (n *FromNode) DeleteGroup(d edge.DeleteGroupMessage) (edge.Message, error)

func (*FromNode) Done

func (n *FromNode) Done()

func (*FromNode) EndBatch

func (n *FromNode) EndBatch(edge.EndBatchMessage) (edge.Message, error)

func (*FromNode) Point

func (n *FromNode) Point(p edge.PointMessage) (edge.Message, error)

func (*FromNode) Wait

func (n *FromNode) Wait() error

type GroupByNode

type GroupByNode struct {
	// contains filtered or unexported fields
}

func (*GroupByNode) Barrier

func (n *GroupByNode) Barrier(b edge.BarrierMessage) error

func (*GroupByNode) BatchPoint

func (n *GroupByNode) BatchPoint(bp edge.BatchPointMessage) error

func (*GroupByNode) BeginBatch

func (n *GroupByNode) BeginBatch(begin edge.BeginBatchMessage) error

func (*GroupByNode) DeleteGroup

func (n *GroupByNode) DeleteGroup(d edge.DeleteGroupMessage) error

func (*GroupByNode) Done

func (n *GroupByNode) Done()

func (*GroupByNode) EndBatch

func (n *GroupByNode) EndBatch(end edge.EndBatchMessage) error

func (*GroupByNode) Point

func (n *GroupByNode) Point(p edge.PointMessage) error

func (*GroupByNode) Wait

func (n *GroupByNode) Wait() error

type HTTPOutNode

type HTTPOutNode struct {
	// contains filtered or unexported fields
}

func (*HTTPOutNode) Endpoint

func (n *HTTPOutNode) Endpoint() string

func (*HTTPOutNode) NewGroup

func (n *HTTPOutNode) NewGroup(group edge.GroupInfo, first edge.PointMeta) (edge.Receiver, error)

func (*HTTPOutNode) Wait

func (n *HTTPOutNode) Wait() error

type HTTPPostNode

type HTTPPostNode struct {
	// contains filtered or unexported fields
}

func (*HTTPPostNode) NewGroup

func (n *HTTPPostNode) NewGroup(group edge.GroupInfo, first edge.PointMeta) (edge.Receiver, error)

func (*HTTPPostNode) Wait

func (n *HTTPPostNode) Wait() error

type InfluxDBOutNode

type InfluxDBOutNode struct {
	// contains filtered or unexported fields
}

func (*InfluxDBOutNode) Barrier

func (*InfluxDBOutNode) BatchPoint

func (n *InfluxDBOutNode) BatchPoint(bp edge.BatchPointMessage) (edge.Message, error)

func (*InfluxDBOutNode) BeginBatch

func (n *InfluxDBOutNode) BeginBatch(begin edge.BeginBatchMessage) (edge.Message, error)

func (*InfluxDBOutNode) BufferedBatch

func (n *InfluxDBOutNode) BufferedBatch(batch edge.BufferedBatchMessage) (edge.Message, error)

func (*InfluxDBOutNode) DeleteGroup

func (*InfluxDBOutNode) Done

func (n *InfluxDBOutNode) Done()

func (*InfluxDBOutNode) EndBatch

func (n *InfluxDBOutNode) EndBatch(end edge.EndBatchMessage) (edge.Message, error)

func (*InfluxDBOutNode) Point

func (*InfluxDBOutNode) Wait

func (n *InfluxDBOutNode) Wait() error

type InfluxQLNode

type InfluxQLNode struct {
	// contains filtered or unexported fields
}

func (*InfluxQLNode) NewGroup

func (n *InfluxQLNode) NewGroup(group edge.GroupInfo, first edge.PointMeta) (edge.Receiver, error)

func (*InfluxQLNode) Wait

func (n *InfluxQLNode) Wait() error

type JoinNode

type JoinNode struct {
	// contains filtered or unexported fields
}

func (*JoinNode) Barrier

func (n *JoinNode) Barrier(src int, b edge.BarrierMessage) error

func (*JoinNode) BufferedBatch

func (n *JoinNode) BufferedBatch(src int, batch edge.BufferedBatchMessage) error

func (*JoinNode) Finish

func (n *JoinNode) Finish() error

func (*JoinNode) Point

func (n *JoinNode) Point(src int, p edge.PointMessage) error

func (*JoinNode) Wait

func (n *JoinNode) Wait() error

type KapacitorLoopbackNode

type KapacitorLoopbackNode struct {
	// contains filtered or unexported fields
}

func (*KapacitorLoopbackNode) Barrier

func (*KapacitorLoopbackNode) BatchPoint

func (*KapacitorLoopbackNode) BeginBatch

func (n *KapacitorLoopbackNode) BeginBatch(begin edge.BeginBatchMessage) error

func (*KapacitorLoopbackNode) DeleteGroup

func (*KapacitorLoopbackNode) Done

func (n *KapacitorLoopbackNode) Done()

func (*KapacitorLoopbackNode) EndBatch

func (*KapacitorLoopbackNode) Point

func (*KapacitorLoopbackNode) Wait

func (n *KapacitorLoopbackNode) Wait() error

type LogNode

type LogNode struct {
	// contains filtered or unexported fields
}

func (*LogNode) Barrier

func (n *LogNode) Barrier(b edge.BarrierMessage) (edge.Message, error)

func (*LogNode) BatchPoint

func (n *LogNode) BatchPoint(bp edge.BatchPointMessage) (edge.Message, error)

func (*LogNode) BeginBatch

func (n *LogNode) BeginBatch(begin edge.BeginBatchMessage) (edge.Message, error)

func (*LogNode) BufferedBatch

func (n *LogNode) BufferedBatch(batch edge.BufferedBatchMessage) (edge.Message, error)

func (*LogNode) DeleteGroup

func (n *LogNode) DeleteGroup(d edge.DeleteGroupMessage) (edge.Message, error)

func (*LogNode) Done

func (n *LogNode) Done()

func (*LogNode) EndBatch

func (n *LogNode) EndBatch(end edge.EndBatchMessage) (edge.Message, error)

func (*LogNode) Point

func (n *LogNode) Point(p edge.PointMessage) (edge.Message, error)

func (*LogNode) Wait

func (n *LogNode) Wait() error

type LogService

type LogService interface {
	NewLogger(prefix string, flag int) *log.Logger
}

type MaxDuration

type MaxDuration struct {
	// contains filtered or unexported fields
}

MaxDuration is a 64-bit int variable representing a duration in nanoseconds,that satisfies the expvar.Var interface. When setting a value it will only be set if it is greater than the current value.

func (*MaxDuration) IntValue

func (v *MaxDuration) IntValue() int64

func (*MaxDuration) Set

func (v *MaxDuration) Set(next int64)

Set sets value if it is greater than current value. If set was successful and a setter exists, will pass on value to setter.

func (*MaxDuration) String

func (v *MaxDuration) String() string

func (*MaxDuration) StringValue

func (v *MaxDuration) StringValue() string

type NoOpNode

type NoOpNode struct {
	// contains filtered or unexported fields
}

func (*NoOpNode) Wait

func (n *NoOpNode) Wait() error

type Node

type Node interface {
	pipeline.Node

	// wait for the node to finish processing and return any errors
	Wait() error
	// contains filtered or unexported methods
}

A node that can be in an executor.

type NodeDiagnostic

type NodeDiagnostic interface {
	Error(msg string, err error, ctx ...keyvalue.T)

	// AlertNode
	AlertTriggered(level alert.Level, id string, message string, rows *models.Row)

	// AutoscaleNode
	SettingReplicas(new int, old int, id string)

	// QueryNode
	StartingBatchQuery(q string)

	// LogNode
	LogPointData(key, prefix string, data edge.PointMessage)
	LogBatchData(key, prefix string, data edge.BufferedBatchMessage)

	//UDF
	UDFLog(s string)
}

type NoopMetaClient

type NoopMetaClient struct{}

func (*NoopMetaClient) Authenticate

func (m *NoopMetaClient) Authenticate(username, password string) (ui *meta.UserInfo, err error)

func (*NoopMetaClient) CreateDatabase

func (m *NoopMetaClient) CreateDatabase(name string) (*meta.DatabaseInfo, error)

func (*NoopMetaClient) CreateDatabaseWithRetentionPolicy

func (m *NoopMetaClient) CreateDatabaseWithRetentionPolicy(name string, rpi *meta.RetentionPolicySpec) (*meta.DatabaseInfo, error)

func (*NoopMetaClient) CreateRetentionPolicy

func (m *NoopMetaClient) CreateRetentionPolicy(database string, rpi *meta.RetentionPolicySpec) (*meta.RetentionPolicyInfo, error)

func (*NoopMetaClient) Database

func (m *NoopMetaClient) Database(name string) *meta.DatabaseInfo

func (*NoopMetaClient) RetentionPolicy

func (m *NoopMetaClient) RetentionPolicy(database, name string) (*meta.RetentionPolicyInfo, error)

func (*NoopMetaClient) Users

func (m *NoopMetaClient) Users() ([]meta.UserInfo, error)

func (*NoopMetaClient) WaitForLeader

func (m *NoopMetaClient) WaitForLeader(d time.Duration) error

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 NewQuery

func NewQuery(queryString string) (*Query, error)

func (*Query) AlignGroup

func (q *Query) AlignGroup()

func (*Query) Clone

func (q *Query) Clone() (*Query, error)

Deep clone this query

func (*Query) DBRPs

func (q *Query) DBRPs() ([]DBRP, error)

Return the db rp pairs of the query

func (*Query) Dimensions

func (q *Query) Dimensions(dims []interface{}) error

Set the dimensions on the query

func (*Query) Fill

func (q *Query) Fill(option influxql.FillOption, value interface{})

func (*Query) IsGroupedByTime

func (q *Query) IsGroupedByTime() bool

func (*Query) SetStartTime

func (q *Query) SetStartTime(s time.Time)

Set the start time of the query

func (*Query) SetStopTime

func (q *Query) SetStopTime(s time.Time)

Set the stop time of the query

func (*Query) StartTime

func (q *Query) StartTime() time.Time

Set the start time of the query

func (*Query) StopTime

func (q *Query) StopTime() time.Time

Set the stop time of the query

func (*Query) String

func (q *Query) String() string

type QueryNode

type QueryNode struct {
	// contains filtered or unexported fields
}

func (*QueryNode) Abort

func (n *QueryNode) Abort()

func (*QueryNode) Cluster

func (n *QueryNode) Cluster() string

func (*QueryNode) DBRPs

func (n *QueryNode) DBRPs() ([]DBRP, error)

Return list of databases and retention policies the batcher will query.

func (*QueryNode) GroupByMeasurement

func (n *QueryNode) GroupByMeasurement() bool

func (*QueryNode) Queries

func (n *QueryNode) Queries(start, stop time.Time) ([]*Query, error)

func (*QueryNode) Start

func (n *QueryNode) Start()

func (*QueryNode) Wait

func (n *QueryNode) Wait() error

type Result

type Result influxql.Result

The result from an output.

func ResultFromJSON

func ResultFromJSON(in io.Reader) (r Result)

Unmarshal a Result object from JSON.

type SampleNode

type SampleNode struct {
	// contains filtered or unexported fields
}

func (*SampleNode) NewGroup

func (n *SampleNode) NewGroup(group edge.GroupInfo, first edge.PointMeta) (edge.Receiver, error)

func (*SampleNode) Wait

func (n *SampleNode) Wait() error

type ShiftNode

type ShiftNode struct {
	// contains filtered or unexported fields
}

func (*ShiftNode) Barrier

func (n *ShiftNode) Barrier(b edge.BarrierMessage) (edge.Message, error)

func (*ShiftNode) BatchPoint

func (n *ShiftNode) BatchPoint(bp edge.BatchPointMessage) (edge.Message, error)

func (*ShiftNode) BeginBatch

func (n *ShiftNode) BeginBatch(begin edge.BeginBatchMessage) (edge.Message, error)

func (*ShiftNode) DeleteGroup

func (n *ShiftNode) DeleteGroup(d edge.DeleteGroupMessage) (edge.Message, error)

func (*ShiftNode) Done

func (n *ShiftNode) Done()

func (*ShiftNode) EndBatch

func (n *ShiftNode) EndBatch(end edge.EndBatchMessage) (edge.Message, error)

func (*ShiftNode) Point

func (n *ShiftNode) Point(p edge.PointMessage) (edge.Message, error)

func (*ShiftNode) Wait

func (n *ShiftNode) Wait() error

type SideloadNode

type SideloadNode struct {
	// contains filtered or unexported fields
}

func (*SideloadNode) Barrier

func (n *SideloadNode) Barrier(b edge.BarrierMessage) (edge.Message, error)

func (*SideloadNode) BatchPoint

func (n *SideloadNode) BatchPoint(bp edge.BatchPointMessage) (edge.Message, error)

func (*SideloadNode) BeginBatch

func (n *SideloadNode) BeginBatch(begin edge.BeginBatchMessage) (edge.Message, error)

func (*SideloadNode) DeleteGroup

func (n *SideloadNode) DeleteGroup(d edge.DeleteGroupMessage) (edge.Message, error)

func (*SideloadNode) Done

func (n *SideloadNode) Done()

func (*SideloadNode) EndBatch

func (n *SideloadNode) EndBatch(end edge.EndBatchMessage) (edge.Message, error)

func (*SideloadNode) Point

func (*SideloadNode) Wait

func (n *SideloadNode) Wait() error

type Socket

type Socket interface {
	Open() error
	Close() error
	In() io.WriteCloser
	Out() io.Reader
}

func NewSocketConn

func NewSocketConn(path string) Socket

type StateTrackingNode

type StateTrackingNode struct {
	// contains filtered or unexported fields
}

func (*StateTrackingNode) NewGroup

func (n *StateTrackingNode) NewGroup(group edge.GroupInfo, first edge.PointMeta) (edge.Receiver, error)

func (*StateTrackingNode) Wait

func (n *StateTrackingNode) Wait() error

type StatsNode

type StatsNode struct {
	// contains filtered or unexported fields
}

func (*StatsNode) Wait

func (n *StatsNode) Wait() error

type StreamCollector

type StreamCollector interface {
	CollectPoint(edge.PointMessage) error
	Close() error
}

type StreamEdge

type StreamEdge interface {
	CollectPoint(edge.PointMessage) error
	EmitPoint() (edge.PointMessage, bool)
	Close() error
}

type StreamNode

type StreamNode struct {
	// contains filtered or unexported fields
}

func (*StreamNode) Wait

func (n *StreamNode) Wait() error

type Task

type Task struct {
	ID               string
	Pipeline         *pipeline.Pipeline
	Type             TaskType
	DBRPs            []DBRP
	SnapshotInterval time.Duration
}

The complete definition of a task, its id, pipeline and type.

func (*Task) Dot

func (t *Task) Dot() []byte

func (*Task) Measurements

func (t *Task) Measurements() []string

returns all the measurements from a FromNode

type TaskDiagnostic

type TaskDiagnostic interface {
	WithNodeContext(node string) NodeDiagnostic

	Error(msg string, err error, ctx ...keyvalue.T)
}

type TaskMaster

type TaskMaster struct {
	ServerInfo vars.Infoer

	HTTPDService interface {
		AddRoutes([]httpd.Route) error
		DelRoutes([]httpd.Route)
		URL() string
	}
	TaskStore interface {
		SaveSnapshot(id string, snapshot *TaskSnapshot) error
		HasSnapshot(id string) bool
		LoadSnapshot(id string) (*TaskSnapshot, error)
	}
	DeadmanService pipeline.DeadmanService

	UDFService UDFService

	AlertService interface {
		alertservice.AnonHandlerRegistrar
		alertservice.Events
		alertservice.TopicPersister
		alertservice.InhibitorLookup
	}
	InfluxDBService interface {
		NewNamedClient(name string) (influxdb.Client, error)
	}
	SMTPService interface {
		Global() bool
		StateChangesOnly() bool
		Handler(smtp.HandlerConfig, ...keyvalue.T) alert.Handler
	}
	MQTTService interface {
		Handler(mqtt.HandlerConfig, ...keyvalue.T) (alert.Handler, error)
	}

	OpsGenieService interface {
		Global() bool
		Handler(opsgenie.HandlerConfig, ...keyvalue.T) alert.Handler
	}
	OpsGenie2Service interface {
		Global() bool
		Handler(opsgenie2.HandlerConfig, ...keyvalue.T) alert.Handler
	}
	VictorOpsService interface {
		Global() bool
		Handler(victorops.HandlerConfig, ...keyvalue.T) alert.Handler
	}
	PagerDutyService interface {
		Global() bool
		Handler(pagerduty.HandlerConfig, ...keyvalue.T) alert.Handler
	}
	PagerDuty2Service interface {
		Global() bool
		Handler(pagerduty2.HandlerConfig, ...keyvalue.T) (alert.Handler, error)
	}
	PushoverService interface {
		Handler(pushover.HandlerConfig, ...keyvalue.T) alert.Handler
	}
	HTTPPostService interface {
		Handler(httppost.HandlerConfig, ...keyvalue.T) alert.Handler
		Endpoint(string) (*httppost.Endpoint, bool)
	}
	SlackService interface {
		Global() bool
		StateChangesOnly() bool
		Handler(slack.HandlerConfig, ...keyvalue.T) alert.Handler
	}
	SNMPTrapService interface {
		Handler(snmptrap.HandlerConfig, ...keyvalue.T) (alert.Handler, error)
	}
	TelegramService interface {
		Global() bool
		StateChangesOnly() bool
		Handler(telegram.HandlerConfig, ...keyvalue.T) alert.Handler
	}
	HipChatService interface {
		Global() bool
		StateChangesOnly() bool
		Handler(hipchat.HandlerConfig, ...keyvalue.T) alert.Handler
	}
	KafkaService interface {
		Handler(kafka.HandlerConfig, ...keyvalue.T) (alert.Handler, error)
	}
	AlertManagerService interface {
		DefaultHandlerConfig() alertmanager.HandlerConfig
		Handler(alertmanager.HandlerConfig, ...keyvalue.T) (alert.Handler, error)
	}
	SensuService interface {
		Handler(sensu.HandlerConfig, ...keyvalue.T) (alert.Handler, error)
	}
	TalkService interface {
		Handler(...keyvalue.T) alert.Handler
	}
	TimingService interface {
		NewTimer(timer.Setter) timer.Timer
	}
	K8sService interface {
		Client(string) (k8s.Client, error)
	}
	SwarmService interface {
		Client(string) (swarm.Client, error)
	}
	EC2Service interface {
		Client(string) (ec2.Client, error)
	}

	SideloadService interface {
		Source(dir string) (sideload.Source, error)
	}

	Commander command.Commander

	DefaultRetentionPolicy string
	// contains filtered or unexported fields
}

An execution framework for a set of tasks.

func NewTaskMaster

func NewTaskMaster(id string, info vars.Infoer, d Diagnostic) *TaskMaster

Create a new Executor with a given clock.

func (*TaskMaster) BatchCollectors

func (tm *TaskMaster) BatchCollectors(id string) []BatchCollector

func (*TaskMaster) Close

func (tm *TaskMaster) Close() error

func (*TaskMaster) CreateTICKScope

func (tm *TaskMaster) CreateTICKScope() *stateful.Scope

func (*TaskMaster) DelFork

func (tm *TaskMaster) DelFork(id string)

func (*TaskMaster) DeleteTask

func (tm *TaskMaster) DeleteTask(id string) error

func (*TaskMaster) Drain

func (tm *TaskMaster) Drain()

func (*TaskMaster) ExecutingDot

func (tm *TaskMaster) ExecutingDot(id string, labels bool) string

func (*TaskMaster) ExecutionStats

func (tm *TaskMaster) ExecutionStats(id string) (ExecutionStats, error)

func (*TaskMaster) ID

func (tm *TaskMaster) ID() string

func (*TaskMaster) IsExecuting

func (tm *TaskMaster) IsExecuting(id string) bool

func (*TaskMaster) New

func (tm *TaskMaster) New(id string) *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, measurements []string) (edge.StatsEdge, error)

func (*TaskMaster) NewTask

func (tm *TaskMaster) NewTask(
	id,
	script string,
	tt TaskType,
	dbrps []DBRP,
	snapshotInterval time.Duration,
	vars map[string]tick.Var,
) (*Task, error)

Create a new task in the context of a TaskMaster

func (*TaskMaster) NewTemplate

func (tm *TaskMaster) NewTemplate(
	id,
	script string,
	tt TaskType,
) (*Template, error)

Create a new template in the context of a TaskMaster

func (*TaskMaster) Open

func (tm *TaskMaster) Open() (err error)

func (*TaskMaster) SnapshotTask

func (tm *TaskMaster) SnapshotTask(id string) (*TaskSnapshot, error)

func (*TaskMaster) StartTask

func (tm *TaskMaster) StartTask(t *Task) (*ExecutingTask, error)

func (*TaskMaster) StopTask

func (tm *TaskMaster) StopTask(id string) error

func (*TaskMaster) StopTasks

func (tm *TaskMaster) StopTasks()

func (*TaskMaster) Stream

func (tm *TaskMaster) Stream(name string) (StreamCollector, error)

func (*TaskMaster) WriteKapacitorPoint

func (tm *TaskMaster) WriteKapacitorPoint(p edge.PointMessage) error

func (*TaskMaster) WritePoints

func (tm *TaskMaster) WritePoints(database, retentionPolicy string, consistencyLevel imodels.ConsistencyLevel, points []imodels.Point) error

type TaskMasterLookup

type TaskMasterLookup struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewTaskMasterLookup

func NewTaskMasterLookup() *TaskMasterLookup

func (*TaskMasterLookup) Delete

func (tml *TaskMasterLookup) Delete(tm *TaskMaster)

func (*TaskMasterLookup) Get

func (tml *TaskMasterLookup) Get(id string) *TaskMaster

func (*TaskMasterLookup) Main

func (tml *TaskMasterLookup) Main() *TaskMaster

func (*TaskMasterLookup) Set

func (tml *TaskMasterLookup) Set(tm *TaskMaster)

type TaskSnapshot

type TaskSnapshot struct {
	NodeSnapshots map[string][]byte
}

type TaskType

type TaskType int

The type of a task

const (
	StreamTask TaskType = iota
	BatchTask
	InvalidTask
)

func (TaskType) MarshalText

func (t TaskType) MarshalText() ([]byte, error)

func (TaskType) String

func (t TaskType) String() string

func (*TaskType) UnmarshalText

func (t *TaskType) UnmarshalText(text []byte) error

type Template

type Template struct {
	// contains filtered or unexported fields
}

func (*Template) Dot

func (t *Template) Dot() string

func (*Template) Vars

func (t *Template) Vars() map[string]tick.Var

type TimeDimension

type TimeDimension struct {
	Length time.Duration
	Offset time.Duration
}

type UDFNode

type UDFNode struct {
	// contains filtered or unexported fields
}

User defined function

func (*UDFNode) Wait

func (n *UDFNode) Wait() error

type UDFProcess

type UDFProcess struct {
	// contains filtered or unexported fields
}

UDFProcess wraps an external process and sends and receives data over STDIN and STDOUT. Lines received over STDERR are logged via normal Kapacitor logging.

func NewUDFProcess

func NewUDFProcess(
	taskName, nodeName string,
	commander command.Commander,
	cmdSpec command.Spec,
	d udf.Diagnostic,
	timeout time.Duration,
	abortCallback func(),
) *UDFProcess

func (*UDFProcess) Abort

func (p *UDFProcess) Abort(err error)

func (*UDFProcess) Close

func (p *UDFProcess) Close() error

Stop the UDFProcess cleanly.

Calling Close should only be done once the owner has stopped writing to the *In channel, at which point the remaining data will be processed and the subprocess will be allowed to exit cleanly.

func (*UDFProcess) In

func (p *UDFProcess) In() chan<- edge.Message

func (*UDFProcess) Info

func (p *UDFProcess) Info() (udf.Info, error)

func (*UDFProcess) Init

func (p *UDFProcess) Init(options []*agent.Option) error

func (*UDFProcess) Open

func (p *UDFProcess) Open() error

Open the UDFProcess

func (*UDFProcess) Out

func (p *UDFProcess) Out() <-chan edge.Message

func (*UDFProcess) Restore

func (p *UDFProcess) Restore(snapshot []byte) error

func (*UDFProcess) Snapshot

func (p *UDFProcess) Snapshot() ([]byte, error)

type UDFService

type UDFService interface {
	List() []string
	Info(name string) (udf.Info, bool)
	Create(name, taskID, nodeID string, d udf.Diagnostic, abortCallback func()) (udf.Interface, error)
}

type UDFSocket

type UDFSocket struct {
	// contains filtered or unexported fields
}

func NewUDFSocket

func NewUDFSocket(
	taskName, nodeName string,
	socket Socket,
	d udf.Diagnostic,
	timeout time.Duration,
	abortCallback func(),
) *UDFSocket

func (*UDFSocket) Abort

func (s *UDFSocket) Abort(err error)

func (*UDFSocket) Close

func (s *UDFSocket) Close() error

func (*UDFSocket) In

func (s *UDFSocket) In() chan<- edge.Message

func (*UDFSocket) Info

func (s *UDFSocket) Info() (udf.Info, error)

func (*UDFSocket) Init

func (s *UDFSocket) Init(options []*agent.Option) error

func (*UDFSocket) Open

func (s *UDFSocket) Open() error

func (*UDFSocket) Out

func (s *UDFSocket) Out() <-chan edge.Message

func (*UDFSocket) Restore

func (s *UDFSocket) Restore(snapshot []byte) error

func (*UDFSocket) Snapshot

func (s *UDFSocket) Snapshot() ([]byte, error)

type UnionNode

type UnionNode struct {
	// contains filtered or unexported fields
}

func (*UnionNode) Barrier

func (n *UnionNode) Barrier(src int, b edge.BarrierMessage) error

func (*UnionNode) BufferedBatch

func (n *UnionNode) BufferedBatch(src int, batch edge.BufferedBatchMessage) error

func (*UnionNode) Finish

func (n *UnionNode) Finish() error

func (*UnionNode) Point

func (n *UnionNode) Point(src int, p edge.PointMessage) error

func (*UnionNode) Wait

func (n *UnionNode) Wait() error

type WhereNode

type WhereNode struct {
	// contains filtered or unexported fields
}

func (*WhereNode) NewGroup

func (n *WhereNode) NewGroup(group edge.GroupInfo, first edge.PointMeta) (edge.Receiver, error)

func (*WhereNode) Wait

func (n *WhereNode) Wait() error

type WindowNode

type WindowNode struct {
	// contains filtered or unexported fields
}

func (*WindowNode) DeleteGroup

func (n *WindowNode) DeleteGroup(group models.GroupID)

func (*WindowNode) NewGroup

func (n *WindowNode) NewGroup(group edge.GroupInfo, first edge.PointMeta) (edge.Receiver, error)

func (*WindowNode) Wait

func (n *WindowNode) Wait() error

Directories

Path Synopsis
Alert provides a framework for tracking events in a publish subscribe system.
Alert provides a framework for tracking events in a publish subscribe system.
client
v1
Kapacitor HTTP API client written in Go
Kapacitor HTTP API client written in Go
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
kapacitor command
kapacitord command
Package edge provides mechanisms for message passing along edges.
Package edge provides mechanisms for message passing along edges.
This package is a fork of the golang expvar expvar.Var types.
This package is a fork of the golang expvar expvar.Var types.
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.
Provides a server type for starting and configuring a Kapacitor server.
Provides a server type for starting and configuring a Kapacitor server.
services
alert
Alert provides an implementation of the HTTP API for managing alert topics, handlers and events.
Alert provides an implementation of the HTTP API for managing alert topics, handlers and events.
config/override
Overrider provides an API for overriding and reading redacted values for a configuration object.
Overrider provides an API for overriding and reading redacted values for a configuration object.
dns
ec2
gce
httpd
Provides an HTTP API exposing many components of Kapacitor.
Provides an HTTP API exposing many components of Kapacitor.
k8s
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.
storage
The storage package provides a key/value based interface for storing Kapacitor metadata.
The storage package provides a key/value based interface for storing Kapacitor metadata.
udf
udp
TICKscript is a simple invocation chaining DSL.
TICKscript is a simple invocation chaining DSL.
ast
cmd/tickdoc command
Tickdoc is a simple utility similar to godoc that generates documentation from comments.
Tickdoc is a simple utility similar to godoc that generates documentation from comments.
cmd/tickfmt command
udf
agent
Package agent is a generated protocol buffer package.
Package agent is a generated protocol buffer package.
Package uuid generates and parses UUIDs.
Package uuid generates and parses UUIDs.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL