pipeline

package
v1.3.0-beta1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2017 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Provides an API for constructing data processing pipelines.

The nodes defined in this package just define how nodes can be linked together not the actual implementation of the transformation functions.

Index

Constants

View Source
const (
	DefaultNamespaceTag = "namespace"
	DefaultKindTag      = "kind"
	DefaultResourceTag  = "resource"
)
View Source
const DefaultBufferSize = 1000
View Source
const DefaultFlushInterval = time.Second * 10

Variables

This section is empty.

Functions

This section is empty.

Types

type AlertNode

type AlertNode struct {

	// Topic specifies the name of an alert topic to which,
	// alerts will be published.
	// Alert handlers can be configured per topic, see the API documentation.
	Topic string

	// Template for constructing a unique ID for a given alert.
	//
	// Available template data:
	//
	//    * Name -- Measurement name.
	//    * TaskName -- The name of the task
	//    * Group -- Concatenation of all group-by tags of the form [key=value,]+.
	//        If no groupBy is performed equal to literal 'nil'.
	//    * Tags -- Map of tags. Use '{{ index .Tags "key" }}' to get a specific tag value.
	//    * ServerInfo -- Information about the running server. Available nested fields are:
	//        Hostname, ClusterID and ServerID.
	//
	// Example:
	//   stream
	//       |from()
	//           .measurement('cpu')
	//           .groupBy('cpu')
	//       |alert()
	//           .id('kapacitor/{{ .Name }}/{{ .Group }}')
	//
	// ID: kapacitor/cpu/cpu=cpu0,
	//
	// Example:
	//   stream
	//       |from()
	//           .measurement('cpu')
	//           .groupBy('service')
	//       |alert()
	//           .id('kapacitor/{{ index .Tags "service" }}')
	//
	// ID: kapacitor/authentication
	//
	// Example:
	//   stream
	//       |from()
	//           .measurement('cpu')
	//           .groupBy('service', 'host')
	//       |alert()
	//           .id('kapacitor/{{ index .Tags "service" }}/{{ index .Tags "host" }}')
	//
	// ID: kapacitor/authentication/auth001.example.com
	//
	// Default: {{ .Name }}:{{ .Group }}
	Id string

	// Template for constructing a meaningful message for the alert.
	//
	// Available template data:
	//
	//    * ID -- The ID of the alert.
	//    * Name -- Measurement name.
	//    * TaskName -- The name of the task
	//    * Group -- Concatenation of all group-by tags of the form [key=value,]+.
	//        If no groupBy is performed equal to literal 'nil'.
	//    * Tags -- Map of tags. Use '{{ index .Tags "key" }}' to get a specific tag value.
	//    * Level -- Alert Level, one of: INFO, WARNING, CRITICAL.
	//    * Fields -- Map of fields. Use '{{ index .Fields "key" }}' to get a specific field value.
	//    * Time -- The time of the point that triggered the event.
	//
	// Example:
	//   stream
	//       |from()
	//           .measurement('cpu')
	//           .groupBy('service', 'host')
	//       |alert()
	//           .id('{{ index .Tags "service" }}/{{ index .Tags "host" }}')
	//           .message('{{ .ID }} is {{ .Level}} value: {{ index .Fields "value" }}')
	//
	// Message: authentication/auth001.example.com is CRITICAL value:42
	//
	// Default: {{ .ID }} is {{ .Level }}
	Message string

	// Template for constructing a detailed HTML message for the alert.
	// The same template data is available as the AlertNode.Message property,
	// in addition to a Message field that contains the rendered Message value.
	//
	// The intent is that the Message property be a single line summary while the
	// Details property is a more detailed message possibly spanning multiple lines,
	// and containing HTML formatting.
	//
	// This template is rendered using the html/template package in Go so that
	// safe and valid HTML can be generated.
	//
	// The `json` method is available within the template to convert any variable to a valid
	// JSON string.
	//
	// Example:
	//    |alert()
	//       .id('{{ .Name }}')
	//       .details(”'
	//<h1>{{ .ID }}</h1>
	//<b>{{ .Message }}</b>
	//Value: {{ index .Fields "value" }}
	//”')
	//       .email()
	//
	// Default: {{ json . }}
	Details string

	// Filter expression for the INFO alert level.
	// An empty value indicates the level is invalid and is skipped.
	Info *ast.LambdaNode
	// Filter expression for the WARNING alert level.
	// An empty value indicates the level is invalid and is skipped.
	Warn *ast.LambdaNode
	// Filter expression for the CRITICAL alert level.
	// An empty value indicates the level is invalid and is skipped.
	Crit *ast.LambdaNode

	// Filter expression for reseting the INFO alert level to lower level.
	InfoReset *ast.LambdaNode
	// Filter expression for reseting the WARNING alert level to lower level.
	WarnReset *ast.LambdaNode
	// Filter expression for reseting the CRITICAL alert level to lower level.
	CritReset *ast.LambdaNode

	//tick:ignore
	UseFlapping bool `tick:"Flapping"`
	//tick:ignore
	FlapLow float64
	//tick:ignore
	FlapHigh float64

	// Number of previous states to remember when computing flapping levels and
	// checking for state changes.
	// Minimum value is 2 in order to keep track of current and previous states.
	//
	// Default: 21
	History int64

	// Optional tag key to use when tagging the data with the alert level.
	LevelTag string
	// Optional field key to add to the data, containing the alert level as a string.
	LevelField string

	// Optional field key to add to the data, containing the alert message.
	MessageField string

	// Optional field key to add the alert duration to the data.
	// The duration is always in units of nanoseconds.
	DurationField string

	// Optional tag key to use when tagging the data with the alert ID.
	IdTag string
	// Optional field key to add to the data, containing the alert ID as a string.
	IdField string

	// Indicates an alert should trigger only if all points in a batch match the criteria
	// tick:ignore
	AllFlag bool `tick:"All"`

	// Do not send recovery events.
	// tick:ignore
	NoRecoveriesFlag bool `tick:"NoRecoveries"`

	// Send alerts only on state changes.
	// tick:ignore
	IsStateChangesOnly bool `tick:"StateChangesOnly"`

	// Maximum interval to ignore non state changed events
	// tick:ignore
	StateChangesOnlyDuration time.Duration

	// Post the JSON alert data to the specified URL.
	// tick:ignore
	PostHandlers []*PostHandler `tick:"Post"`

	// Send the JSON alert data to the specified endpoint via TCP.
	// tick:ignore
	TcpHandlers []*TcpHandler `tick:"Tcp"`

	// Email handlers
	// tick:ignore
	EmailHandlers []*EmailHandler `tick:"Email"`

	// A commands to run when an alert triggers
	// tick:ignore
	ExecHandlers []*ExecHandler `tick:"Exec"`

	// Log JSON alert data to file. One event per line.
	// tick:ignore
	LogHandlers []*LogHandler `tick:"Log"`

	// Send alert to VictorOps.
	// tick:ignore
	VictorOpsHandlers []*VictorOpsHandler `tick:"VictorOps"`

	// Send alert to PagerDuty.
	// tick:ignore
	PagerDutyHandlers []*PagerDutyHandler `tick:"PagerDuty"`

	// Send alert to Pushover.
	// tick:ignore
	PushoverHandlers []*PushoverHandler `tick:"Pushover"`

	// Send alert to Sensu.
	// tick:ignore
	SensuHandlers []*SensuHandler `tick:"Sensu"`

	// Send alert to Slack.
	// tick:ignore
	SlackHandlers []*SlackHandler `tick:"Slack"`

	// Send alert to Telegram.
	// tick:ignore
	TelegramHandlers []*TelegramHandler `tick:"Telegram"`

	// Send alert to HipChat.
	// tick:ignore
	HipChatHandlers []*HipChatHandler `tick:"HipChat"`

	// Send alert to Alerta.
	// tick:ignore
	AlertaHandlers []*AlertaHandler `tick:"Alerta"`

	// Send alert to OpsGenie
	// tick:ignore
	OpsGenieHandlers []*OpsGenieHandler `tick:"OpsGenie"`

	// Send alert to Talk.
	// tick:ignore
	TalkHandlers []*TalkHandler `tick:"Talk"`

	// Send alert using SNMPtraps.
	// tick:ignore
	SNMPTrapHandlers []*SNMPTrapHandler `tick:"SnmpTrap"`
	// contains filtered or unexported fields
}

An AlertNode can trigger an event of varying severity levels, and pass the event to alert handlers. The criteria for triggering an alert is specified via a [lambda expression](/kapacitor/latest/tick/expr/). See AlertNode.Info, AlertNode.Warn, and AlertNode.Crit below.

Different event handlers can be configured for each AlertNode. Some handlers like Email, HipChat, Sensu, Slack, OpsGenie, VictorOps, PagerDuty, Telegram and Talk have a configuration option 'global' that indicates that all alerts implicitly use the handler.

Available event handlers:

  • log -- log alert data to file.
  • post -- HTTP POST data to a specified URL.
  • tcp -- Send data to a specified address via raw TCP.
  • email -- Send and email with alert data.
  • exec -- Execute a command passing alert data over STDIN.
  • HipChat -- Post alert message to HipChat room.
  • Alerta -- Post alert message to Alerta.
  • Sensu -- Post alert message to Sensu client.
  • Slack -- Post alert message to Slack channel.
  • SNMPTraps -- Trigger SNMP traps.
  • OpsGenie -- Send alert to OpsGenie.
  • VictorOps -- Send alert to VictorOps.
  • PagerDuty -- Send alert to PagerDuty.
  • Pushover -- Send alert to Pushover.
  • Talk -- Post alert message to Talk client.
  • Telegram -- Post alert message to Telegram client.

See below for more details on configuring each handler.

Each event that gets sent to a handler contains the following alert data:

  • ID -- the ID of the alert, user defined.
  • Message -- the alert message, user defined.
  • Details -- the alert details, user defined HTML content.
  • Time -- the time the alert occurred.
  • Duration -- the duration of the alert in nanoseconds.
  • Level -- one of OK, INFO, WARNING or CRITICAL.
  • Data -- influxql.Result containing the data that triggered the alert.

Events are sent to handlers if the alert is in a state other than 'OK' or the alert just changed to the 'OK' state from a non 'OK' state (a.k.a. the alert recovered). Using the AlertNode.StateChangesOnly property events will only be sent to handlers if the alert changed state.

It is valid to configure multiple alert handlers, even with the same type.

Example:

stream
        .groupBy('service')
    |alert()
        .id('kapacitor/{{ index .Tags "service" }}')
        .message('{{ .ID }} is {{ .Level }} value:{{ index .Fields "value" }}')
        .info(lambda: "value" > 10)
        .warn(lambda: "value" > 20)
        .crit(lambda: "value" > 30)
        .post("http://example.com/api/alert")
        .post("http://another.example.com/api/alert")
        .tcp("exampleendpoint.com:5678")
        .email('oncall@example.com')

Each expression maintains its own state. The order of execution for the expressions is not considered to be deterministic. For each point an expression may or may not be evaluated. If no expression is true then the alert is considered to be in the OK state.

Kapacitor supports alert reset expressions. This way when an alert enters a state, it can only be lowered in severity if its reset expression evaluates to true.

Example:

stream
    |from()
        .measurement('cpu')
        .where(lambda: "host" == 'serverA')
        .groupBy('host')
    |alert()
        .info(lambda: "value" > 60)
        .infoReset(lambda: "value" < 50)
        .warn(lambda: "value" > 70)
        .warnReset(lambda: "value" < 60)
        .crit(lambda: "value" > 80)
        .critReset(lambda: "value" < 70)

For example given the following values:

61 73 64 85 62 56 47

The corresponding alert states are:

INFO WARNING WARNING CRITICAL INFO INFO OK

Available Statistics:

  • alerts_triggered -- Total number of alerts triggered
  • oks_triggered -- Number of OK alerts triggered
  • infos_triggered -- Number of Info alerts triggered
  • warns_triggered -- Number of Warn alerts triggered
  • crits_triggered -- Number of Crit alerts triggered

func (*AlertNode) Alert added in v0.13.0

func (n *AlertNode) Alert() *AlertNode

Create an alert node, which can trigger alerts.

func (*AlertNode) Alerta added in v0.10.0

func (a *AlertNode) Alerta() *AlertaHandler

Send the alert to Alerta.

Example:

[alerta]
  enabled = true
  url = "https://alerta.yourdomain"
  token = "9hiWoDOZ9IbmHsOTeST123ABciWTIqXQVFDo63h9"
  environment = "Production"
  origin = "Kapacitor"

In order to not post a message every alert interval use AlertNode.StateChangesOnly so that only events where the alert changed state are sent to Alerta.

Send alerts to Alerta. The resource and event properties are required.

Example:

stream
     |alert()
         .alerta()
             .resource('Hostname or service')
             .event('Something went wrong')

Alerta also accepts optional alert information.

Example:

stream
     |alert()
         .alerta()
             .resource('Hostname or service')
             .event('Something went wrong')
             .environment('Development')
             .group('Dev. Servers')

NOTE: Alerta cannot be configured globally because of its required properties. tick:property

func (*AlertNode) All added in v0.13.0

func (n *AlertNode) All() *AlertNode

Indicates an alert should trigger only if all points in a batch match the criteria. Does not apply to stream alerts. tick:property

func (*AlertNode) Bottom added in v0.13.0

func (n *AlertNode) Bottom(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the bottom `num` points for `field` and sort by any extra tags or fields.

func (*AlertNode) ChainMethods added in v0.13.0

func (n *AlertNode) ChainMethods() map[string]reflect.Value

func (*AlertNode) Combine added in v1.0.0

func (n *AlertNode) Combine(expressions ...*ast.LambdaNode) *CombineNode

Combine this node with itself. The data are combined on timestamp.

func (*AlertNode) Count added in v0.13.0

func (n *AlertNode) Count(field string) *InfluxQLNode

Count the number of points.

func (*AlertNode) CumulativeSum added in v1.1.0

func (n *AlertNode) CumulativeSum(field string) *InfluxQLNode

Compute a cumulative sum of each point that is received. A point is emitted for every point collected.

func (*AlertNode) Default added in v0.13.0

func (n *AlertNode) Default() *DefaultNode

Create a node that can set defaults for missing tags or fields.

func (*AlertNode) Delete added in v1.0.0

func (n *AlertNode) Delete() *DeleteNode

Create a node that can delete tags or fields.

func (*AlertNode) Derivative added in v0.13.0

func (n *AlertNode) Derivative(field string) *DerivativeNode

Create a new node that computes the derivative of adjacent points.

func (*AlertNode) Difference added in v1.0.0

func (n *AlertNode) Difference(field string) *InfluxQLNode

Compute the difference between points independent of elapsed time.

func (*AlertNode) Distinct added in v0.13.0

func (n *AlertNode) Distinct(field string) *InfluxQLNode

Produce batch of only the distinct points.

func (*AlertNode) Elapsed added in v0.13.0

func (n *AlertNode) Elapsed(field string, unit time.Duration) *InfluxQLNode

Compute the elapsed time between points

func (*AlertNode) Email

func (a *AlertNode) Email(to ...string) *EmailHandler

Email the alert data.

If the To list is empty, the To addresses from the configuration are used. The email subject is the AlertNode.Message property. The email body is the AlertNode.Details property. The emails are sent as HTML emails and so the body can contain html markup.

If the 'smtp' section in the configuration has the option: global = true then all alerts are sent via email without the need to explicitly state it in the TICKscript.

Example:

|alert()
   .id('{{ .Name }}')
   // Email subject
   .message('{{ .ID }}:{{ .Level }}')
   //Email body as HTML
   .details('''

<h1>{{ .ID }}</h1> <b>{{ .Message }}</b> Value: {{ index .Fields "value" }} ”')

.email()

Send an email with custom subject and body.

Example:

[smtp]
  enabled = true
  host = "localhost"
  port = 25
  username = ""
  password = ""
  from = "kapacitor@example.com"
  to = ["oncall@example.com"]
  # Set global to true so all alert trigger emails.
  global = true
  state-changes-only =  true

Example:

stream
     |alert()

Send email to 'oncall@example.com' from 'kapacitor@example.com'

tick:property

func (*AlertNode) Eval added in v0.13.0

func (n *AlertNode) Eval(expressions ...*ast.LambdaNode) *EvalNode

Create an eval node that will evaluate the given transformation function to each data point. A list of expressions may be provided and will be evaluated in the order they are given. The results are available to later expressions.

func (*AlertNode) Exec

func (a *AlertNode) Exec(executable string, args ...string) *ExecHandler

Execute a command whenever an alert is triggered and pass the alert data over STDIN in JSON format. tick:property

func (*AlertNode) First added in v0.13.0

func (n *AlertNode) First(field string) *InfluxQLNode

Select the first point.

func (*AlertNode) Flapping

func (a *AlertNode) Flapping(low, high float64) *AlertNode

Perform flap detection on the alerts. The method used is similar method to Nagios: https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/3/en/flapping.html

Each different alerting level is considered a different state. The low and high thresholds are inverted thresholds of a percentage of state changes. Meaning that if the percentage of state changes goes above the `high` threshold, the alert enters a flapping state. The alert remains in the flapping state until the percentage of state changes goes below the `low` threshold. Typical values are low: 0.25 and high: 0.5. The percentage values represent the number state changes over the total possible number of state changes. A percentage change of 0.5 means that the alert changed state in half of the recorded history, and remained the same in the other half of the history. tick:property

func (*AlertNode) Flatten added in v1.0.0

func (n *AlertNode) Flatten() *FlattenNode

Flatten points with similar times into a single point.

func (*AlertNode) GroupBy added in v0.13.0

func (n *AlertNode) GroupBy(tag ...interface{}) *GroupByNode

Group the data by a set of tags.

Can pass literal * to group by all dimensions. Example:

|groupBy(*)

func (*AlertNode) HipChat added in v0.2.4

func (a *AlertNode) HipChat() *HipChatHandler

If the 'hipchat' section in the configuration has the option: global = true then all alerts are sent to HipChat without the need to explicitly state it in the TICKscript.

Example:

[hipchat]
  enabled = true
  url = "https://orgname.hipchat.com/v2/room"
  room = "Test Room"
  token = "9hiWoDOZ9IbmHsOTeST123ABciWTIqXQVFDo63h9"
  global = true
  state-changes-only = true

Example:

stream
     |alert()

Send alert to HipChat using default room 'Test Room'. tick:property

func (*AlertNode) HoltWinters added in v1.0.0

func (n *AlertNode) HoltWinters(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set.

func (*AlertNode) HoltWintersWithFit added in v1.0.0

func (n *AlertNode) HoltWintersWithFit(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set. This method also outputs all the points used to fit the data in addition to the forecasted data.

func (*AlertNode) HttpOut added in v0.13.0

func (n *AlertNode) HttpOut(endpoint string) *HTTPOutNode

Create an HTTP output node that caches the most recent data it has received. The cached data are available at the given endpoint. The endpoint is the relative path from the API endpoint of the running task. For example, if the task endpoint is at `/kapacitor/v1/tasks/<task_id>` and endpoint is `top10`, then the data can be requested from `/kapacitor/v1/tasks/<task_id>/top10`.

func (*AlertNode) HttpPost added in v1.3.0

func (n *AlertNode) HttpPost(url string) *HTTPPostNode

Creates an HTTP Post node that POSTS received data to the provided HTTP endpoint.

func (*AlertNode) InfluxDBOut added in v0.13.0

func (n *AlertNode) InfluxDBOut() *InfluxDBOutNode

Create an influxdb output node that will store the incoming data into InfluxDB.

func (*AlertNode) Join added in v0.13.0

func (n *AlertNode) Join(others ...Node) *JoinNode

Join this node with other nodes. The data are joined on timestamp.

func (*AlertNode) K8sAutoscale added in v1.1.0

func (n *AlertNode) K8sAutoscale() *K8sAutoscaleNode

Create a node that can trigger autoscale events for a kubernetes cluster.

func (*AlertNode) Last added in v0.13.0

func (n *AlertNode) Last(field string) *InfluxQLNode

Select the last point.

func (*AlertNode) Log

func (a *AlertNode) Log(filepath string) *LogHandler

Log JSON alert data to file. One event per line. Must specify the absolute path to the log file. It will be created if it does not exist. Example:

stream
     |alert()
         .log('/tmp/alert')

Example:

stream
     |alert()
         .log('/tmp/alert')
         .mode(0644)

tick:property

func (*AlertNode) Max added in v0.13.0

func (n *AlertNode) Max(field string) *InfluxQLNode

Select the maximum point.

func (*AlertNode) Mean added in v0.13.0

func (n *AlertNode) Mean(field string) *InfluxQLNode

Compute the mean of the data.

func (*AlertNode) Median added in v0.13.0

func (n *AlertNode) Median(field string) *InfluxQLNode

Compute the median of the data. Note, this method is not a selector, if you want the median point use `.percentile(field, 50.0)`.

func (*AlertNode) Min added in v0.13.0

func (n *AlertNode) Min(field string) *InfluxQLNode

Select the minimum point.

func (*AlertNode) Mode added in v1.0.0

func (n *AlertNode) Mode(field string) *InfluxQLNode

Compute the mode of the data.

func (*AlertNode) MovingAverage added in v1.0.0

func (n *AlertNode) MovingAverage(field string, window int64) *InfluxQLNode

Compute a moving average of the last window points. No points are emitted until the window is full.

func (*AlertNode) NoRecoveries added in v1.0.0

func (n *AlertNode) NoRecoveries() *AlertNode

Do not send recovery alerts. tick:property

func (*AlertNode) OpsGenie added in v0.2.4

func (a *AlertNode) OpsGenie() *OpsGenieHandler

Send alert to OpsGenie. To use OpsGenie alerting you must first enable the 'Alert Ingestion API' in the 'Integrations' section of OpsGenie. Then place the API key from the URL into the 'opsgenie' section of the Kapacitor configuration.

Example:

[opsgenie]
  enabled = true
  api-key = "xxxxx"
  teams = ["everyone"]
  recipients = ["jim", "bob"]

With the correct configuration you can now use OpsGenie in TICKscripts.

Example:

stream
     |alert()
         .opsGenie()

Send alerts to OpsGenie using the teams and recipients in the configuration file.

Example:

stream
     |alert()
         .opsGenie()
         .teams('team_rocket','team_test')

Send alerts to OpsGenie with team set to 'team_rocket' and 'team_test'

If the 'opsgenie' section in the configuration has the option: global = true then all alerts are sent to OpsGenie without the need to explicitly state it in the TICKscript.

Example:

[opsgenie]
  enabled = true
  api-key = "xxxxx"
  recipients = ["johndoe"]
  global = true

Example:

stream
     |alert()

Send alert to OpsGenie using the default recipients, found in the configuration. tick:property

func (*AlertNode) PagerDuty

func (a *AlertNode) PagerDuty() *PagerDutyHandler

Send the alert to PagerDuty. To use PagerDuty alerting you must first follow the steps to enable a new 'Generic API' service.

From https://developer.pagerduty.com/documentation/integration/events

  1. In your account, under the Services tab, click "Add New Service".
  2. Enter a name for the service and select an escalation policy. Then, select "Generic API" for the Service Type.
  3. Click the "Add Service" button.
  4. Once the service is created, you'll be taken to the service page. On this page, you'll see the "Service key", which is needed to access the API

Place the 'service key' into the 'pagerduty' section of the Kapacitor configuration as the option 'service-key'.

Example:

[pagerduty]
  enabled = true
  service-key = "xxxxxxxxx"

With the correct configuration you can now use PagerDuty in TICKscripts.

Example:

stream
     |alert()
         .pagerDuty()

If the 'pagerduty' section in the configuration has the option: global = true then all alerts are sent to PagerDuty without the need to explicitly state it in the TICKscript.

Example:

[pagerduty]
  enabled = true
  service-key = "xxxxxxxxx"
  global = true

Example:

stream
     |alert()

Send alert to PagerDuty. tick:property

func (*AlertNode) Percentile added in v0.13.0

func (n *AlertNode) Percentile(field string, percentile float64) *InfluxQLNode

Select a point at the given percentile. This is a selector function, no interpolation between points is performed.

func (*AlertNode) Post

func (a *AlertNode) Post(url string) *PostHandler

HTTP POST JSON alert data to a specified URL. tick:property

func (*AlertNode) Pushover added in v1.3.0

func (a *AlertNode) Pushover() *PushoverHandler

Send the alert to Pushover. Register your application with Pushover at https://pushover.net/apps/build to get a Pushover token.

Alert Level Mapping: OK - Sends a -2 priority level. Info - Sends a -1 priority level. Warning - Sends a 0 priority level. Critical - Sends a 1 priority level.

Example:

[pushover]
  enabled = true
  token = "9hiWoDOZ9IbmHsOTeST123ABciWTIqXQVFDo63h9"
  user_key = "Pushover"

Example:

stream
     |alert()
         .pushover()
          .sound('siren')
          .user_key('other user')
          .device('mydev')
          .title('mytitle')
          .URL('myurl')
          .URLTitle('mytitle')

Send alerts to Pushover.

tick:property

func (*AlertNode) Sample added in v0.13.0

func (n *AlertNode) Sample(rate interface{}) *SampleNode

Create a new node that samples the incoming points or batches.

One point will be emitted every count or duration specified.

func (*AlertNode) Sensu added in v0.10.0

func (a *AlertNode) Sensu() *SensuHandler

Send the alert to Sensu.

Example:

[sensu]
  enabled = true
  url = "http://sensu:3030"
  source = "Kapacitor"

Example:

stream
     |alert()
         .sensu()

Send alerts to Sensu client.

tick:property

func (*AlertNode) Shift added in v0.13.0

func (n *AlertNode) Shift(shift time.Duration) *ShiftNode

Create a new node that shifts the incoming points or batches in time.

func (*AlertNode) Slack

func (a *AlertNode) Slack() *SlackHandler

Send the alert to Slack. To allow Kapacitor to post to Slack, go to the URL https://slack.com/services/new/incoming-webhook and create a new incoming webhook and place the generated URL in the 'slack' configuration section.

Example:

[slack]
  enabled = true
  url = "https://hooks.slack.com/services/xxxxxxxxx/xxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxx"
  channel = "#general"

In order to not post a message every alert interval use AlertNode.StateChangesOnly so that only events where the alert changed state are posted to the channel.

Example:

stream
     |alert()
         .slack()

Send alerts to Slack channel in the configuration file.

Example:

stream
     |alert()
         .slack()
         .channel('#alerts')

Send alerts to Slack channel '#alerts'

Example:

stream
     |alert()
         .slack()
         .channel('@jsmith')

Send alert to user '@jsmith'

If the 'slack' section in the configuration has the option: global = true then all alerts are sent to Slack without the need to explicitly state it in the TICKscript.

Example:

[slack]
  enabled = true
  url = "https://hooks.slack.com/services/xxxxxxxxx/xxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxx"
  channel = "#general"
  global = true
  state-changes-only = true

Example:

stream
     |alert()

Send alert to Slack using default channel '#general'. tick:property

func (*AlertNode) SnmpTrap added in v1.2.0

func (a *AlertNode) SnmpTrap(trapOid string) *SNMPTrapHandler

Send the alert using SNMP traps. To allow Kapacitor to post SNMP traps,

Example:

[snmptrap]
  enabled = true
  addr = "127.0.0.1:9162"
  community = "public"

Example:

stream
     |alert()
         .snmpTrap('1.1.1.1')
             .data('1.3.6.1.2.1.1.7', 'i', '{{ index .Field "value" }}')

Send alerts to `target-ip:target-port` on OID '1.3.6.1.2.1.1.7'

tick:property

func (*AlertNode) Spread added in v0.13.0

func (n *AlertNode) Spread(field string) *InfluxQLNode

Compute the difference between `min` and `max` points.

func (*AlertNode) StateChangesOnly

func (a *AlertNode) StateChangesOnly(maxInterval ...time.Duration) *AlertNode

Only sends events where the state changed. Each different alert level OK, INFO, WARNING, and CRITICAL are considered different states.

Example:

stream
    |from()
        .measurement('cpu')
    |window()
         .period(10s)
         .every(10s)
    |alert()
        .crit(lambda: "value" > 10)
        .stateChangesOnly()
        .slack()

If the "value" is greater than 10 for a total of 60s, then only two events will be sent. First, when the value crosses the threshold, and second, when it falls back into an OK state. Without stateChangesOnly, the alert would have triggered 7 times: 6 times for each 10s period where the condition was met and once more for the recovery.

An optional maximum interval duration can be provided. An event will not be ignore (aka trigger an alert) if more than the maximum interval has elapsed since the last alert.

Example:

stream
    |from()
        .measurement('cpu')
    |window()
         .period(10s)
         .every(10s)
    |alert()
        .crit(lambda: "value" > 10)
        .stateChangesOnly(10m)
        .slack()

The above usage will only trigger alerts to slack on state changes or at least every 10 minutes.

tick:property

func (*AlertNode) StateCount added in v1.3.0

func (n *AlertNode) StateCount(expression *ast.LambdaNode) *StateCountNode

Create a node that tracks number of consecutive points in a given state.

func (*AlertNode) StateDuration added in v1.3.0

func (n *AlertNode) StateDuration(expression *ast.LambdaNode) *StateDurationNode

Create a node that tracks duration in a given state.

func (*AlertNode) Stddev added in v0.13.0

func (n *AlertNode) Stddev(field string) *InfluxQLNode

Compute the standard deviation.

func (*AlertNode) Sum added in v0.13.0

func (n *AlertNode) Sum(field string) *InfluxQLNode

Compute the sum of all values.

func (*AlertNode) Talk added in v0.10.1

func (a *AlertNode) Talk() *TalkHandler

Send the alert to Talk. To use Talk alerting you must first follow the steps to create a new incoming webhook.

  1. Go to the URL https:/account.jianliao.com/signin.
  2. Sign in with you account. under the Team tab, click "Integrations".
  3. Select "Customize service", click incoming Webhook "Add" button.
  4. After choose the topic to connect with "xxx", click "Confirm Add" button.
  5. Once the service is created, you'll see the "Generate Webhook url".

Place the 'Generate Webhook url' into the 'Talk' section of the Kapacitor configuration as the option 'url'.

Example:

[talk]
  enabled = true
  url = "https://jianliao.com/v2/services/webhook/uuid"
  author_name = "Kapacitor"

Example:

stream
     |alert()
         .talk()

Send alerts to Talk client.

tick:property

func (*AlertNode) Tcp added in v1.0.1

func (a *AlertNode) Tcp(address string) *TcpHandler

Send JSON alert data to a specified address over TCP. tick:property

func (*AlertNode) Telegram added in v1.0.0

func (a *AlertNode) Telegram() *TelegramHandler

Send the alert to Telegram. For step-by-step instructions on setting up Kapacitor with Telegram, see the Event Handler Setup Guide (https://docs.influxdata.com//kapacitor/latest/guides/event-handler-setup/#telegram-setup). To allow Kapacitor to post to Telegram,

Example:

   [telegram]
     enabled = true
     token = "123456789:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
     chat-id = "xxxxxxxxx"
     parse-mode = "Markdown"
	disable-web-page-preview = true
	disable-notification = false

In order to not post a message every alert interval use AlertNode.StateChangesOnly so that only events where the alert changed state are posted to the chat-id.

Example:

stream
     |alert()
         .telegram()

Send alerts to Telegram chat-id in the configuration file.

Example:

stream
     |alert()
         .telegram()
         .chatId('xxxxxxx')

Send alerts to Telegram user/group 'xxxxxx'

If the 'telegram' section in the configuration has the option: global = true then all alerts are sent to Telegram without the need to explicitly state it in the TICKscript.

Example:

[telegram]
  enabled = true
  token = "123456789:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  chat-id = "xxxxxxxxx"
  global = true
  state-changes-only = true

Example:

stream
     |alert()

Send alert to Telegram using default chat-id 'xxxxxxxx'. tick:property

func (*AlertNode) Top added in v0.13.0

func (n *AlertNode) Top(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the top `num` points for `field` and sort by any extra tags or fields.

func (*AlertNode) Union added in v0.13.0

func (n *AlertNode) Union(node ...Node) *UnionNode

Perform the union of this node and all other given nodes.

func (*AlertNode) VictorOps

func (a *AlertNode) VictorOps() *VictorOpsHandler

Send alert to VictorOps. To use VictorOps alerting you must first enable the 'Alert Ingestion API' in the 'Integrations' section of VictorOps. Then place the API key from the URL into the 'victorops' section of the Kapacitor configuration.

Example:

[victorops]
  enabled = true
  api-key = "xxxxx"
  routing-key = "everyone"

With the correct configuration you can now use VictorOps in TICKscripts.

Example:

stream
     |alert()
         .victorOps()

Send alerts to VictorOps using the routing key in the configuration file.

Example:

stream
     |alert()
         .victorOps()
         .routingKey('team_rocket')

Send alerts to VictorOps with routing key 'team_rocket'

If the 'victorops' section in the configuration has the option: global = true then all alerts are sent to VictorOps without the need to explicitly state it in the TICKscript.

Example:

[victorops]
  enabled = true
  api-key = "xxxxx"
  routing-key = "everyone"
  global = true

Example:

stream
     |alert()

Send alert to VictorOps using the default routing key, found in the configuration. tick:property

func (*AlertNode) Where added in v0.13.0

func (n *AlertNode) Where(expression *ast.LambdaNode) *WhereNode

Create a new node that filters the data stream by a given expression.

func (*AlertNode) Window added in v0.13.0

func (n *AlertNode) Window() *WindowNode

Create a new node that windows the stream by time.

NOTE: Window can only be applied to stream edges.

type AlertaHandler added in v0.10.0

type AlertaHandler struct {
	*AlertNode

	// Alerta authentication token.
	// If empty uses the token from the configuration.
	Token string

	// Alerta resource.
	// Can be a template and has access to the same data as the AlertNode.Details property.
	// Default: {{ .Name }}
	Resource string

	// Alerta event.
	// Can be a template and has access to the same data as the idInfo property.
	// Default: {{ .ID }}
	Event string

	// Alerta environment.
	// Can be a template and has access to the same data as the AlertNode.Details property.
	// Defaut is set from the configuration.
	Environment string

	// Alerta group.
	// Can be a template and has access to the same data as the AlertNode.Details property.
	// Default: {{ .Group }}
	Group string

	// Alerta value.
	// Can be a template and has access to the same data as the AlertNode.Details property.
	// Default is an empty string.
	Value string

	// Alerta origin.
	// If empty uses the origin from the configuration.
	Origin string

	// List of effected Services
	// tick:ignore
	Service []string `tick:"Services"`
}

tick:embedded:AlertNode.Alerta

func (AlertaHandler) Alert added in v0.13.0

func (n AlertaHandler) Alert() *AlertNode

Create an alert node, which can trigger alerts.

func (AlertaHandler) Bottom added in v0.13.0

func (n AlertaHandler) Bottom(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the bottom `num` points for `field` and sort by any extra tags or fields.

func (AlertaHandler) Combine added in v1.0.0

func (n AlertaHandler) Combine(expressions ...*ast.LambdaNode) *CombineNode

Combine this node with itself. The data are combined on timestamp.

func (AlertaHandler) Count added in v0.13.0

func (n AlertaHandler) Count(field string) *InfluxQLNode

Count the number of points.

func (AlertaHandler) CumulativeSum added in v1.1.0

func (n AlertaHandler) CumulativeSum(field string) *InfluxQLNode

Compute a cumulative sum of each point that is received. A point is emitted for every point collected.

func (AlertaHandler) Default added in v0.13.0

func (n AlertaHandler) Default() *DefaultNode

Create a node that can set defaults for missing tags or fields.

func (AlertaHandler) Delete added in v1.0.0

func (n AlertaHandler) Delete() *DeleteNode

Create a node that can delete tags or fields.

func (AlertaHandler) Derivative added in v0.13.0

func (n AlertaHandler) Derivative(field string) *DerivativeNode

Create a new node that computes the derivative of adjacent points.

func (AlertaHandler) Difference added in v1.0.0

func (n AlertaHandler) Difference(field string) *InfluxQLNode

Compute the difference between points independent of elapsed time.

func (AlertaHandler) Distinct added in v0.13.0

func (n AlertaHandler) Distinct(field string) *InfluxQLNode

Produce batch of only the distinct points.

func (AlertaHandler) Elapsed added in v0.13.0

func (n AlertaHandler) Elapsed(field string, unit time.Duration) *InfluxQLNode

Compute the elapsed time between points

func (AlertaHandler) Eval added in v0.13.0

func (n AlertaHandler) Eval(expressions ...*ast.LambdaNode) *EvalNode

Create an eval node that will evaluate the given transformation function to each data point. A list of expressions may be provided and will be evaluated in the order they are given. The results are available to later expressions.

func (AlertaHandler) First added in v0.13.0

func (n AlertaHandler) First(field string) *InfluxQLNode

Select the first point.

func (AlertaHandler) Flatten added in v1.0.0

func (n AlertaHandler) Flatten() *FlattenNode

Flatten points with similar times into a single point.

func (AlertaHandler) GroupBy added in v0.13.0

func (n AlertaHandler) GroupBy(tag ...interface{}) *GroupByNode

Group the data by a set of tags.

Can pass literal * to group by all dimensions. Example:

|groupBy(*)

func (AlertaHandler) HoltWinters added in v1.0.0

func (n AlertaHandler) HoltWinters(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set.

func (AlertaHandler) HoltWintersWithFit added in v1.0.0

func (n AlertaHandler) HoltWintersWithFit(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set. This method also outputs all the points used to fit the data in addition to the forecasted data.

func (AlertaHandler) HttpOut added in v0.13.0

func (n AlertaHandler) HttpOut(endpoint string) *HTTPOutNode

Create an HTTP output node that caches the most recent data it has received. The cached data are available at the given endpoint. The endpoint is the relative path from the API endpoint of the running task. For example, if the task endpoint is at `/kapacitor/v1/tasks/<task_id>` and endpoint is `top10`, then the data can be requested from `/kapacitor/v1/tasks/<task_id>/top10`.

func (AlertaHandler) HttpPost added in v1.3.0

func (n AlertaHandler) HttpPost(url string) *HTTPPostNode

Creates an HTTP Post node that POSTS received data to the provided HTTP endpoint.

func (AlertaHandler) InfluxDBOut added in v0.13.0

func (n AlertaHandler) InfluxDBOut() *InfluxDBOutNode

Create an influxdb output node that will store the incoming data into InfluxDB.

func (AlertaHandler) Join added in v0.13.0

func (n AlertaHandler) Join(others ...Node) *JoinNode

Join this node with other nodes. The data are joined on timestamp.

func (AlertaHandler) K8sAutoscale added in v1.1.0

func (n AlertaHandler) K8sAutoscale() *K8sAutoscaleNode

Create a node that can trigger autoscale events for a kubernetes cluster.

func (AlertaHandler) Last added in v0.13.0

func (n AlertaHandler) Last(field string) *InfluxQLNode

Select the last point.

func (AlertaHandler) Max added in v0.13.0

func (n AlertaHandler) Max(field string) *InfluxQLNode

Select the maximum point.

func (AlertaHandler) Mean added in v0.13.0

func (n AlertaHandler) Mean(field string) *InfluxQLNode

Compute the mean of the data.

func (AlertaHandler) Median added in v0.13.0

func (n AlertaHandler) Median(field string) *InfluxQLNode

Compute the median of the data. Note, this method is not a selector, if you want the median point use `.percentile(field, 50.0)`.

func (AlertaHandler) Min added in v0.13.0

func (n AlertaHandler) Min(field string) *InfluxQLNode

Select the minimum point.

func (AlertaHandler) Mode added in v1.0.0

func (n AlertaHandler) Mode(field string) *InfluxQLNode

Compute the mode of the data.

func (AlertaHandler) MovingAverage added in v1.0.0

func (n AlertaHandler) MovingAverage(field string, window int64) *InfluxQLNode

Compute a moving average of the last window points. No points are emitted until the window is full.

func (AlertaHandler) Percentile added in v0.13.0

func (n AlertaHandler) Percentile(field string, percentile float64) *InfluxQLNode

Select a point at the given percentile. This is a selector function, no interpolation between points is performed.

func (AlertaHandler) Sample added in v0.13.0

func (n AlertaHandler) Sample(rate interface{}) *SampleNode

Create a new node that samples the incoming points or batches.

One point will be emitted every count or duration specified.

func (*AlertaHandler) Services added in v0.11.0

func (a *AlertaHandler) Services(service ...string) *AlertaHandler

List of effected services. If not specified defaults to the Name of the stream. tick:property

func (AlertaHandler) Shift added in v0.13.0

func (n AlertaHandler) Shift(shift time.Duration) *ShiftNode

Create a new node that shifts the incoming points or batches in time.

func (AlertaHandler) Spread added in v0.13.0

func (n AlertaHandler) Spread(field string) *InfluxQLNode

Compute the difference between `min` and `max` points.

func (AlertaHandler) StateCount added in v1.3.0

func (n AlertaHandler) StateCount(expression *ast.LambdaNode) *StateCountNode

Create a node that tracks number of consecutive points in a given state.

func (AlertaHandler) StateDuration added in v1.3.0

func (n AlertaHandler) StateDuration(expression *ast.LambdaNode) *StateDurationNode

Create a node that tracks duration in a given state.

func (AlertaHandler) Stddev added in v0.13.0

func (n AlertaHandler) Stddev(field string) *InfluxQLNode

Compute the standard deviation.

func (AlertaHandler) Sum added in v0.13.0

func (n AlertaHandler) Sum(field string) *InfluxQLNode

Compute the sum of all values.

func (AlertaHandler) Top added in v0.13.0

func (n AlertaHandler) Top(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the top `num` points for `field` and sort by any extra tags or fields.

func (AlertaHandler) Union added in v0.13.0

func (n AlertaHandler) Union(node ...Node) *UnionNode

Perform the union of this node and all other given nodes.

func (AlertaHandler) Where added in v0.13.0

func (n AlertaHandler) Where(expression *ast.LambdaNode) *WhereNode

Create a new node that filters the data stream by a given expression.

func (AlertaHandler) Window added in v0.13.0

func (n AlertaHandler) Window() *WindowNode

Create a new node that windows the stream by time.

NOTE: Window can only be applied to stream edges.

type BatchNode

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

A node that handles creating several child QueryNodes. Each call to `query` creates a child batch node that can further be configured. See QueryNode The `batch` variable in batch tasks is an instance of a BatchNode.

Example:

var errors = batch
                 |query('SELECT value from errors')
                 ...
var views = batch
                 |query('SELECT value from views')
                 ...

Available Statistics:

  • query_errors -- number of errors when querying
  • batches_queried -- number of batches returned from queries
  • points_queried -- total number of points in batches

func (*BatchNode) Children added in v0.13.0

func (n *BatchNode) Children() []Node

tick:ignore

func (*BatchNode) Deadman added in v0.13.0

func (n *BatchNode) Deadman(threshold float64, interval time.Duration, expr ...*ast.LambdaNode) *AlertNode

Helper function for creating an alert on low throughput, a.k.a. deadman's switch.

- Threshold -- trigger alert if throughput drops below threshold in points/interval. - Interval -- how often to check the throughput. - Expressions -- optional list of expressions to also evaluate. Useful for time of day alerting.

Example:

var data = stream
    |from()...
// Trigger critical alert if the throughput drops below 100 points per 10s and checked every 10s.
data
    |deadman(100.0, 10s)
//Do normal processing of data
data...

The above is equivalent to this Example:

var data = stream
    |from()...
// Trigger critical alert if the throughput drops below 100 points per 10s and checked every 10s.
data
    |stats(10s)
        .align()
    |derivative('emitted')
        .unit(10s)
        .nonNegative()
    |alert()
        .id('node \'stream0\' in task \'{{ .TaskName }}\'')
        .message('{{ .ID }} is {{ if eq .Level "OK" }}alive{{ else }}dead{{ end }}: {{ index .Fields "emitted" | printf "%0.3f" }} points/10s.')
        .crit(lambda: "emitted" <= 100.0)
//Do normal processing of data
data...

The `id` and `message` alert properties can be configured globally via the 'deadman' configuration section.

Since the AlertNode is the last piece it can be further modified as usual. Example:

var data = stream
    |from()...
// Trigger critical alert if the throughput drops below 100 points per 10s and checked every 10s.
data
    |deadman(100.0, 10s)
        .slack()
        .channel('#dead_tasks')
//Do normal processing of data
data...

You can specify additional lambda expressions to further constrain when the deadman's switch is triggered. Example:

var data = stream
    |from()...
// Trigger critical alert if the throughput drops below 100 points per 10s and checked every 10s.
// Only trigger the alert if the time of day is between 8am-5pm.
data
    |deadman(100.0, 10s, lambda: hour("time") >= 8 AND hour("time") <= 17)
//Do normal processing of data
data...

func (*BatchNode) Desc added in v0.12.0

func (n *BatchNode) Desc() string

tick:ignore

func (*BatchNode) ID added in v0.13.0

func (n *BatchNode) ID() ID

tick:ignore

func (*BatchNode) Name added in v0.13.0

func (n *BatchNode) Name() string

tick:ignore

func (*BatchNode) Parents added in v0.13.0

func (n *BatchNode) Parents() []Node

tick:ignore

func (*BatchNode) Provides added in v0.13.0

func (n *BatchNode) Provides() EdgeType

tick:ignore

func (*BatchNode) Query added in v0.13.0

func (b *BatchNode) Query(q string) *QueryNode

The query to execute. Must not contain a time condition in the `WHERE` clause or contain a `GROUP BY` clause. The time conditions are added dynamically according to the period, offset and schedule. The `GROUP BY` clause is added dynamically according to the dimensions passed to the `groupBy` method.

func (*BatchNode) SetName added in v0.13.0

func (n *BatchNode) SetName(name string)

tick:ignore

func (*BatchNode) Stats added in v0.13.0

func (n *BatchNode) Stats(interval time.Duration) *StatsNode

Create a new stream of data that contains the internal statistics of the node. The interval represents how often to emit the statistics based on real time. This means the interval time is independent of the times of the data points the source node is receiving.

func (*BatchNode) Wants added in v0.13.0

func (n *BatchNode) Wants() EdgeType

tick:ignore

type BooleanBulkPointAggregator added in v1.0.0

type BooleanBulkPointAggregator interface {
	influxql.BooleanPointAggregator
	influxql.BooleanBulkPointAggregator
}

type CombineNode added in v1.0.0

type CombineNode struct {

	// The list of expressions for matching pairs
	// tick:ignore
	Lambdas []*ast.LambdaNode

	// The alias names of the two parents.
	// Note:
	//       Names[1] corresponds to the left  parent
	//       Names[0] corresponds to the right parent
	// tick:ignore
	Names []string `tick:"As"`

	// The delimiter between the As names and existing field an tag keys.
	// Can be the empty string, but you are responsible for ensuring conflicts are not possible if you use the empty string.
	Delimiter string

	// The maximum duration of time that two incoming points
	// can be apart and still be considered to be equal in time.
	// The joined data point's time will be rounded to the nearest
	// multiple of the tolerance duration.
	Tolerance time.Duration

	// Maximum number of possible combinations.
	// Since the number of possible combinations can grow very rapidly
	// you can set a maximum number of combinations allowed.
	// If the max is crossed, an error is logged and the combinations are not calculated.
	// Default: 10,000
	Max int64
	// contains filtered or unexported fields
}

Combine the data from a single node with itself. Points with the same time are grouped and then combinations are created. The size of the combinations is defined by how many expressions are given. Combinations are order independent and will not ever include the same point multiple times.

Example:

stream
    |from()
        .measurement('request_latency')
    |combine(lambda: "service" == 'login', lambda: TRUE)
        .as('login', 'other')
        // points that are within 1 second are considered the same time.
        .tolerance(1s)
        // delimiter for new field and tag names
        .delimiter('.')
    // Change group by to be new other.service tag
    |groupBy('other.service')
    // Both the "value" fields from each data point have been prefixed
    // with the respective names 'login' and 'other'.
    |eval(lambda: "login.value" / "other.value")
       .as('ratio')
    ...

In the above example the data points for the `login` service are combined with the data points from all other services.

Example:

|combine(lambda: TRUE, lambda: TRUE)
    .as('login', 'other')

In the above example all combination pairs are created.

Example:

|combine(lambda: TRUE, lambda: TRUE, lambda: TRUE)
    .as('login', 'other', 'another')

In the above example all combinations triples are created.

func (*CombineNode) Alert added in v1.0.0

func (n *CombineNode) Alert() *AlertNode

Create an alert node, which can trigger alerts.

func (*CombineNode) As added in v1.0.0

func (n *CombineNode) As(names ...string) *CombineNode

Prefix names for all fields from the respective nodes. Each field from the parent nodes will be prefixed with the provided name and a '.'. See the example above.

The names cannot have a dot '.' character.

tick:property

func (*CombineNode) Bottom added in v1.0.0

func (n *CombineNode) Bottom(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the bottom `num` points for `field` and sort by any extra tags or fields.

func (*CombineNode) Combine added in v1.0.0

func (n *CombineNode) Combine(expressions ...*ast.LambdaNode) *CombineNode

Combine this node with itself. The data are combined on timestamp.

func (*CombineNode) Count added in v1.0.0

func (n *CombineNode) Count(field string) *InfluxQLNode

Count the number of points.

func (*CombineNode) CumulativeSum added in v1.1.0

func (n *CombineNode) CumulativeSum(field string) *InfluxQLNode

Compute a cumulative sum of each point that is received. A point is emitted for every point collected.

func (*CombineNode) Default added in v1.0.0

func (n *CombineNode) Default() *DefaultNode

Create a node that can set defaults for missing tags or fields.

func (*CombineNode) Delete added in v1.0.0

func (n *CombineNode) Delete() *DeleteNode

Create a node that can delete tags or fields.

func (*CombineNode) Derivative added in v1.0.0

func (n *CombineNode) Derivative(field string) *DerivativeNode

Create a new node that computes the derivative of adjacent points.

func (*CombineNode) Difference added in v1.0.0

func (n *CombineNode) Difference(field string) *InfluxQLNode

Compute the difference between points independent of elapsed time.

func (*CombineNode) Distinct added in v1.0.0

func (n *CombineNode) Distinct(field string) *InfluxQLNode

Produce batch of only the distinct points.

func (*CombineNode) Elapsed added in v1.0.0

func (n *CombineNode) Elapsed(field string, unit time.Duration) *InfluxQLNode

Compute the elapsed time between points

func (*CombineNode) Eval added in v1.0.0

func (n *CombineNode) Eval(expressions ...*ast.LambdaNode) *EvalNode

Create an eval node that will evaluate the given transformation function to each data point. A list of expressions may be provided and will be evaluated in the order they are given. The results are available to later expressions.

func (*CombineNode) First added in v1.0.0

func (n *CombineNode) First(field string) *InfluxQLNode

Select the first point.

func (*CombineNode) Flatten added in v1.0.0

func (n *CombineNode) Flatten() *FlattenNode

Flatten points with similar times into a single point.

func (*CombineNode) GroupBy added in v1.0.0

func (n *CombineNode) GroupBy(tag ...interface{}) *GroupByNode

Group the data by a set of tags.

Can pass literal * to group by all dimensions. Example:

|groupBy(*)

func (*CombineNode) HoltWinters added in v1.0.0

func (n *CombineNode) HoltWinters(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set.

func (*CombineNode) HoltWintersWithFit added in v1.0.0

func (n *CombineNode) HoltWintersWithFit(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set. This method also outputs all the points used to fit the data in addition to the forecasted data.

func (*CombineNode) HttpOut added in v1.0.0

func (n *CombineNode) HttpOut(endpoint string) *HTTPOutNode

Create an HTTP output node that caches the most recent data it has received. The cached data are available at the given endpoint. The endpoint is the relative path from the API endpoint of the running task. For example, if the task endpoint is at `/kapacitor/v1/tasks/<task_id>` and endpoint is `top10`, then the data can be requested from `/kapacitor/v1/tasks/<task_id>/top10`.

func (*CombineNode) HttpPost added in v1.3.0

func (n *CombineNode) HttpPost(url string) *HTTPPostNode

Creates an HTTP Post node that POSTS received data to the provided HTTP endpoint.

func (*CombineNode) InfluxDBOut added in v1.0.0

func (n *CombineNode) InfluxDBOut() *InfluxDBOutNode

Create an influxdb output node that will store the incoming data into InfluxDB.

func (*CombineNode) Join added in v1.0.0

func (n *CombineNode) Join(others ...Node) *JoinNode

Join this node with other nodes. The data are joined on timestamp.

func (*CombineNode) K8sAutoscale added in v1.1.0

func (n *CombineNode) K8sAutoscale() *K8sAutoscaleNode

Create a node that can trigger autoscale events for a kubernetes cluster.

func (*CombineNode) Last added in v1.0.0

func (n *CombineNode) Last(field string) *InfluxQLNode

Select the last point.

func (*CombineNode) Log added in v1.0.0

func (n *CombineNode) Log() *LogNode

Create a node that logs all data it receives.

func (*CombineNode) Max added in v1.0.0

func (n *CombineNode) Max(field string) *InfluxQLNode

Select the maximum point.

func (*CombineNode) Mean added in v1.0.0

func (n *CombineNode) Mean(field string) *InfluxQLNode

Compute the mean of the data.

func (*CombineNode) Median added in v1.0.0

func (n *CombineNode) Median(field string) *InfluxQLNode

Compute the median of the data. Note, this method is not a selector, if you want the median point use `.percentile(field, 50.0)`.

func (*CombineNode) Min added in v1.0.0

func (n *CombineNode) Min(field string) *InfluxQLNode

Select the minimum point.

func (*CombineNode) Mode added in v1.0.0

func (n *CombineNode) Mode(field string) *InfluxQLNode

Compute the mode of the data.

func (*CombineNode) MovingAverage added in v1.0.0

func (n *CombineNode) MovingAverage(field string, window int64) *InfluxQLNode

Compute a moving average of the last window points. No points are emitted until the window is full.

func (*CombineNode) Percentile added in v1.0.0

func (n *CombineNode) Percentile(field string, percentile float64) *InfluxQLNode

Select a point at the given percentile. This is a selector function, no interpolation between points is performed.

func (*CombineNode) Sample added in v1.0.0

func (n *CombineNode) Sample(rate interface{}) *SampleNode

Create a new node that samples the incoming points or batches.

One point will be emitted every count or duration specified.

func (*CombineNode) Shift added in v1.0.0

func (n *CombineNode) Shift(shift time.Duration) *ShiftNode

Create a new node that shifts the incoming points or batches in time.

func (*CombineNode) Spread added in v1.0.0

func (n *CombineNode) Spread(field string) *InfluxQLNode

Compute the difference between `min` and `max` points.

func (*CombineNode) StateCount added in v1.3.0

func (n *CombineNode) StateCount(expression *ast.LambdaNode) *StateCountNode

Create a node that tracks number of consecutive points in a given state.

func (*CombineNode) StateDuration added in v1.3.0

func (n *CombineNode) StateDuration(expression *ast.LambdaNode) *StateDurationNode

Create a node that tracks duration in a given state.

func (*CombineNode) Stddev added in v1.0.0

func (n *CombineNode) Stddev(field string) *InfluxQLNode

Compute the standard deviation.

func (*CombineNode) Sum added in v1.0.0

func (n *CombineNode) Sum(field string) *InfluxQLNode

Compute the sum of all values.

func (*CombineNode) Top added in v1.0.0

func (n *CombineNode) Top(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the top `num` points for `field` and sort by any extra tags or fields.

func (*CombineNode) Union added in v1.0.0

func (n *CombineNode) Union(node ...Node) *UnionNode

Perform the union of this node and all other given nodes.

func (*CombineNode) Where added in v1.0.0

func (n *CombineNode) Where(expression *ast.LambdaNode) *WhereNode

Create a new node that filters the data stream by a given expression.

func (*CombineNode) Window added in v1.0.0

func (n *CombineNode) Window() *WindowNode

Create a new node that windows the stream by time.

NOTE: Window can only be applied to stream edges.

type DeadmanService added in v0.10.0

type DeadmanService interface {
	Interval() time.Duration
	Threshold() float64
	Id() string
	Message() string
	Global() bool
}

Information relavant to configuring a deadman's swith

type DefaultNode added in v0.13.0

type DefaultNode struct {

	// Set of fields to default
	// tick:ignore
	Fields map[string]interface{} `tick:"Field"`

	// Set of tags to default
	// tick:ignore
	Tags map[string]string `tick:"Tag"`
	// contains filtered or unexported fields
}

Defaults fields and tags on data points.

Example:

stream
    |default()
        .field('value', 0.0)
        .tag('host', '')

The above example will set the field `value` to float64(0) if it does not already exist It will also set the tag `host` to string("") if it does not already exist.

Available Statistics:

  • fields_defaulted -- number of fields that were missing
  • tags_defaulted -- number of tags that were missing

func (*DefaultNode) Alert added in v0.13.0

func (n *DefaultNode) Alert() *AlertNode

Create an alert node, which can trigger alerts.

func (*DefaultNode) Bottom added in v0.13.0

func (n *DefaultNode) Bottom(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the bottom `num` points for `field` and sort by any extra tags or fields.

func (*DefaultNode) Combine added in v1.0.0

func (n *DefaultNode) Combine(expressions ...*ast.LambdaNode) *CombineNode

Combine this node with itself. The data are combined on timestamp.

func (*DefaultNode) Count added in v0.13.0

func (n *DefaultNode) Count(field string) *InfluxQLNode

Count the number of points.

func (*DefaultNode) CumulativeSum added in v1.1.0

func (n *DefaultNode) CumulativeSum(field string) *InfluxQLNode

Compute a cumulative sum of each point that is received. A point is emitted for every point collected.

func (*DefaultNode) Default added in v0.13.0

func (n *DefaultNode) Default() *DefaultNode

Create a node that can set defaults for missing tags or fields.

func (*DefaultNode) Delete added in v1.0.0

func (n *DefaultNode) Delete() *DeleteNode

Create a node that can delete tags or fields.

func (*DefaultNode) Derivative added in v0.13.0

func (n *DefaultNode) Derivative(field string) *DerivativeNode

Create a new node that computes the derivative of adjacent points.

func (*DefaultNode) Difference added in v1.0.0

func (n *DefaultNode) Difference(field string) *InfluxQLNode

Compute the difference between points independent of elapsed time.

func (*DefaultNode) Distinct added in v0.13.0

func (n *DefaultNode) Distinct(field string) *InfluxQLNode

Produce batch of only the distinct points.

func (*DefaultNode) Elapsed added in v0.13.0

func (n *DefaultNode) Elapsed(field string, unit time.Duration) *InfluxQLNode

Compute the elapsed time between points

func (*DefaultNode) Eval added in v0.13.0

func (n *DefaultNode) Eval(expressions ...*ast.LambdaNode) *EvalNode

Create an eval node that will evaluate the given transformation function to each data point. A list of expressions may be provided and will be evaluated in the order they are given. The results are available to later expressions.

func (*DefaultNode) Field added in v0.13.0

func (n *DefaultNode) Field(name string, value interface{}) *DefaultNode

Define a field default. tick:property

func (*DefaultNode) First added in v0.13.0

func (n *DefaultNode) First(field string) *InfluxQLNode

Select the first point.

func (*DefaultNode) Flatten added in v1.0.0

func (n *DefaultNode) Flatten() *FlattenNode

Flatten points with similar times into a single point.

func (*DefaultNode) GroupBy added in v0.13.0

func (n *DefaultNode) GroupBy(tag ...interface{}) *GroupByNode

Group the data by a set of tags.

Can pass literal * to group by all dimensions. Example:

|groupBy(*)

func (*DefaultNode) HoltWinters added in v1.0.0

func (n *DefaultNode) HoltWinters(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set.

func (*DefaultNode) HoltWintersWithFit added in v1.0.0

func (n *DefaultNode) HoltWintersWithFit(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set. This method also outputs all the points used to fit the data in addition to the forecasted data.

func (*DefaultNode) HttpOut added in v0.13.0

func (n *DefaultNode) HttpOut(endpoint string) *HTTPOutNode

Create an HTTP output node that caches the most recent data it has received. The cached data are available at the given endpoint. The endpoint is the relative path from the API endpoint of the running task. For example, if the task endpoint is at `/kapacitor/v1/tasks/<task_id>` and endpoint is `top10`, then the data can be requested from `/kapacitor/v1/tasks/<task_id>/top10`.

func (*DefaultNode) HttpPost added in v1.3.0

func (n *DefaultNode) HttpPost(url string) *HTTPPostNode

Creates an HTTP Post node that POSTS received data to the provided HTTP endpoint.

func (*DefaultNode) InfluxDBOut added in v0.13.0

func (n *DefaultNode) InfluxDBOut() *InfluxDBOutNode

Create an influxdb output node that will store the incoming data into InfluxDB.

func (*DefaultNode) Join added in v0.13.0

func (n *DefaultNode) Join(others ...Node) *JoinNode

Join this node with other nodes. The data are joined on timestamp.

func (*DefaultNode) K8sAutoscale added in v1.1.0

func (n *DefaultNode) K8sAutoscale() *K8sAutoscaleNode

Create a node that can trigger autoscale events for a kubernetes cluster.

func (*DefaultNode) Last added in v0.13.0

func (n *DefaultNode) Last(field string) *InfluxQLNode

Select the last point.

func (*DefaultNode) Log added in v0.13.0

func (n *DefaultNode) Log() *LogNode

Create a node that logs all data it receives.

func (*DefaultNode) Max added in v0.13.0

func (n *DefaultNode) Max(field string) *InfluxQLNode

Select the maximum point.

func (*DefaultNode) Mean added in v0.13.0

func (n *DefaultNode) Mean(field string) *InfluxQLNode

Compute the mean of the data.

func (*DefaultNode) Median added in v0.13.0

func (n *DefaultNode) Median(field string) *InfluxQLNode

Compute the median of the data. Note, this method is not a selector, if you want the median point use `.percentile(field, 50.0)`.

func (*DefaultNode) Min added in v0.13.0

func (n *DefaultNode) Min(field string) *InfluxQLNode

Select the minimum point.

func (*DefaultNode) Mode added in v1.0.0

func (n *DefaultNode) Mode(field string) *InfluxQLNode

Compute the mode of the data.

func (*DefaultNode) MovingAverage added in v1.0.0

func (n *DefaultNode) MovingAverage(field string, window int64) *InfluxQLNode

Compute a moving average of the last window points. No points are emitted until the window is full.

func (*DefaultNode) Percentile added in v0.13.0

func (n *DefaultNode) Percentile(field string, percentile float64) *InfluxQLNode

Select a point at the given percentile. This is a selector function, no interpolation between points is performed.

func (*DefaultNode) Sample added in v0.13.0

func (n *DefaultNode) Sample(rate interface{}) *SampleNode

Create a new node that samples the incoming points or batches.

One point will be emitted every count or duration specified.

func (*DefaultNode) Shift added in v0.13.0

func (n *DefaultNode) Shift(shift time.Duration) *ShiftNode

Create a new node that shifts the incoming points or batches in time.

func (*DefaultNode) Spread added in v0.13.0

func (n *DefaultNode) Spread(field string) *InfluxQLNode

Compute the difference between `min` and `max` points.

func (*DefaultNode) StateCount added in v1.3.0

func (n *DefaultNode) StateCount(expression *ast.LambdaNode) *StateCountNode

Create a node that tracks number of consecutive points in a given state.

func (*DefaultNode) StateDuration added in v1.3.0

func (n *DefaultNode) StateDuration(expression *ast.LambdaNode) *StateDurationNode

Create a node that tracks duration in a given state.

func (*DefaultNode) Stddev added in v0.13.0

func (n *DefaultNode) Stddev(field string) *InfluxQLNode

Compute the standard deviation.

func (*DefaultNode) Sum added in v0.13.0

func (n *DefaultNode) Sum(field string) *InfluxQLNode

Compute the sum of all values.

func (*DefaultNode) Tag added in v0.13.0

func (n *DefaultNode) Tag(name string, value string) *DefaultNode

Define a tag default. tick:property

func (*DefaultNode) Top added in v0.13.0

func (n *DefaultNode) Top(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the top `num` points for `field` and sort by any extra tags or fields.

func (*DefaultNode) Union added in v0.13.0

func (n *DefaultNode) Union(node ...Node) *UnionNode

Perform the union of this node and all other given nodes.

func (*DefaultNode) Where added in v0.13.0

func (n *DefaultNode) Where(expression *ast.LambdaNode) *WhereNode

Create a new node that filters the data stream by a given expression.

func (*DefaultNode) Window added in v0.13.0

func (n *DefaultNode) Window() *WindowNode

Create a new node that windows the stream by time.

NOTE: Window can only be applied to stream edges.

type DeleteNode added in v1.0.0

type DeleteNode struct {

	// Set of fields to delete
	// tick:ignore
	Fields []string `tick:"Field"`

	// Set of tags to delete
	// tick:ignore
	Tags []string `tick:"Tag"`
	// contains filtered or unexported fields
}

Deletes fields and tags from data points.

Example:

stream
    |delete()
        .field('value')
        .tag('host')

The above example will remove the field `value` and the tag `host`, from each point.

Available Statistics:

  • fields_deleted -- number of fields that were deleted. Only counts if the field already existed.
  • tags_deleted -- number of tags that were deleted. Only counts if the tag already existed.

func (*DeleteNode) Alert added in v1.0.0

func (n *DeleteNode) Alert() *AlertNode

Create an alert node, which can trigger alerts.

func (*DeleteNode) Bottom added in v1.0.0

func (n *DeleteNode) Bottom(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the bottom `num` points for `field` and sort by any extra tags or fields.

func (*DeleteNode) Combine added in v1.0.0

func (n *DeleteNode) Combine(expressions ...*ast.LambdaNode) *CombineNode

Combine this node with itself. The data are combined on timestamp.

func (*DeleteNode) Count added in v1.0.0

func (n *DeleteNode) Count(field string) *InfluxQLNode

Count the number of points.

func (*DeleteNode) CumulativeSum added in v1.1.0

func (n *DeleteNode) CumulativeSum(field string) *InfluxQLNode

Compute a cumulative sum of each point that is received. A point is emitted for every point collected.

func (*DeleteNode) Default added in v1.0.0

func (n *DeleteNode) Default() *DefaultNode

Create a node that can set defaults for missing tags or fields.

func (*DeleteNode) Delete added in v1.0.0

func (n *DeleteNode) Delete() *DeleteNode

Create a node that can delete tags or fields.

func (*DeleteNode) Derivative added in v1.0.0

func (n *DeleteNode) Derivative(field string) *DerivativeNode

Create a new node that computes the derivative of adjacent points.

func (*DeleteNode) Difference added in v1.0.0

func (n *DeleteNode) Difference(field string) *InfluxQLNode

Compute the difference between points independent of elapsed time.

func (*DeleteNode) Distinct added in v1.0.0

func (n *DeleteNode) Distinct(field string) *InfluxQLNode

Produce batch of only the distinct points.

func (*DeleteNode) Elapsed added in v1.0.0

func (n *DeleteNode) Elapsed(field string, unit time.Duration) *InfluxQLNode

Compute the elapsed time between points

func (*DeleteNode) Eval added in v1.0.0

func (n *DeleteNode) Eval(expressions ...*ast.LambdaNode) *EvalNode

Create an eval node that will evaluate the given transformation function to each data point. A list of expressions may be provided and will be evaluated in the order they are given. The results are available to later expressions.

func (*DeleteNode) Field added in v1.0.0

func (n *DeleteNode) Field(name string) *DeleteNode

Delete a field. tick:property

func (*DeleteNode) First added in v1.0.0

func (n *DeleteNode) First(field string) *InfluxQLNode

Select the first point.

func (*DeleteNode) Flatten added in v1.0.0

func (n *DeleteNode) Flatten() *FlattenNode

Flatten points with similar times into a single point.

func (*DeleteNode) GroupBy added in v1.0.0

func (n *DeleteNode) GroupBy(tag ...interface{}) *GroupByNode

Group the data by a set of tags.

Can pass literal * to group by all dimensions. Example:

|groupBy(*)

func (*DeleteNode) HoltWinters added in v1.0.0

func (n *DeleteNode) HoltWinters(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set.

func (*DeleteNode) HoltWintersWithFit added in v1.0.0

func (n *DeleteNode) HoltWintersWithFit(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set. This method also outputs all the points used to fit the data in addition to the forecasted data.

func (*DeleteNode) HttpOut added in v1.0.0

func (n *DeleteNode) HttpOut(endpoint string) *HTTPOutNode

Create an HTTP output node that caches the most recent data it has received. The cached data are available at the given endpoint. The endpoint is the relative path from the API endpoint of the running task. For example, if the task endpoint is at `/kapacitor/v1/tasks/<task_id>` and endpoint is `top10`, then the data can be requested from `/kapacitor/v1/tasks/<task_id>/top10`.

func (*DeleteNode) HttpPost added in v1.3.0

func (n *DeleteNode) HttpPost(url string) *HTTPPostNode

Creates an HTTP Post node that POSTS received data to the provided HTTP endpoint.

func (*DeleteNode) InfluxDBOut added in v1.0.0

func (n *DeleteNode) InfluxDBOut() *InfluxDBOutNode

Create an influxdb output node that will store the incoming data into InfluxDB.

func (*DeleteNode) Join added in v1.0.0

func (n *DeleteNode) Join(others ...Node) *JoinNode

Join this node with other nodes. The data are joined on timestamp.

func (*DeleteNode) K8sAutoscale added in v1.1.0

func (n *DeleteNode) K8sAutoscale() *K8sAutoscaleNode

Create a node that can trigger autoscale events for a kubernetes cluster.

func (*DeleteNode) Last added in v1.0.0

func (n *DeleteNode) Last(field string) *InfluxQLNode

Select the last point.

func (*DeleteNode) Log added in v1.0.0

func (n *DeleteNode) Log() *LogNode

Create a node that logs all data it receives.

func (*DeleteNode) Max added in v1.0.0

func (n *DeleteNode) Max(field string) *InfluxQLNode

Select the maximum point.

func (*DeleteNode) Mean added in v1.0.0

func (n *DeleteNode) Mean(field string) *InfluxQLNode

Compute the mean of the data.

func (*DeleteNode) Median added in v1.0.0

func (n *DeleteNode) Median(field string) *InfluxQLNode

Compute the median of the data. Note, this method is not a selector, if you want the median point use `.percentile(field, 50.0)`.

func (*DeleteNode) Min added in v1.0.0

func (n *DeleteNode) Min(field string) *InfluxQLNode

Select the minimum point.

func (*DeleteNode) Mode added in v1.0.0

func (n *DeleteNode) Mode(field string) *InfluxQLNode

Compute the mode of the data.

func (*DeleteNode) MovingAverage added in v1.0.0

func (n *DeleteNode) MovingAverage(field string, window int64) *InfluxQLNode

Compute a moving average of the last window points. No points are emitted until the window is full.

func (*DeleteNode) Percentile added in v1.0.0

func (n *DeleteNode) Percentile(field string, percentile float64) *InfluxQLNode

Select a point at the given percentile. This is a selector function, no interpolation between points is performed.

func (*DeleteNode) Sample added in v1.0.0

func (n *DeleteNode) Sample(rate interface{}) *SampleNode

Create a new node that samples the incoming points or batches.

One point will be emitted every count or duration specified.

func (*DeleteNode) Shift added in v1.0.0

func (n *DeleteNode) Shift(shift time.Duration) *ShiftNode

Create a new node that shifts the incoming points or batches in time.

func (*DeleteNode) Spread added in v1.0.0

func (n *DeleteNode) Spread(field string) *InfluxQLNode

Compute the difference between `min` and `max` points.

func (*DeleteNode) StateCount added in v1.3.0

func (n *DeleteNode) StateCount(expression *ast.LambdaNode) *StateCountNode

Create a node that tracks number of consecutive points in a given state.

func (*DeleteNode) StateDuration added in v1.3.0

func (n *DeleteNode) StateDuration(expression *ast.LambdaNode) *StateDurationNode

Create a node that tracks duration in a given state.

func (*DeleteNode) Stddev added in v1.0.0

func (n *DeleteNode) Stddev(field string) *InfluxQLNode

Compute the standard deviation.

func (*DeleteNode) Sum added in v1.0.0

func (n *DeleteNode) Sum(field string) *InfluxQLNode

Compute the sum of all values.

func (*DeleteNode) Tag added in v1.0.0

func (n *DeleteNode) Tag(name string) *DeleteNode

Delete a tag. tick:property

func (*DeleteNode) Top added in v1.0.0

func (n *DeleteNode) Top(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the top `num` points for `field` and sort by any extra tags or fields.

func (*DeleteNode) Union added in v1.0.0

func (n *DeleteNode) Union(node ...Node) *UnionNode

Perform the union of this node and all other given nodes.

func (*DeleteNode) Where added in v1.0.0

func (n *DeleteNode) Where(expression *ast.LambdaNode) *WhereNode

Create a new node that filters the data stream by a given expression.

func (*DeleteNode) Window added in v1.0.0

func (n *DeleteNode) Window() *WindowNode

Create a new node that windows the stream by time.

NOTE: Window can only be applied to stream edges.

type DerivativeNode

type DerivativeNode struct {

	// The field to use when calculating the derivative
	// tick:ignore
	Field string

	// The new name of the derivative field.
	// Default is the name of the field used
	// when calculating the derivative.
	As string

	// The time unit of the resulting derivative value.
	// Default: 1s
	Unit time.Duration

	// Where negative values are acceptable.
	// tick:ignore
	NonNegativeFlag bool `tick:"NonNegative"`
	// contains filtered or unexported fields
}

Compute the derivative of a stream or batch. The derivative is computed on a single field and behaves similarly to the InfluxQL derivative function. Kapacitor has its own implementation of the derivative function, and, as a result, is not part of the normal InfluxQL functions.

Example:

stream
    |from()
        .measurement('net_rx_packets')
    |derivative('value')
       .unit(1s) // default
       .nonNegative()
    ...

Computes the derivative via:

(current - previous ) / ( time_difference / unit)

For batch edges the derivative is computed for each point in the batch and because of boundary conditions the number of points is reduced by one.

func (*DerivativeNode) Alert

func (n *DerivativeNode) Alert() *AlertNode

Create an alert node, which can trigger alerts.

func (*DerivativeNode) Bottom added in v0.11.0

func (n *DerivativeNode) Bottom(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the bottom `num` points for `field` and sort by any extra tags or fields.

func (*DerivativeNode) Combine added in v1.0.0

func (n *DerivativeNode) Combine(expressions ...*ast.LambdaNode) *CombineNode

Combine this node with itself. The data are combined on timestamp.

func (*DerivativeNode) Count added in v0.11.0

func (n *DerivativeNode) Count(field string) *InfluxQLNode

Count the number of points.

func (*DerivativeNode) CumulativeSum added in v1.1.0

func (n *DerivativeNode) CumulativeSum(field string) *InfluxQLNode

Compute a cumulative sum of each point that is received. A point is emitted for every point collected.

func (*DerivativeNode) Default added in v0.13.0

func (n *DerivativeNode) Default() *DefaultNode

Create a node that can set defaults for missing tags or fields.

func (*DerivativeNode) Delete added in v1.0.0

func (n *DerivativeNode) Delete() *DeleteNode

Create a node that can delete tags or fields.

func (*DerivativeNode) Derivative

func (n *DerivativeNode) Derivative(field string) *DerivativeNode

Create a new node that computes the derivative of adjacent points.

func (*DerivativeNode) Difference added in v1.0.0

func (n *DerivativeNode) Difference(field string) *InfluxQLNode

Compute the difference between points independent of elapsed time.

func (*DerivativeNode) Distinct added in v0.11.0

func (n *DerivativeNode) Distinct(field string) *InfluxQLNode

Produce batch of only the distinct points.

func (*DerivativeNode) Elapsed added in v0.13.0

func (n *DerivativeNode) Elapsed(field string, unit time.Duration) *InfluxQLNode

Compute the elapsed time between points

func (*DerivativeNode) Eval

func (n *DerivativeNode) Eval(expressions ...*ast.LambdaNode) *EvalNode

Create an eval node that will evaluate the given transformation function to each data point. A list of expressions may be provided and will be evaluated in the order they are given. The results are available to later expressions.

func (*DerivativeNode) First added in v0.11.0

func (n *DerivativeNode) First(field string) *InfluxQLNode

Select the first point.

func (*DerivativeNode) Flatten added in v1.0.0

func (n *DerivativeNode) Flatten() *FlattenNode

Flatten points with similar times into a single point.

func (*DerivativeNode) GroupBy

func (n *DerivativeNode) GroupBy(tag ...interface{}) *GroupByNode

Group the data by a set of tags.

Can pass literal * to group by all dimensions. Example:

|groupBy(*)

func (*DerivativeNode) HoltWinters added in v1.0.0

func (n *DerivativeNode) HoltWinters(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set.

func (*DerivativeNode) HoltWintersWithFit added in v1.0.0

func (n *DerivativeNode) HoltWintersWithFit(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set. This method also outputs all the points used to fit the data in addition to the forecasted data.

func (*DerivativeNode) HttpOut

func (n *DerivativeNode) HttpOut(endpoint string) *HTTPOutNode

Create an HTTP output node that caches the most recent data it has received. The cached data are available at the given endpoint. The endpoint is the relative path from the API endpoint of the running task. For example, if the task endpoint is at `/kapacitor/v1/tasks/<task_id>` and endpoint is `top10`, then the data can be requested from `/kapacitor/v1/tasks/<task_id>/top10`.

func (*DerivativeNode) HttpPost added in v1.3.0

func (n *DerivativeNode) HttpPost(url string) *HTTPPostNode

Creates an HTTP Post node that POSTS received data to the provided HTTP endpoint.

func (*DerivativeNode) InfluxDBOut

func (n *DerivativeNode) InfluxDBOut() *InfluxDBOutNode

Create an influxdb output node that will store the incoming data into InfluxDB.

func (*DerivativeNode) Join

func (n *DerivativeNode) Join(others ...Node) *JoinNode

Join this node with other nodes. The data are joined on timestamp.

func (*DerivativeNode) K8sAutoscale added in v1.1.0

func (n *DerivativeNode) K8sAutoscale() *K8sAutoscaleNode

Create a node that can trigger autoscale events for a kubernetes cluster.

func (*DerivativeNode) Last added in v0.11.0

func (n *DerivativeNode) Last(field string) *InfluxQLNode

Select the last point.

func (*DerivativeNode) Log added in v0.11.0

func (n *DerivativeNode) Log() *LogNode

Create a node that logs all data it receives.

func (*DerivativeNode) Max added in v0.11.0

func (n *DerivativeNode) Max(field string) *InfluxQLNode

Select the maximum point.

func (*DerivativeNode) Mean added in v0.11.0

func (n *DerivativeNode) Mean(field string) *InfluxQLNode

Compute the mean of the data.

func (*DerivativeNode) Median added in v0.11.0

func (n *DerivativeNode) Median(field string) *InfluxQLNode

Compute the median of the data. Note, this method is not a selector, if you want the median point use `.percentile(field, 50.0)`.

func (*DerivativeNode) Min added in v0.11.0

func (n *DerivativeNode) Min(field string) *InfluxQLNode

Select the minimum point.

func (*DerivativeNode) Mode added in v1.0.0

func (n *DerivativeNode) Mode(field string) *InfluxQLNode

Compute the mode of the data.

func (*DerivativeNode) MovingAverage added in v1.0.0

func (n *DerivativeNode) MovingAverage(field string, window int64) *InfluxQLNode

Compute a moving average of the last window points. No points are emitted until the window is full.

func (*DerivativeNode) NonNegative

func (d *DerivativeNode) NonNegative() *DerivativeNode

If called the derivative will skip negative results. tick:property

func (*DerivativeNode) Percentile added in v0.11.0

func (n *DerivativeNode) Percentile(field string, percentile float64) *InfluxQLNode

Select a point at the given percentile. This is a selector function, no interpolation between points is performed.

func (*DerivativeNode) Sample

func (n *DerivativeNode) Sample(rate interface{}) *SampleNode

Create a new node that samples the incoming points or batches.

One point will be emitted every count or duration specified.

func (*DerivativeNode) Shift added in v0.11.0

func (n *DerivativeNode) Shift(shift time.Duration) *ShiftNode

Create a new node that shifts the incoming points or batches in time.

func (*DerivativeNode) Spread added in v0.11.0

func (n *DerivativeNode) Spread(field string) *InfluxQLNode

Compute the difference between `min` and `max` points.

func (*DerivativeNode) StateCount added in v1.3.0

func (n *DerivativeNode) StateCount(expression *ast.LambdaNode) *StateCountNode

Create a node that tracks number of consecutive points in a given state.

func (*DerivativeNode) StateDuration added in v1.3.0

func (n *DerivativeNode) StateDuration(expression *ast.LambdaNode) *StateDurationNode

Create a node that tracks duration in a given state.

func (*DerivativeNode) Stddev added in v0.11.0

func (n *DerivativeNode) Stddev(field string) *InfluxQLNode

Compute the standard deviation.

func (*DerivativeNode) Sum added in v0.11.0

func (n *DerivativeNode) Sum(field string) *InfluxQLNode

Compute the sum of all values.

func (*DerivativeNode) Top added in v0.11.0

func (n *DerivativeNode) Top(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the top `num` points for `field` and sort by any extra tags or fields.

func (*DerivativeNode) Union

func (n *DerivativeNode) Union(node ...Node) *UnionNode

Perform the union of this node and all other given nodes.

func (*DerivativeNode) Where

func (n *DerivativeNode) Where(expression *ast.LambdaNode) *WhereNode

Create a new node that filters the data stream by a given expression.

func (*DerivativeNode) Window

func (n *DerivativeNode) Window() *WindowNode

Create a new node that windows the stream by time.

NOTE: Window can only be applied to stream edges.

type EdgeType

type EdgeType int

The type of data that travels along an edge connecting two nodes in a Pipeline.

const (
	// No data are transferred.
	NoEdge EdgeType = iota
	// Data are transferred immediately and one point at a time.
	StreamEdge
	// Data are transferred in batches as soon as the data are ready.
	BatchEdge
)

func (EdgeType) String

func (e EdgeType) String() string

type EmailHandler added in v0.2.4

type EmailHandler struct {
	*AlertNode

	// List of email recipients.
	// tick:ignore
	ToList []string `tick:"To"`
}

Email AlertHandler tick:embedded:AlertNode.Email

func (EmailHandler) Alert added in v0.13.0

func (n EmailHandler) Alert() *AlertNode

Create an alert node, which can trigger alerts.

func (EmailHandler) Bottom added in v0.13.0

func (n EmailHandler) Bottom(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the bottom `num` points for `field` and sort by any extra tags or fields.

func (EmailHandler) Combine added in v1.0.0

func (n EmailHandler) Combine(expressions ...*ast.LambdaNode) *CombineNode

Combine this node with itself. The data are combined on timestamp.

func (EmailHandler) Count added in v0.13.0

func (n EmailHandler) Count(field string) *InfluxQLNode

Count the number of points.

func (EmailHandler) CumulativeSum added in v1.1.0

func (n EmailHandler) CumulativeSum(field string) *InfluxQLNode

Compute a cumulative sum of each point that is received. A point is emitted for every point collected.

func (EmailHandler) Default added in v0.13.0

func (n EmailHandler) Default() *DefaultNode

Create a node that can set defaults for missing tags or fields.

func (EmailHandler) Delete added in v1.0.0

func (n EmailHandler) Delete() *DeleteNode

Create a node that can delete tags or fields.

func (EmailHandler) Derivative added in v0.13.0

func (n EmailHandler) Derivative(field string) *DerivativeNode

Create a new node that computes the derivative of adjacent points.

func (EmailHandler) Difference added in v1.0.0

func (n EmailHandler) Difference(field string) *InfluxQLNode

Compute the difference between points independent of elapsed time.

func (EmailHandler) Distinct added in v0.13.0

func (n EmailHandler) Distinct(field string) *InfluxQLNode

Produce batch of only the distinct points.

func (EmailHandler) Elapsed added in v0.13.0

func (n EmailHandler) Elapsed(field string, unit time.Duration) *InfluxQLNode

Compute the elapsed time between points

func (EmailHandler) Eval added in v0.13.0

func (n EmailHandler) Eval(expressions ...*ast.LambdaNode) *EvalNode

Create an eval node that will evaluate the given transformation function to each data point. A list of expressions may be provided and will be evaluated in the order they are given. The results are available to later expressions.

func (EmailHandler) First added in v0.13.0

func (n EmailHandler) First(field string) *InfluxQLNode

Select the first point.

func (EmailHandler) Flatten added in v1.0.0

func (n EmailHandler) Flatten() *FlattenNode

Flatten points with similar times into a single point.

func (EmailHandler) GroupBy added in v0.13.0

func (n EmailHandler) GroupBy(tag ...interface{}) *GroupByNode

Group the data by a set of tags.

Can pass literal * to group by all dimensions. Example:

|groupBy(*)

func (EmailHandler) HoltWinters added in v1.0.0

func (n EmailHandler) HoltWinters(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set.

func (EmailHandler) HoltWintersWithFit added in v1.0.0

func (n EmailHandler) HoltWintersWithFit(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set. This method also outputs all the points used to fit the data in addition to the forecasted data.

func (EmailHandler) HttpOut added in v0.13.0

func (n EmailHandler) HttpOut(endpoint string) *HTTPOutNode

Create an HTTP output node that caches the most recent data it has received. The cached data are available at the given endpoint. The endpoint is the relative path from the API endpoint of the running task. For example, if the task endpoint is at `/kapacitor/v1/tasks/<task_id>` and endpoint is `top10`, then the data can be requested from `/kapacitor/v1/tasks/<task_id>/top10`.

func (EmailHandler) HttpPost added in v1.3.0

func (n EmailHandler) HttpPost(url string) *HTTPPostNode

Creates an HTTP Post node that POSTS received data to the provided HTTP endpoint.

func (EmailHandler) InfluxDBOut added in v0.13.0

func (n EmailHandler) InfluxDBOut() *InfluxDBOutNode

Create an influxdb output node that will store the incoming data into InfluxDB.

func (EmailHandler) Join added in v0.13.0

func (n EmailHandler) Join(others ...Node) *JoinNode

Join this node with other nodes. The data are joined on timestamp.

func (EmailHandler) K8sAutoscale added in v1.1.0

func (n EmailHandler) K8sAutoscale() *K8sAutoscaleNode

Create a node that can trigger autoscale events for a kubernetes cluster.

func (EmailHandler) Last added in v0.13.0

func (n EmailHandler) Last(field string) *InfluxQLNode

Select the last point.

func (EmailHandler) Max added in v0.13.0

func (n EmailHandler) Max(field string) *InfluxQLNode

Select the maximum point.

func (EmailHandler) Mean added in v0.13.0

func (n EmailHandler) Mean(field string) *InfluxQLNode

Compute the mean of the data.

func (EmailHandler) Median added in v0.13.0

func (n EmailHandler) Median(field string) *InfluxQLNode

Compute the median of the data. Note, this method is not a selector, if you want the median point use `.percentile(field, 50.0)`.

func (EmailHandler) Min added in v0.13.0

func (n EmailHandler) Min(field string) *InfluxQLNode

Select the minimum point.

func (EmailHandler) Mode added in v1.0.0

func (n EmailHandler) Mode(field string) *InfluxQLNode

Compute the mode of the data.

func (EmailHandler) MovingAverage added in v1.0.0

func (n EmailHandler) MovingAverage(field string, window int64) *InfluxQLNode

Compute a moving average of the last window points. No points are emitted until the window is full.

func (EmailHandler) Percentile added in v0.13.0

func (n EmailHandler) Percentile(field string, percentile float64) *InfluxQLNode

Select a point at the given percentile. This is a selector function, no interpolation between points is performed.

func (EmailHandler) Sample added in v0.13.0

func (n EmailHandler) Sample(rate interface{}) *SampleNode

Create a new node that samples the incoming points or batches.

One point will be emitted every count or duration specified.

func (EmailHandler) Shift added in v0.13.0

func (n EmailHandler) Shift(shift time.Duration) *ShiftNode

Create a new node that shifts the incoming points or batches in time.

func (EmailHandler) Spread added in v0.13.0

func (n EmailHandler) Spread(field string) *InfluxQLNode

Compute the difference between `min` and `max` points.

func (EmailHandler) StateCount added in v1.3.0

func (n EmailHandler) StateCount(expression *ast.LambdaNode) *StateCountNode

Create a node that tracks number of consecutive points in a given state.

func (EmailHandler) StateDuration added in v1.3.0

func (n EmailHandler) StateDuration(expression *ast.LambdaNode) *StateDurationNode

Create a node that tracks duration in a given state.

func (EmailHandler) Stddev added in v0.13.0

func (n EmailHandler) Stddev(field string) *InfluxQLNode

Compute the standard deviation.

func (EmailHandler) Sum added in v0.13.0

func (n EmailHandler) Sum(field string) *InfluxQLNode

Compute the sum of all values.

func (*EmailHandler) To added in v1.0.0

func (h *EmailHandler) To(to ...string) *EmailHandler

Define the To addresses for the email alert. Multiple calls append to the existing list of addresses. If empty uses the addresses from the configuration.

Example:

|alert()
   .id('{{ .Name }}')
   // Email subject
   .message('{{ .ID }}:{{ .Level }}')
   //Email body as HTML
   .details('''

<h1>{{ .ID }}</h1> <b>{{ .Message }}</b> Value: {{ index .Fields "value" }} ”')

.email('admin@example.com')
  .to('oncall@example.com')
  .to('support@example.com')

All three email addresses will receive the alert message.

Passing addresses to the `email` property directly or using the `email.to` property is the same. tick:property

func (EmailHandler) Top added in v0.13.0

func (n EmailHandler) Top(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the top `num` points for `field` and sort by any extra tags or fields.

func (EmailHandler) Union added in v0.13.0

func (n EmailHandler) Union(node ...Node) *UnionNode

Perform the union of this node and all other given nodes.

func (EmailHandler) Where added in v0.13.0

func (n EmailHandler) Where(expression *ast.LambdaNode) *WhereNode

Create a new node that filters the data stream by a given expression.

func (EmailHandler) Window added in v0.13.0

func (n EmailHandler) Window() *WindowNode

Create a new node that windows the stream by time.

NOTE: Window can only be applied to stream edges.

type EvalNode

type EvalNode struct {

	// The name of the field that results from applying the expression.
	// tick:ignore
	AsList []string `tick:"As"`

	// The names of the expressions that should be converted to tags.
	// tick:ignore
	TagsList []string `tick:"Tags"`

	// tick:ignore
	Lambdas []*ast.LambdaNode

	// tick:ignore
	KeepFlag bool `tick:"Keep"`
	// List of fields to keep
	// if empty and KeepFlag is true
	// keep all fields.
	// tick:ignore
	KeepList []string

	// tick:ignore
	QuietFlag bool `tick:"Quiet"`
	// contains filtered or unexported fields
}

Evaluates expressions on each data point it receives. A list of expressions may be provided and will be evaluated in the order they are given. The results of expressions are available to later expressions in the list. See the property EvalNode.As for details on how to reference the results.

Example:

stream
    |eval(lambda: "error_count" / "total_count")
      .as('error_percent')

The above example will add a new field `error_percent` to each data point with the result of `error_count / total_count` where `error_count` and `total_count` are existing fields on the data point.

Available Statistics:

  • eval_errors -- number of errors evaluating any expressions.

func (*EvalNode) Alert

func (n *EvalNode) Alert() *AlertNode

Create an alert node, which can trigger alerts.

func (*EvalNode) As

func (e *EvalNode) As(names ...string) *EvalNode

List of names for each expression. The expressions are evaluated in order. The result of an expression may be referenced by later expressions via the name provided.

Example:

stream
    |eval(lambda: "value" * "value", lambda: 1.0 / "value2")
        .as('value2', 'inv_value2')

The above example calculates two fields from the value and names them `value2` and `inv_value2` respectively.

tick:property

func (*EvalNode) Bottom added in v0.11.0

func (n *EvalNode) Bottom(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the bottom `num` points for `field` and sort by any extra tags or fields.

func (*EvalNode) Combine added in v1.0.0

func (n *EvalNode) Combine(expressions ...*ast.LambdaNode) *CombineNode

Combine this node with itself. The data are combined on timestamp.

func (*EvalNode) Count added in v0.11.0

func (n *EvalNode) Count(field string) *InfluxQLNode

Count the number of points.

func (*EvalNode) CumulativeSum added in v1.1.0

func (n *EvalNode) CumulativeSum(field string) *InfluxQLNode

Compute a cumulative sum of each point that is received. A point is emitted for every point collected.

func (*EvalNode) Default added in v0.13.0

func (n *EvalNode) Default() *DefaultNode

Create a node that can set defaults for missing tags or fields.

func (*EvalNode) Delete added in v1.0.0

func (n *EvalNode) Delete() *DeleteNode

Create a node that can delete tags or fields.

func (*EvalNode) Derivative

func (n *EvalNode) Derivative(field string) *DerivativeNode

Create a new node that computes the derivative of adjacent points.

func (*EvalNode) Difference added in v1.0.0

func (n *EvalNode) Difference(field string) *InfluxQLNode

Compute the difference between points independent of elapsed time.

func (*EvalNode) Distinct added in v0.11.0

func (n *EvalNode) Distinct(field string) *InfluxQLNode

Produce batch of only the distinct points.

func (*EvalNode) Elapsed added in v0.13.0

func (n *EvalNode) Elapsed(field string, unit time.Duration) *InfluxQLNode

Compute the elapsed time between points

func (*EvalNode) Eval

func (n *EvalNode) Eval(expressions ...*ast.LambdaNode) *EvalNode

Create an eval node that will evaluate the given transformation function to each data point. A list of expressions may be provided and will be evaluated in the order they are given. The results are available to later expressions.

func (*EvalNode) First added in v0.11.0

func (n *EvalNode) First(field string) *InfluxQLNode

Select the first point.

func (*EvalNode) Flatten added in v1.0.0

func (n *EvalNode) Flatten() *FlattenNode

Flatten points with similar times into a single point.

func (*EvalNode) GroupBy

func (n *EvalNode) GroupBy(tag ...interface{}) *GroupByNode

Group the data by a set of tags.

Can pass literal * to group by all dimensions. Example:

|groupBy(*)

func (*EvalNode) HoltWinters added in v1.0.0

func (n *EvalNode) HoltWinters(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set.

func (*EvalNode) HoltWintersWithFit added in v1.0.0

func (n *EvalNode) HoltWintersWithFit(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set. This method also outputs all the points used to fit the data in addition to the forecasted data.

func (*EvalNode) HttpOut

func (n *EvalNode) HttpOut(endpoint string) *HTTPOutNode

Create an HTTP output node that caches the most recent data it has received. The cached data are available at the given endpoint. The endpoint is the relative path from the API endpoint of the running task. For example, if the task endpoint is at `/kapacitor/v1/tasks/<task_id>` and endpoint is `top10`, then the data can be requested from `/kapacitor/v1/tasks/<task_id>/top10`.

func (*EvalNode) HttpPost added in v1.3.0

func (n *EvalNode) HttpPost(url string) *HTTPPostNode

Creates an HTTP Post node that POSTS received data to the provided HTTP endpoint.

func (*EvalNode) InfluxDBOut

func (n *EvalNode) InfluxDBOut() *InfluxDBOutNode

Create an influxdb output node that will store the incoming data into InfluxDB.

func (*EvalNode) Join

func (n *EvalNode) Join(others ...Node) *JoinNode

Join this node with other nodes. The data are joined on timestamp.

func (*EvalNode) K8sAutoscale added in v1.1.0

func (n *EvalNode) K8sAutoscale() *K8sAutoscaleNode

Create a node that can trigger autoscale events for a kubernetes cluster.

func (*EvalNode) Keep

func (e *EvalNode) Keep(fields ...string) *EvalNode

If called the existing fields will be preserved in addition to the new fields being set. If not called then only new fields are preserved. (Tags are always preserved regardless how `keep` is used.)

Optionally, intermediate values can be discarded by passing a list of field names to be kept. Only fields in the list will be retained, the rest will be discarded. If no list is given then all fields are retained.

Example:

stream
    |eval(lambda: "value" * "value", lambda: 1.0 / "value2")
        .as('value2', 'inv_value2')
        .keep('value', 'inv_value2')

In the above example the original field `value` is preserved. The new field `value2` is calculated and used in evaluating `inv_value2` but is discarded before the point is sent on to child nodes. The resulting point has only two fields: `value` and `inv_value2`.

tick:property

func (*EvalNode) Last added in v0.11.0

func (n *EvalNode) Last(field string) *InfluxQLNode

Select the last point.

func (*EvalNode) Log added in v0.11.0

func (n *EvalNode) Log() *LogNode

Create a node that logs all data it receives.

func (*EvalNode) Max added in v0.11.0

func (n *EvalNode) Max(field string) *InfluxQLNode

Select the maximum point.

func (*EvalNode) Mean added in v0.11.0

func (n *EvalNode) Mean(field string) *InfluxQLNode

Compute the mean of the data.

func (*EvalNode) Median added in v0.11.0

func (n *EvalNode) Median(field string) *InfluxQLNode

Compute the median of the data. Note, this method is not a selector, if you want the median point use `.percentile(field, 50.0)`.

func (*EvalNode) Min added in v0.11.0

func (n *EvalNode) Min(field string) *InfluxQLNode

Select the minimum point.

func (*EvalNode) Mode added in v1.0.0

func (n *EvalNode) Mode(field string) *InfluxQLNode

Compute the mode of the data.

func (*EvalNode) MovingAverage added in v1.0.0

func (n *EvalNode) MovingAverage(field string, window int64) *InfluxQLNode

Compute a moving average of the last window points. No points are emitted until the window is full.

func (*EvalNode) Percentile added in v0.11.0

func (n *EvalNode) Percentile(field string, percentile float64) *InfluxQLNode

Select a point at the given percentile. This is a selector function, no interpolation between points is performed.

func (*EvalNode) Quiet added in v0.12.0

func (e *EvalNode) Quiet() *EvalNode

Suppress errors during evaluation. tick:property

func (*EvalNode) Sample

func (n *EvalNode) Sample(rate interface{}) *SampleNode

Create a new node that samples the incoming points or batches.

One point will be emitted every count or duration specified.

func (*EvalNode) Shift added in v0.11.0

func (n *EvalNode) Shift(shift time.Duration) *ShiftNode

Create a new node that shifts the incoming points or batches in time.

func (*EvalNode) Spread added in v0.11.0

func (n *EvalNode) Spread(field string) *InfluxQLNode

Compute the difference between `min` and `max` points.

func (*EvalNode) StateCount added in v1.3.0

func (n *EvalNode) StateCount(expression *ast.LambdaNode) *StateCountNode

Create a node that tracks number of consecutive points in a given state.

func (*EvalNode) StateDuration added in v1.3.0

func (n *EvalNode) StateDuration(expression *ast.LambdaNode) *StateDurationNode

Create a node that tracks duration in a given state.

func (*EvalNode) Stddev added in v0.11.0

func (n *EvalNode) Stddev(field string) *InfluxQLNode

Compute the standard deviation.

func (*EvalNode) Sum added in v0.11.0

func (n *EvalNode) Sum(field string) *InfluxQLNode

Compute the sum of all values.

func (*EvalNode) Tags added in v1.0.0

func (e *EvalNode) Tags(names ...string) *EvalNode

Convert the result of an expression into a tag. The result must be a string. Use the `string()` expression function to convert types.

Example:

stream
    |eval(lambda: string(floor("value" / 10.0)))
        .as('value_bucket')
        .tags('value_bucket')

The above example calculates an expression from the field `value`, casts it as a string, and names it `value_bucket`. The `value_bucket` expression is then converted from a field on the point to a tag `value_bucket` on the point.

Example:

stream
    |eval(lambda: string(floor("value" / 10.0)))
        .as('value_bucket')
        .tags('value_bucket')
        .keep('value') // keep the original field `value` as well

The above example calculates an expression from the field `value`, casts it as a string, and names it `value_bucket`. The `value_bucket` expression is then converted from a field on the point to a tag `value_bucket` on the point. The `keep` property preserves the original field `value`. Tags are always kept since creating a tag implies you want to keep it.

tick:property

func (*EvalNode) Top added in v0.11.0

func (n *EvalNode) Top(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the top `num` points for `field` and sort by any extra tags or fields.

func (*EvalNode) Union

func (n *EvalNode) Union(node ...Node) *UnionNode

Perform the union of this node and all other given nodes.

func (*EvalNode) Where

func (n *EvalNode) Where(expression *ast.LambdaNode) *WhereNode

Create a new node that filters the data stream by a given expression.

func (*EvalNode) Window

func (n *EvalNode) Window() *WindowNode

Create a new node that windows the stream by time.

NOTE: Window can only be applied to stream edges.

type ExecHandler added in v0.2.4

type ExecHandler struct {
	*AlertNode

	// The command to execute
	// tick:ignore
	Command []string
}

tick:embedded:AlertNode.Exec

func (ExecHandler) Alert added in v0.13.0

func (n ExecHandler) Alert() *AlertNode

Create an alert node, which can trigger alerts.

func (ExecHandler) Bottom added in v0.13.0

func (n ExecHandler) Bottom(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the bottom `num` points for `field` and sort by any extra tags or fields.

func (ExecHandler) Combine added in v1.0.0

func (n ExecHandler) Combine(expressions ...*ast.LambdaNode) *CombineNode

Combine this node with itself. The data are combined on timestamp.

func (ExecHandler) Count added in v0.13.0

func (n ExecHandler) Count(field string) *InfluxQLNode

Count the number of points.

func (ExecHandler) CumulativeSum added in v1.1.0

func (n ExecHandler) CumulativeSum(field string) *InfluxQLNode

Compute a cumulative sum of each point that is received. A point is emitted for every point collected.

func (ExecHandler) Default added in v0.13.0

func (n ExecHandler) Default() *DefaultNode

Create a node that can set defaults for missing tags or fields.

func (ExecHandler) Delete added in v1.0.0

func (n ExecHandler) Delete() *DeleteNode

Create a node that can delete tags or fields.

func (ExecHandler) Derivative added in v0.13.0

func (n ExecHandler) Derivative(field string) *DerivativeNode

Create a new node that computes the derivative of adjacent points.

func (ExecHandler) Difference added in v1.0.0

func (n ExecHandler) Difference(field string) *InfluxQLNode

Compute the difference between points independent of elapsed time.

func (ExecHandler) Distinct added in v0.13.0

func (n ExecHandler) Distinct(field string) *InfluxQLNode

Produce batch of only the distinct points.

func (ExecHandler) Elapsed added in v0.13.0

func (n ExecHandler) Elapsed(field string, unit time.Duration) *InfluxQLNode

Compute the elapsed time between points

func (ExecHandler) Eval added in v0.13.0

func (n ExecHandler) Eval(expressions ...*ast.LambdaNode) *EvalNode

Create an eval node that will evaluate the given transformation function to each data point. A list of expressions may be provided and will be evaluated in the order they are given. The results are available to later expressions.

func (ExecHandler) First added in v0.13.0

func (n ExecHandler) First(field string) *InfluxQLNode

Select the first point.

func (ExecHandler) Flatten added in v1.0.0

func (n ExecHandler) Flatten() *FlattenNode

Flatten points with similar times into a single point.

func (ExecHandler) GroupBy added in v0.13.0

func (n ExecHandler) GroupBy(tag ...interface{}) *GroupByNode

Group the data by a set of tags.

Can pass literal * to group by all dimensions. Example:

|groupBy(*)

func (ExecHandler) HoltWinters added in v1.0.0

func (n ExecHandler) HoltWinters(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set.

func (ExecHandler) HoltWintersWithFit added in v1.0.0

func (n ExecHandler) HoltWintersWithFit(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set. This method also outputs all the points used to fit the data in addition to the forecasted data.

func (ExecHandler) HttpOut added in v0.13.0

func (n ExecHandler) HttpOut(endpoint string) *HTTPOutNode

Create an HTTP output node that caches the most recent data it has received. The cached data are available at the given endpoint. The endpoint is the relative path from the API endpoint of the running task. For example, if the task endpoint is at `/kapacitor/v1/tasks/<task_id>` and endpoint is `top10`, then the data can be requested from `/kapacitor/v1/tasks/<task_id>/top10`.

func (ExecHandler) HttpPost added in v1.3.0

func (n ExecHandler) HttpPost(url string) *HTTPPostNode

Creates an HTTP Post node that POSTS received data to the provided HTTP endpoint.

func (ExecHandler) InfluxDBOut added in v0.13.0

func (n ExecHandler) InfluxDBOut() *InfluxDBOutNode

Create an influxdb output node that will store the incoming data into InfluxDB.

func (ExecHandler) Join added in v0.13.0

func (n ExecHandler) Join(others ...Node) *JoinNode

Join this node with other nodes. The data are joined on timestamp.

func (ExecHandler) K8sAutoscale added in v1.1.0

func (n ExecHandler) K8sAutoscale() *K8sAutoscaleNode

Create a node that can trigger autoscale events for a kubernetes cluster.

func (ExecHandler) Last added in v0.13.0

func (n ExecHandler) Last(field string) *InfluxQLNode

Select the last point.

func (ExecHandler) Max added in v0.13.0

func (n ExecHandler) Max(field string) *InfluxQLNode

Select the maximum point.

func (ExecHandler) Mean added in v0.13.0

func (n ExecHandler) Mean(field string) *InfluxQLNode

Compute the mean of the data.

func (ExecHandler) Median added in v0.13.0

func (n ExecHandler) Median(field string) *InfluxQLNode

Compute the median of the data. Note, this method is not a selector, if you want the median point use `.percentile(field, 50.0)`.

func (ExecHandler) Min added in v0.13.0

func (n ExecHandler) Min(field string) *InfluxQLNode

Select the minimum point.

func (ExecHandler) Mode added in v1.0.0

func (n ExecHandler) Mode(field string) *InfluxQLNode

Compute the mode of the data.

func (ExecHandler) MovingAverage added in v1.0.0

func (n ExecHandler) MovingAverage(field string, window int64) *InfluxQLNode

Compute a moving average of the last window points. No points are emitted until the window is full.

func (ExecHandler) Percentile added in v0.13.0

func (n ExecHandler) Percentile(field string, percentile float64) *InfluxQLNode

Select a point at the given percentile. This is a selector function, no interpolation between points is performed.

func (ExecHandler) Sample added in v0.13.0

func (n ExecHandler) Sample(rate interface{}) *SampleNode

Create a new node that samples the incoming points or batches.

One point will be emitted every count or duration specified.

func (ExecHandler) Shift added in v0.13.0

func (n ExecHandler) Shift(shift time.Duration) *ShiftNode

Create a new node that shifts the incoming points or batches in time.

func (ExecHandler) Spread added in v0.13.0

func (n ExecHandler) Spread(field string) *InfluxQLNode

Compute the difference between `min` and `max` points.

func (ExecHandler) StateCount added in v1.3.0

func (n ExecHandler) StateCount(expression *ast.LambdaNode) *StateCountNode

Create a node that tracks number of consecutive points in a given state.

func (ExecHandler) StateDuration added in v1.3.0

func (n ExecHandler) StateDuration(expression *ast.LambdaNode) *StateDurationNode

Create a node that tracks duration in a given state.

func (ExecHandler) Stddev added in v0.13.0

func (n ExecHandler) Stddev(field string) *InfluxQLNode

Compute the standard deviation.

func (ExecHandler) Sum added in v0.13.0

func (n ExecHandler) Sum(field string) *InfluxQLNode

Compute the sum of all values.

func (ExecHandler) Top added in v0.13.0

func (n ExecHandler) Top(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the top `num` points for `field` and sort by any extra tags or fields.

func (ExecHandler) Union added in v0.13.0

func (n ExecHandler) Union(node ...Node) *UnionNode

Perform the union of this node and all other given nodes.

func (ExecHandler) Where added in v0.13.0

func (n ExecHandler) Where(expression *ast.LambdaNode) *WhereNode

Create a new node that filters the data stream by a given expression.

func (ExecHandler) Window added in v0.13.0

func (n ExecHandler) Window() *WindowNode

Create a new node that windows the stream by time.

NOTE: Window can only be applied to stream edges.

type FlattenNode added in v1.0.0

type FlattenNode struct {

	// The dimensions on which to join
	// tick:ignore
	Dimensions []string `tick:"On"`

	// The delimiter between field name parts
	Delimiter string

	// The maximum duration of time that two incoming points
	// can be apart and still be considered to be equal in time.
	// The joined data point's time will be rounded to the nearest
	// multiple of the tolerance duration.
	Tolerance time.Duration
	// contains filtered or unexported fields
}

Flatten a set of points on specific dimensions. For example given two points:

m,host=A,port=80 bytes=3512 m,host=A,port=443 bytes=6723

Flattening the points on `port` would result in a single point:

m,host=A 80.bytes=3512,443.bytes=6723

Example:

|flatten()
    .on('port')

If flattening on multiple dimensions the order is preserved:

m,host=A,port=80 bytes=3512 m,host=A,port=443 bytes=6723 m,host=B,port=443 bytes=7243

Flattening the points on `host` and `port` would result in a single point:

m A.80.bytes=3512,A.443.bytes=6723,B.443.bytes=7243

Example:

|flatten()
    .on('host', 'port')

Since flattening points creates dynamically named fields in general it is expected that the resultant data is passed to a UDF or similar for custom processing.

func (*FlattenNode) Alert added in v1.0.0

func (n *FlattenNode) Alert() *AlertNode

Create an alert node, which can trigger alerts.

func (*FlattenNode) Bottom added in v1.0.0

func (n *FlattenNode) Bottom(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the bottom `num` points for `field` and sort by any extra tags or fields.

func (*FlattenNode) Combine added in v1.0.0

func (n *FlattenNode) Combine(expressions ...*ast.LambdaNode) *CombineNode

Combine this node with itself. The data are combined on timestamp.

func (*FlattenNode) Count added in v1.0.0

func (n *FlattenNode) Count(field string) *InfluxQLNode

Count the number of points.

func (*FlattenNode) CumulativeSum added in v1.1.0

func (n *FlattenNode) CumulativeSum(field string) *InfluxQLNode

Compute a cumulative sum of each point that is received. A point is emitted for every point collected.

func (*FlattenNode) Default added in v1.0.0

func (n *FlattenNode) Default() *DefaultNode

Create a node that can set defaults for missing tags or fields.

func (*FlattenNode) Delete added in v1.0.0

func (n *FlattenNode) Delete() *DeleteNode

Create a node that can delete tags or fields.

func (*FlattenNode) Derivative added in v1.0.0

func (n *FlattenNode) Derivative(field string) *DerivativeNode

Create a new node that computes the derivative of adjacent points.

func (*FlattenNode) Difference added in v1.0.0

func (n *FlattenNode) Difference(field string) *InfluxQLNode

Compute the difference between points independent of elapsed time.

func (*FlattenNode) Distinct added in v1.0.0

func (n *FlattenNode) Distinct(field string) *InfluxQLNode

Produce batch of only the distinct points.

func (*FlattenNode) Elapsed added in v1.0.0

func (n *FlattenNode) Elapsed(field string, unit time.Duration) *InfluxQLNode

Compute the elapsed time between points

func (*FlattenNode) Eval added in v1.0.0

func (n *FlattenNode) Eval(expressions ...*ast.LambdaNode) *EvalNode

Create an eval node that will evaluate the given transformation function to each data point. A list of expressions may be provided and will be evaluated in the order they are given. The results are available to later expressions.

func (*FlattenNode) First added in v1.0.0

func (n *FlattenNode) First(field string) *InfluxQLNode

Select the first point.

func (*FlattenNode) Flatten added in v1.0.0

func (n *FlattenNode) Flatten() *FlattenNode

Flatten points with similar times into a single point.

func (*FlattenNode) GroupBy added in v1.0.0

func (n *FlattenNode) GroupBy(tag ...interface{}) *GroupByNode

Group the data by a set of tags.

Can pass literal * to group by all dimensions. Example:

|groupBy(*)

func (*FlattenNode) HoltWinters added in v1.0.0

func (n *FlattenNode) HoltWinters(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set.

func (*FlattenNode) HoltWintersWithFit added in v1.0.0

func (n *FlattenNode) HoltWintersWithFit(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set. This method also outputs all the points used to fit the data in addition to the forecasted data.

func (*FlattenNode) HttpOut added in v1.0.0

func (n *FlattenNode) HttpOut(endpoint string) *HTTPOutNode

Create an HTTP output node that caches the most recent data it has received. The cached data are available at the given endpoint. The endpoint is the relative path from the API endpoint of the running task. For example, if the task endpoint is at `/kapacitor/v1/tasks/<task_id>` and endpoint is `top10`, then the data can be requested from `/kapacitor/v1/tasks/<task_id>/top10`.

func (*FlattenNode) HttpPost added in v1.3.0

func (n *FlattenNode) HttpPost(url string) *HTTPPostNode

Creates an HTTP Post node that POSTS received data to the provided HTTP endpoint.

func (*FlattenNode) InfluxDBOut added in v1.0.0

func (n *FlattenNode) InfluxDBOut() *InfluxDBOutNode

Create an influxdb output node that will store the incoming data into InfluxDB.

func (*FlattenNode) Join added in v1.0.0

func (n *FlattenNode) Join(others ...Node) *JoinNode

Join this node with other nodes. The data are joined on timestamp.

func (*FlattenNode) K8sAutoscale added in v1.1.0

func (n *FlattenNode) K8sAutoscale() *K8sAutoscaleNode

Create a node that can trigger autoscale events for a kubernetes cluster.

func (*FlattenNode) Last added in v1.0.0

func (n *FlattenNode) Last(field string) *InfluxQLNode

Select the last point.

func (*FlattenNode) Log added in v1.0.0

func (n *FlattenNode) Log() *LogNode

Create a node that logs all data it receives.

func (*FlattenNode) Max added in v1.0.0

func (n *FlattenNode) Max(field string) *InfluxQLNode

Select the maximum point.

func (*FlattenNode) Mean added in v1.0.0

func (n *FlattenNode) Mean(field string) *InfluxQLNode

Compute the mean of the data.

func (*FlattenNode) Median added in v1.0.0

func (n *FlattenNode) Median(field string) *InfluxQLNode

Compute the median of the data. Note, this method is not a selector, if you want the median point use `.percentile(field, 50.0)`.

func (*FlattenNode) Min added in v1.0.0

func (n *FlattenNode) Min(field string) *InfluxQLNode

Select the minimum point.

func (*FlattenNode) Mode added in v1.0.0

func (n *FlattenNode) Mode(field string) *InfluxQLNode

Compute the mode of the data.

func (*FlattenNode) MovingAverage added in v1.0.0

func (n *FlattenNode) MovingAverage(field string, window int64) *InfluxQLNode

Compute a moving average of the last window points. No points are emitted until the window is full.

func (*FlattenNode) On added in v1.0.0

func (f *FlattenNode) On(dims ...string) *FlattenNode

Specify the dimensions on which to flatten the points. tick:property

func (*FlattenNode) Percentile added in v1.0.0

func (n *FlattenNode) Percentile(field string, percentile float64) *InfluxQLNode

Select a point at the given percentile. This is a selector function, no interpolation between points is performed.

func (*FlattenNode) Sample added in v1.0.0

func (n *FlattenNode) Sample(rate interface{}) *SampleNode

Create a new node that samples the incoming points or batches.

One point will be emitted every count or duration specified.

func (*FlattenNode) Shift added in v1.0.0

func (n *FlattenNode) Shift(shift time.Duration) *ShiftNode

Create a new node that shifts the incoming points or batches in time.

func (*FlattenNode) Spread added in v1.0.0

func (n *FlattenNode) Spread(field string) *InfluxQLNode

Compute the difference between `min` and `max` points.

func (*FlattenNode) StateCount added in v1.3.0

func (n *FlattenNode) StateCount(expression *ast.LambdaNode) *StateCountNode

Create a node that tracks number of consecutive points in a given state.

func (*FlattenNode) StateDuration added in v1.3.0

func (n *FlattenNode) StateDuration(expression *ast.LambdaNode) *StateDurationNode

Create a node that tracks duration in a given state.

func (*FlattenNode) Stddev added in v1.0.0

func (n *FlattenNode) Stddev(field string) *InfluxQLNode

Compute the standard deviation.

func (*FlattenNode) Sum added in v1.0.0

func (n *FlattenNode) Sum(field string) *InfluxQLNode

Compute the sum of all values.

func (*FlattenNode) Top added in v1.0.0

func (n *FlattenNode) Top(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the top `num` points for `field` and sort by any extra tags or fields.

func (*FlattenNode) Union added in v1.0.0

func (n *FlattenNode) Union(node ...Node) *UnionNode

Perform the union of this node and all other given nodes.

func (*FlattenNode) Where added in v1.0.0

func (n *FlattenNode) Where(expression *ast.LambdaNode) *WhereNode

Create a new node that filters the data stream by a given expression.

func (*FlattenNode) Window added in v1.0.0

func (n *FlattenNode) Window() *WindowNode

Create a new node that windows the stream by time.

NOTE: Window can only be applied to stream edges.

type FloatBulkPointAggregator added in v0.11.0

type FloatBulkPointAggregator interface {
	influxql.FloatPointAggregator
	influxql.FloatBulkPointAggregator
}

type FromNode added in v0.13.0

type FromNode struct {

	// An expression to filter the data stream.
	// tick:ignore
	Lambda *ast.LambdaNode `tick:"Where"`

	// The dimensions by which to group to the data.
	// tick:ignore
	Dimensions []interface{} `tick:"GroupBy"`

	// Whether to include the measurement in the group ID.
	// tick:ignore
	GroupByMeasurementFlag bool `tick:"GroupByMeasurement"`

	// The database name.
	// If empty any database will be used.
	Database string

	// The retention policy name
	// If empty any retention policy will be used.
	RetentionPolicy string

	// The measurement name
	// If empty any measurement will be used.
	Measurement string

	// Optional duration for truncating timestamps.
	// Helpful to ensure data points land on specific boundaries
	// Example:
	//    stream
	//       |from()
	//           .measurement('mydata')
	//           .truncate(1s)
	//
	// All incoming data will be truncated to 1 second resolution.
	Truncate time.Duration

	// Optional duration for rounding timestamps.
	// Helpful to ensure data points land on specific boundaries
	// Example:
	//    stream
	//       |from()
	//           .measurement('mydata')
	//           .round(1s)
	//
	// All incoming data will be rounded to the nearest 1 second boundary.
	Round time.Duration
	// contains filtered or unexported fields
}

A FromNode selects a subset of the data flowing through a StreamNode. The stream node allows you to select which portion of the stream you want to process.

Example:

stream
    |from()
       .database('mydb')
       .retentionPolicy('myrp')
       .measurement('mymeasurement')
       .where(lambda: "host" =~ /logger\d+/)
    |window()
    ...

The above example selects only data points from the database `mydb` and retention policy `myrp` and measurement `mymeasurement` where the tag `host` matches the regex `logger\d+`

func (*FromNode) Alert added in v0.13.0

func (n *FromNode) Alert() *AlertNode

Create an alert node, which can trigger alerts.

func (*FromNode) Bottom added in v0.13.0

func (n *FromNode) Bottom(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the bottom `num` points for `field` and sort by any extra tags or fields.

func (*FromNode) ChainMethods added in v0.13.0

func (n *FromNode) ChainMethods() map[string]reflect.Value

func (*FromNode) Combine added in v1.0.0

func (n *FromNode) Combine(expressions ...*ast.LambdaNode) *CombineNode

Combine this node with itself. The data are combined on timestamp.

func (*FromNode) Count added in v0.13.0

func (n *FromNode) Count(field string) *InfluxQLNode

Count the number of points.

func (*FromNode) CumulativeSum added in v1.1.0

func (n *FromNode) CumulativeSum(field string) *InfluxQLNode

Compute a cumulative sum of each point that is received. A point is emitted for every point collected.

func (*FromNode) Default added in v0.13.0

func (n *FromNode) Default() *DefaultNode

Create a node that can set defaults for missing tags or fields.

func (*FromNode) Delete added in v1.0.0

func (n *FromNode) Delete() *DeleteNode

Create a node that can delete tags or fields.

func (*FromNode) Derivative added in v0.13.0

func (n *FromNode) Derivative(field string) *DerivativeNode

Create a new node that computes the derivative of adjacent points.

func (*FromNode) Difference added in v1.0.0

func (n *FromNode) Difference(field string) *InfluxQLNode

Compute the difference between points independent of elapsed time.

func (*FromNode) Distinct added in v0.13.0

func (n *FromNode) Distinct(field string) *InfluxQLNode

Produce batch of only the distinct points.

func (*FromNode) Elapsed added in v0.13.0

func (n *FromNode) Elapsed(field string, unit time.Duration) *InfluxQLNode

Compute the elapsed time between points

func (*FromNode) Eval added in v0.13.0

func (n *FromNode) Eval(expressions ...*ast.LambdaNode) *EvalNode

Create an eval node that will evaluate the given transformation function to each data point. A list of expressions may be provided and will be evaluated in the order they are given. The results are available to later expressions.

func (*FromNode) First added in v0.13.0

func (n *FromNode) First(field string) *InfluxQLNode

Select the first point.

func (*FromNode) Flatten added in v1.0.0

func (n *FromNode) Flatten() *FlattenNode

Flatten points with similar times into a single point.

func (*FromNode) From added in v0.13.0

func (s *FromNode) From() *FromNode

Creates a new stream node that can be further filtered using the Database, RetentionPolicy, Measurement and Where properties. From can be called multiple times to create multiple independent forks of the data stream.

Example:

// Select the 'cpu' measurement from just the database 'mydb'
// and retention policy 'myrp'.
var cpu = stream
    |from()
        .database('mydb')
        .retentionPolicy('myrp')
        .measurement('cpu')
// Select the 'load' measurement from any database and retention policy.
var load = stream
    |from()
        .measurement('load')
// Join cpu and load streams and do further processing.
cpu
    |join(load)
        .as('cpu', 'load')
    ...

func (*FromNode) GroupBy added in v0.13.0

func (s *FromNode) GroupBy(tag ...interface{}) *FromNode

Group the data by a set of tags.

Can pass literal * to group by all dimensions. Example:

stream
    |from()
        .groupBy(*)

tick:property

func (*FromNode) GroupByMeasurement added in v1.0.0

func (n *FromNode) GroupByMeasurement() *FromNode

If set will include the measurement name in the group ID. Along with any other group by dimensions.

Example: stream

|from()
    .database('mydb')
    .groupByMeasurement()
    .groupBy('host')

The above example selects all measurements from the database 'mydb' and then each point is grouped by the host tag and measurement name. Thus keeping measurements in their own groups. tick:property

func (*FromNode) HoltWinters added in v1.0.0

func (n *FromNode) HoltWinters(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set.

func (*FromNode) HoltWintersWithFit added in v1.0.0

func (n *FromNode) HoltWintersWithFit(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set. This method also outputs all the points used to fit the data in addition to the forecasted data.

func (*FromNode) HttpOut added in v0.13.0

func (n *FromNode) HttpOut(endpoint string) *HTTPOutNode

Create an HTTP output node that caches the most recent data it has received. The cached data are available at the given endpoint. The endpoint is the relative path from the API endpoint of the running task. For example, if the task endpoint is at `/kapacitor/v1/tasks/<task_id>` and endpoint is `top10`, then the data can be requested from `/kapacitor/v1/tasks/<task_id>/top10`.

func (*FromNode) HttpPost added in v1.3.0

func (n *FromNode) HttpPost(url string) *HTTPPostNode

Creates an HTTP Post node that POSTS received data to the provided HTTP endpoint.

func (*FromNode) InfluxDBOut added in v0.13.0

func (n *FromNode) InfluxDBOut() *InfluxDBOutNode

Create an influxdb output node that will store the incoming data into InfluxDB.

func (*FromNode) Join added in v0.13.0

func (n *FromNode) Join(others ...Node) *JoinNode

Join this node with other nodes. The data are joined on timestamp.

func (*FromNode) K8sAutoscale added in v1.1.0

func (n *FromNode) K8sAutoscale() *K8sAutoscaleNode

Create a node that can trigger autoscale events for a kubernetes cluster.

func (*FromNode) Last added in v0.13.0

func (n *FromNode) Last(field string) *InfluxQLNode

Select the last point.

func (*FromNode) Log added in v0.13.0

func (n *FromNode) Log() *LogNode

Create a node that logs all data it receives.

func (*FromNode) Max added in v0.13.0

func (n *FromNode) Max(field string) *InfluxQLNode

Select the maximum point.

func (*FromNode) Mean added in v0.13.0

func (n *FromNode) Mean(field string) *InfluxQLNode

Compute the mean of the data.

func (*FromNode) Median added in v0.13.0

func (n *FromNode) Median(field string) *InfluxQLNode

Compute the median of the data. Note, this method is not a selector, if you want the median point use `.percentile(field, 50.0)`.

func (*FromNode) Min added in v0.13.0

func (n *FromNode) Min(field string) *InfluxQLNode

Select the minimum point.

func (*FromNode) Mode added in v1.0.0

func (n *FromNode) Mode(field string) *InfluxQLNode

Compute the mode of the data.

func (*FromNode) MovingAverage added in v1.0.0

func (n *FromNode) MovingAverage(field string, window int64) *InfluxQLNode

Compute a moving average of the last window points. No points are emitted until the window is full.

func (*FromNode) Percentile added in v0.13.0

func (n *FromNode) Percentile(field string, percentile float64) *InfluxQLNode

Select a point at the given percentile. This is a selector function, no interpolation between points is performed.

func (*FromNode) Sample added in v0.13.0

func (n *FromNode) Sample(rate interface{}) *SampleNode

Create a new node that samples the incoming points or batches.

One point will be emitted every count or duration specified.

func (*FromNode) Shift added in v0.13.0

func (n *FromNode) Shift(shift time.Duration) *ShiftNode

Create a new node that shifts the incoming points or batches in time.

func (*FromNode) Spread added in v0.13.0

func (n *FromNode) Spread(field string) *InfluxQLNode

Compute the difference between `min` and `max` points.

func (*FromNode) StateCount added in v1.3.0

func (n *FromNode) StateCount(expression *ast.LambdaNode) *StateCountNode

Create a node that tracks number of consecutive points in a given state.

func (*FromNode) StateDuration added in v1.3.0

func (n *FromNode) StateDuration(expression *ast.LambdaNode) *StateDurationNode

Create a node that tracks duration in a given state.

func (*FromNode) Stddev added in v0.13.0

func (n *FromNode) Stddev(field string) *InfluxQLNode

Compute the standard deviation.

func (*FromNode) Sum added in v0.13.0

func (n *FromNode) Sum(field string) *InfluxQLNode

Compute the sum of all values.

func (*FromNode) Top added in v0.13.0

func (n *FromNode) Top(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the top `num` points for `field` and sort by any extra tags or fields.

func (*FromNode) Union added in v0.13.0

func (n *FromNode) Union(node ...Node) *UnionNode

Perform the union of this node and all other given nodes.

func (*FromNode) Where added in v0.13.0

func (s *FromNode) Where(lambda *ast.LambdaNode) *FromNode

Filter the current stream using the given expression. This expression is a Kapacitor expression. Kapacitor expressions are a superset of InfluxQL WHERE expressions. See the [expression](https://docs.influxdata.com/kapacitor/latest/tick/expr/) docs for more information.

Multiple calls to the Where method will `AND` together each expression.

Example:

stream
   |from()
      .where(lambda: condition1)
      .where(lambda: condition2)

The above is equivalent to this Example:

stream
   |from()
      .where(lambda: condition1 AND condition2)

NOTE: Becareful to always use `|from` if you want multiple different streams.

Example:

var data = stream
    |from()
        .measurement('cpu')
var total = data
    .where(lambda: "cpu" == 'cpu-total')
var others = data
    .where(lambda: "cpu" != 'cpu-total')

The example above is equivalent to the example below, which is obviously not what was intended.

Example:

var data = stream
    |from()
        .measurement('cpu')
        .where(lambda: "cpu" == 'cpu-total' AND "cpu" != 'cpu-total')
var total = data
var others = total

The example below will create two different streams each selecting a different subset of the original stream.

Example:

var data = stream
    |from()
        .measurement('cpu')
var total = stream
    |from()
        .measurement('cpu')
        .where(lambda: "cpu" == 'cpu-total')
var others = stream
    |from()
        .measurement('cpu')
        .where(lambda: "cpu" != 'cpu-total')

If empty then all data points are considered to match. tick:property

func (*FromNode) Window added in v0.13.0

func (n *FromNode) Window() *WindowNode

Create a new node that windows the stream by time.

NOTE: Window can only be applied to stream edges.

type GroupByNode

type GroupByNode struct {

	//The dimensions by which to group to the data.
	// tick:ignore
	Dimensions []interface{}

	// Whether to include the measurement in the group ID.
	// tick:ignore
	ByMeasurementFlag bool `tick:"ByMeasurement"`
	// contains filtered or unexported fields
}

A GroupByNode will group the incoming data. Each group is then processed independently for the rest of the pipeline. Only tags that are dimensions in the grouping will be preserved; all other tags are dropped.

Example:

stream
    |groupBy('service', 'datacenter')
    ...

The above example groups the data along two dimensions `service` and `datacenter`. Groups are dynamically created as new data arrives and each group is processed independently.

func (*GroupByNode) Alert

func (n *GroupByNode) Alert() *AlertNode

Create an alert node, which can trigger alerts.

func (*GroupByNode) Bottom added in v0.11.0

func (n *GroupByNode) Bottom(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the bottom `num` points for `field` and sort by any extra tags or fields.

func (*GroupByNode) ByMeasurement added in v1.0.0

func (n *GroupByNode) ByMeasurement() *GroupByNode

If set will include the measurement name in the group ID. Along with any other group by dimensions.

Example:

...
|groupBy('host')
    .byMeasurement()

The above example groups points by their host tag and measurement name.

If you want to remove the measurement name from the group ID, then groupBy all existing dimensions but without specifying 'byMeasurement'.

Example:

|groupBy(*)

The above removes the group by measurement name if any. tick:property

func (*GroupByNode) Combine added in v1.0.0

func (n *GroupByNode) Combine(expressions ...*ast.LambdaNode) *CombineNode

Combine this node with itself. The data are combined on timestamp.

func (*GroupByNode) Count added in v0.11.0

func (n *GroupByNode) Count(field string) *InfluxQLNode

Count the number of points.

func (*GroupByNode) CumulativeSum added in v1.1.0

func (n *GroupByNode) CumulativeSum(field string) *InfluxQLNode

Compute a cumulative sum of each point that is received. A point is emitted for every point collected.

func (*GroupByNode) Default added in v0.13.0

func (n *GroupByNode) Default() *DefaultNode

Create a node that can set defaults for missing tags or fields.

func (*GroupByNode) Delete added in v1.0.0

func (n *GroupByNode) Delete() *DeleteNode

Create a node that can delete tags or fields.

func (*GroupByNode) Derivative

func (n *GroupByNode) Derivative(field string) *DerivativeNode

Create a new node that computes the derivative of adjacent points.

func (*GroupByNode) Difference added in v1.0.0

func (n *GroupByNode) Difference(field string) *InfluxQLNode

Compute the difference between points independent of elapsed time.

func (*GroupByNode) Distinct added in v0.11.0

func (n *GroupByNode) Distinct(field string) *InfluxQLNode

Produce batch of only the distinct points.

func (*GroupByNode) Elapsed added in v0.13.0

func (n *GroupByNode) Elapsed(field string, unit time.Duration) *InfluxQLNode

Compute the elapsed time between points

func (*GroupByNode) Eval

func (n *GroupByNode) Eval(expressions ...*ast.LambdaNode) *EvalNode

Create an eval node that will evaluate the given transformation function to each data point. A list of expressions may be provided and will be evaluated in the order they are given. The results are available to later expressions.

func (*GroupByNode) First added in v0.11.0

func (n *GroupByNode) First(field string) *InfluxQLNode

Select the first point.

func (*GroupByNode) Flatten added in v1.0.0

func (n *GroupByNode) Flatten() *FlattenNode

Flatten points with similar times into a single point.

func (*GroupByNode) GroupBy

func (n *GroupByNode) GroupBy(tag ...interface{}) *GroupByNode

Group the data by a set of tags.

Can pass literal * to group by all dimensions. Example:

|groupBy(*)

func (*GroupByNode) HoltWinters added in v1.0.0

func (n *GroupByNode) HoltWinters(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set.

func (*GroupByNode) HoltWintersWithFit added in v1.0.0

func (n *GroupByNode) HoltWintersWithFit(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set. This method also outputs all the points used to fit the data in addition to the forecasted data.

func (*GroupByNode) HttpOut

func (n *GroupByNode) HttpOut(endpoint string) *HTTPOutNode

Create an HTTP output node that caches the most recent data it has received. The cached data are available at the given endpoint. The endpoint is the relative path from the API endpoint of the running task. For example, if the task endpoint is at `/kapacitor/v1/tasks/<task_id>` and endpoint is `top10`, then the data can be requested from `/kapacitor/v1/tasks/<task_id>/top10`.

func (*GroupByNode) HttpPost added in v1.3.0

func (n *GroupByNode) HttpPost(url string) *HTTPPostNode

Creates an HTTP Post node that POSTS received data to the provided HTTP endpoint.

func (*GroupByNode) InfluxDBOut

func (n *GroupByNode) InfluxDBOut() *InfluxDBOutNode

Create an influxdb output node that will store the incoming data into InfluxDB.

func (*GroupByNode) Join

func (n *GroupByNode) Join(others ...Node) *JoinNode

Join this node with other nodes. The data are joined on timestamp.

func (*GroupByNode) K8sAutoscale added in v1.1.0

func (n *GroupByNode) K8sAutoscale() *K8sAutoscaleNode

Create a node that can trigger autoscale events for a kubernetes cluster.

func (*GroupByNode) Last added in v0.11.0

func (n *GroupByNode) Last(field string) *InfluxQLNode

Select the last point.

func (*GroupByNode) Log added in v0.11.0

func (n *GroupByNode) Log() *LogNode

Create a node that logs all data it receives.

func (*GroupByNode) Max added in v0.11.0

func (n *GroupByNode) Max(field string) *InfluxQLNode

Select the maximum point.

func (*GroupByNode) Mean added in v0.11.0

func (n *GroupByNode) Mean(field string) *InfluxQLNode

Compute the mean of the data.

func (*GroupByNode) Median added in v0.11.0

func (n *GroupByNode) Median(field string) *InfluxQLNode

Compute the median of the data. Note, this method is not a selector, if you want the median point use `.percentile(field, 50.0)`.

func (*GroupByNode) Min added in v0.11.0

func (n *GroupByNode) Min(field string) *InfluxQLNode

Select the minimum point.

func (*GroupByNode) Mode added in v1.0.0

func (n *GroupByNode) Mode(field string) *InfluxQLNode

Compute the mode of the data.

func (*GroupByNode) MovingAverage added in v1.0.0

func (n *GroupByNode) MovingAverage(field string, window int64) *InfluxQLNode

Compute a moving average of the last window points. No points are emitted until the window is full.

func (*GroupByNode) Percentile added in v0.11.0

func (n *GroupByNode) Percentile(field string, percentile float64) *InfluxQLNode

Select a point at the given percentile. This is a selector function, no interpolation between points is performed.

func (*GroupByNode) Sample

func (n *GroupByNode) Sample(rate interface{}) *SampleNode

Create a new node that samples the incoming points or batches.

One point will be emitted every count or duration specified.

func (*GroupByNode) Shift added in v0.11.0

func (n *GroupByNode) Shift(shift time.Duration) *ShiftNode

Create a new node that shifts the incoming points or batches in time.

func (*GroupByNode) Spread added in v0.11.0

func (n *GroupByNode) Spread(field string) *InfluxQLNode

Compute the difference between `min` and `max` points.

func (*GroupByNode) StateCount added in v1.3.0

func (n *GroupByNode) StateCount(expression *ast.LambdaNode) *StateCountNode

Create a node that tracks number of consecutive points in a given state.

func (*GroupByNode) StateDuration added in v1.3.0

func (n *GroupByNode) StateDuration(expression *ast.LambdaNode) *StateDurationNode

Create a node that tracks duration in a given state.

func (*GroupByNode) Stddev added in v0.11.0

func (n *GroupByNode) Stddev(field string) *InfluxQLNode

Compute the standard deviation.

func (*GroupByNode) Sum added in v0.11.0

func (n *GroupByNode) Sum(field string) *InfluxQLNode

Compute the sum of all values.

func (*GroupByNode) Top added in v0.11.0

func (n *GroupByNode) Top(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the top `num` points for `field` and sort by any extra tags or fields.

func (*GroupByNode) Union

func (n *GroupByNode) Union(node ...Node) *UnionNode

Perform the union of this node and all other given nodes.

func (*GroupByNode) Where

func (n *GroupByNode) Where(expression *ast.LambdaNode) *WhereNode

Create a new node that filters the data stream by a given expression.

func (*GroupByNode) Window

func (n *GroupByNode) Window() *WindowNode

Create a new node that windows the stream by time.

NOTE: Window can only be applied to stream edges.

type HTTPOutNode

type HTTPOutNode struct {

	// The relative path where the cached data is exposed
	// tick:ignore
	Endpoint string
	// contains filtered or unexported fields
}

An HTTPOutNode caches the most recent data for each group it has received.

The cached data is available at the given endpoint. The endpoint is the relative path from the API endpoint of the running task. For example if the task endpoint is at `/kapacitor/v1/tasks/<task_id>` and endpoint is `top10`, then the data can be requested from `/kapacitor/v1/tasks/<task_id>/top10`.

Example:

stream
    |window()
        .period(10s)
        .every(5s)
    |top('value', 10)
    //Publish the top 10 results over the last 10s updated every 5s.
    |httpOut('top10')

func (*HTTPOutNode) Alert added in v0.11.0

func (n *HTTPOutNode) Alert() *AlertNode

Create an alert node, which can trigger alerts.

func (*HTTPOutNode) Bottom added in v0.11.0

func (n *HTTPOutNode) Bottom(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the bottom `num` points for `field` and sort by any extra tags or fields.

func (*HTTPOutNode) Combine added in v1.0.0

func (n *HTTPOutNode) Combine(expressions ...*ast.LambdaNode) *CombineNode

Combine this node with itself. The data are combined on timestamp.

func (*HTTPOutNode) Count added in v0.11.0

func (n *HTTPOutNode) Count(field string) *InfluxQLNode

Count the number of points.

func (*HTTPOutNode) CumulativeSum added in v1.1.0

func (n *HTTPOutNode) CumulativeSum(field string) *InfluxQLNode

Compute a cumulative sum of each point that is received. A point is emitted for every point collected.

func (*HTTPOutNode) Default added in v0.13.0

func (n *HTTPOutNode) Default() *DefaultNode

Create a node that can set defaults for missing tags or fields.

func (*HTTPOutNode) Delete added in v1.0.0

func (n *HTTPOutNode) Delete() *DeleteNode

Create a node that can delete tags or fields.

func (*HTTPOutNode) Derivative added in v0.11.0

func (n *HTTPOutNode) Derivative(field string) *DerivativeNode

Create a new node that computes the derivative of adjacent points.

func (*HTTPOutNode) Difference added in v1.0.0

func (n *HTTPOutNode) Difference(field string) *InfluxQLNode

Compute the difference between points independent of elapsed time.

func (*HTTPOutNode) Distinct added in v0.11.0

func (n *HTTPOutNode) Distinct(field string) *InfluxQLNode

Produce batch of only the distinct points.

func (*HTTPOutNode) Elapsed added in v0.13.0

func (n *HTTPOutNode) Elapsed(field string, unit time.Duration) *InfluxQLNode

Compute the elapsed time between points

func (*HTTPOutNode) Eval added in v0.11.0

func (n *HTTPOutNode) Eval(expressions ...*ast.LambdaNode) *EvalNode

Create an eval node that will evaluate the given transformation function to each data point. A list of expressions may be provided and will be evaluated in the order they are given. The results are available to later expressions.

func (*HTTPOutNode) First added in v0.11.0

func (n *HTTPOutNode) First(field string) *InfluxQLNode

Select the first point.

func (*HTTPOutNode) Flatten added in v1.0.0

func (n *HTTPOutNode) Flatten() *FlattenNode

Flatten points with similar times into a single point.

func (*HTTPOutNode) GroupBy added in v0.11.0

func (n *HTTPOutNode) GroupBy(tag ...interface{}) *GroupByNode

Group the data by a set of tags.

Can pass literal * to group by all dimensions. Example:

|groupBy(*)

func (*HTTPOutNode) HoltWinters added in v1.0.0

func (n *HTTPOutNode) HoltWinters(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set.

func (*HTTPOutNode) HoltWintersWithFit added in v1.0.0

func (n *HTTPOutNode) HoltWintersWithFit(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set. This method also outputs all the points used to fit the data in addition to the forecasted data.

func (*HTTPOutNode) HttpOut added in v0.11.0

func (n *HTTPOutNode) HttpOut(endpoint string) *HTTPOutNode

Create an HTTP output node that caches the most recent data it has received. The cached data are available at the given endpoint. The endpoint is the relative path from the API endpoint of the running task. For example, if the task endpoint is at `/kapacitor/v1/tasks/<task_id>` and endpoint is `top10`, then the data can be requested from `/kapacitor/v1/tasks/<task_id>/top10`.

func (*HTTPOutNode) HttpPost added in v1.3.0

func (n *HTTPOutNode) HttpPost(url string) *HTTPPostNode

Creates an HTTP Post node that POSTS received data to the provided HTTP endpoint.

func (*HTTPOutNode) InfluxDBOut added in v0.11.0

func (n *HTTPOutNode) InfluxDBOut() *InfluxDBOutNode

Create an influxdb output node that will store the incoming data into InfluxDB.

func (*HTTPOutNode) Join added in v0.11.0

func (n *HTTPOutNode) Join(others ...Node) *JoinNode

Join this node with other nodes. The data are joined on timestamp.

func (*HTTPOutNode) K8sAutoscale added in v1.1.0

func (n *HTTPOutNode) K8sAutoscale() *K8sAutoscaleNode

Create a node that can trigger autoscale events for a kubernetes cluster.

func (*HTTPOutNode) Last added in v0.11.0

func (n *HTTPOutNode) Last(field string) *InfluxQLNode

Select the last point.

func (*HTTPOutNode) Log added in v0.11.0

func (n *HTTPOutNode) Log() *LogNode

Create a node that logs all data it receives.

func (*HTTPOutNode) Max added in v0.11.0

func (n *HTTPOutNode) Max(field string) *InfluxQLNode

Select the maximum point.

func (*HTTPOutNode) Mean added in v0.11.0

func (n *HTTPOutNode) Mean(field string) *InfluxQLNode

Compute the mean of the data.

func (*HTTPOutNode) Median added in v0.11.0

func (n *HTTPOutNode) Median(field string) *InfluxQLNode

Compute the median of the data. Note, this method is not a selector, if you want the median point use `.percentile(field, 50.0)`.

func (*HTTPOutNode) Min added in v0.11.0

func (n *HTTPOutNode) Min(field string) *InfluxQLNode

Select the minimum point.

func (*HTTPOutNode) Mode added in v1.0.0

func (n *HTTPOutNode) Mode(field string) *InfluxQLNode

Compute the mode of the data.

func (*HTTPOutNode) MovingAverage added in v1.0.0

func (n *HTTPOutNode) MovingAverage(field string, window int64) *InfluxQLNode

Compute a moving average of the last window points. No points are emitted until the window is full.

func (*HTTPOutNode) Percentile added in v0.11.0

func (n *HTTPOutNode) Percentile(field string, percentile float64) *InfluxQLNode

Select a point at the given percentile. This is a selector function, no interpolation between points is performed.

func (*HTTPOutNode) Sample added in v0.11.0

func (n *HTTPOutNode) Sample(rate interface{}) *SampleNode

Create a new node that samples the incoming points or batches.

One point will be emitted every count or duration specified.

func (*HTTPOutNode) Shift added in v0.11.0

func (n *HTTPOutNode) Shift(shift time.Duration) *ShiftNode

Create a new node that shifts the incoming points or batches in time.

func (*HTTPOutNode) Spread added in v0.11.0

func (n *HTTPOutNode) Spread(field string) *InfluxQLNode

Compute the difference between `min` and `max` points.

func (*HTTPOutNode) StateCount added in v1.3.0

func (n *HTTPOutNode) StateCount(expression *ast.LambdaNode) *StateCountNode

Create a node that tracks number of consecutive points in a given state.

func (*HTTPOutNode) StateDuration added in v1.3.0

func (n *HTTPOutNode) StateDuration(expression *ast.LambdaNode) *StateDurationNode

Create a node that tracks duration in a given state.

func (*HTTPOutNode) Stddev added in v0.11.0

func (n *HTTPOutNode) Stddev(field string) *InfluxQLNode

Compute the standard deviation.

func (*HTTPOutNode) Sum added in v0.11.0

func (n *HTTPOutNode) Sum(field string) *InfluxQLNode

Compute the sum of all values.

func (*HTTPOutNode) Top added in v0.11.0

func (n *HTTPOutNode) Top(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the top `num` points for `field` and sort by any extra tags or fields.

func (*HTTPOutNode) Union added in v0.11.0

func (n *HTTPOutNode) Union(node ...Node) *UnionNode

Perform the union of this node and all other given nodes.

func (*HTTPOutNode) Where added in v0.11.0

func (n *HTTPOutNode) Where(expression *ast.LambdaNode) *WhereNode

Create a new node that filters the data stream by a given expression.

func (*HTTPOutNode) Window added in v0.11.0

func (n *HTTPOutNode) Window() *WindowNode

Create a new node that windows the stream by time.

NOTE: Window can only be applied to stream edges.

type HTTPPostNode added in v1.3.0

type HTTPPostNode struct {

	// tick:ignore
	Url string
	// contains filtered or unexported fields
}

An HTTPPostNode will take the incoming data stream and POST it to an HTTP endpoint.

Example:

stream
    |window()
        .period(10s)
        .every(5s)
    |top('value', 10)
    //Post the top 10 results over the last 10s updated every 5s.
    |httpPost('http://example.com/api/top10')

func (*HTTPPostNode) Alert added in v1.3.0

func (n *HTTPPostNode) Alert() *AlertNode

Create an alert node, which can trigger alerts.

func (*HTTPPostNode) Bottom added in v1.3.0

func (n *HTTPPostNode) Bottom(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the bottom `num` points for `field` and sort by any extra tags or fields.

func (*HTTPPostNode) Combine added in v1.3.0

func (n *HTTPPostNode) Combine(expressions ...*ast.LambdaNode) *CombineNode

Combine this node with itself. The data are combined on timestamp.

func (*HTTPPostNode) Count added in v1.3.0

func (n *HTTPPostNode) Count(field string) *InfluxQLNode

Count the number of points.

func (*HTTPPostNode) CumulativeSum added in v1.3.0

func (n *HTTPPostNode) CumulativeSum(field string) *InfluxQLNode

Compute a cumulative sum of each point that is received. A point is emitted for every point collected.

func (*HTTPPostNode) Default added in v1.3.0

func (n *HTTPPostNode) Default() *DefaultNode

Create a node that can set defaults for missing tags or fields.

func (*HTTPPostNode) Delete added in v1.3.0

func (n *HTTPPostNode) Delete() *DeleteNode

Create a node that can delete tags or fields.

func (*HTTPPostNode) Derivative added in v1.3.0

func (n *HTTPPostNode) Derivative(field string) *DerivativeNode

Create a new node that computes the derivative of adjacent points.

func (*HTTPPostNode) Difference added in v1.3.0

func (n *HTTPPostNode) Difference(field string) *InfluxQLNode

Compute the difference between points independent of elapsed time.

func (*HTTPPostNode) Distinct added in v1.3.0

func (n *HTTPPostNode) Distinct(field string) *InfluxQLNode

Produce batch of only the distinct points.

func (*HTTPPostNode) Elapsed added in v1.3.0

func (n *HTTPPostNode) Elapsed(field string, unit time.Duration) *InfluxQLNode

Compute the elapsed time between points

func (*HTTPPostNode) Eval added in v1.3.0

func (n *HTTPPostNode) Eval(expressions ...*ast.LambdaNode) *EvalNode

Create an eval node that will evaluate the given transformation function to each data point. A list of expressions may be provided and will be evaluated in the order they are given. The results are available to later expressions.

func (*HTTPPostNode) First added in v1.3.0

func (n *HTTPPostNode) First(field string) *InfluxQLNode

Select the first point.

func (*HTTPPostNode) Flatten added in v1.3.0

func (n *HTTPPostNode) Flatten() *FlattenNode

Flatten points with similar times into a single point.

func (*HTTPPostNode) GroupBy added in v1.3.0

func (n *HTTPPostNode) GroupBy(tag ...interface{}) *GroupByNode

Group the data by a set of tags.

Can pass literal * to group by all dimensions. Example:

|groupBy(*)

func (*HTTPPostNode) HoltWinters added in v1.3.0

func (n *HTTPPostNode) HoltWinters(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set.

func (*HTTPPostNode) HoltWintersWithFit added in v1.3.0

func (n *HTTPPostNode) HoltWintersWithFit(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set. This method also outputs all the points used to fit the data in addition to the forecasted data.

func (*HTTPPostNode) HttpOut added in v1.3.0

func (n *HTTPPostNode) HttpOut(endpoint string) *HTTPOutNode

Create an HTTP output node that caches the most recent data it has received. The cached data are available at the given endpoint. The endpoint is the relative path from the API endpoint of the running task. For example, if the task endpoint is at `/kapacitor/v1/tasks/<task_id>` and endpoint is `top10`, then the data can be requested from `/kapacitor/v1/tasks/<task_id>/top10`.

func (*HTTPPostNode) HttpPost added in v1.3.0

func (n *HTTPPostNode) HttpPost(url string) *HTTPPostNode

Creates an HTTP Post node that POSTS received data to the provided HTTP endpoint.

func (*HTTPPostNode) InfluxDBOut added in v1.3.0

func (n *HTTPPostNode) InfluxDBOut() *InfluxDBOutNode

Create an influxdb output node that will store the incoming data into InfluxDB.

func (*HTTPPostNode) Join added in v1.3.0

func (n *HTTPPostNode) Join(others ...Node) *JoinNode

Join this node with other nodes. The data are joined on timestamp.

func (*HTTPPostNode) K8sAutoscale added in v1.3.0

func (n *HTTPPostNode) K8sAutoscale() *K8sAutoscaleNode

Create a node that can trigger autoscale events for a kubernetes cluster.

func (*HTTPPostNode) Last added in v1.3.0

func (n *HTTPPostNode) Last(field string) *InfluxQLNode

Select the last point.

func (*HTTPPostNode) Log added in v1.3.0

func (n *HTTPPostNode) Log() *LogNode

Create a node that logs all data it receives.

func (*HTTPPostNode) Max added in v1.3.0

func (n *HTTPPostNode) Max(field string) *InfluxQLNode

Select the maximum point.

func (*HTTPPostNode) Mean added in v1.3.0

func (n *HTTPPostNode) Mean(field string) *InfluxQLNode

Compute the mean of the data.

func (*HTTPPostNode) Median added in v1.3.0

func (n *HTTPPostNode) Median(field string) *InfluxQLNode

Compute the median of the data. Note, this method is not a selector, if you want the median point use `.percentile(field, 50.0)`.

func (*HTTPPostNode) Min added in v1.3.0

func (n *HTTPPostNode) Min(field string) *InfluxQLNode

Select the minimum point.

func (*HTTPPostNode) Mode added in v1.3.0

func (n *HTTPPostNode) Mode(field string) *InfluxQLNode

Compute the mode of the data.

func (*HTTPPostNode) MovingAverage added in v1.3.0

func (n *HTTPPostNode) MovingAverage(field string, window int64) *InfluxQLNode

Compute a moving average of the last window points. No points are emitted until the window is full.

func (*HTTPPostNode) Percentile added in v1.3.0

func (n *HTTPPostNode) Percentile(field string, percentile float64) *InfluxQLNode

Select a point at the given percentile. This is a selector function, no interpolation between points is performed.

func (*HTTPPostNode) Sample added in v1.3.0

func (n *HTTPPostNode) Sample(rate interface{}) *SampleNode

Create a new node that samples the incoming points or batches.

One point will be emitted every count or duration specified.

func (*HTTPPostNode) Shift added in v1.3.0

func (n *HTTPPostNode) Shift(shift time.Duration) *ShiftNode

Create a new node that shifts the incoming points or batches in time.

func (*HTTPPostNode) Spread added in v1.3.0

func (n *HTTPPostNode) Spread(field string) *InfluxQLNode

Compute the difference between `min` and `max` points.

func (*HTTPPostNode) StateCount added in v1.3.0

func (n *HTTPPostNode) StateCount(expression *ast.LambdaNode) *StateCountNode

Create a node that tracks number of consecutive points in a given state.

func (*HTTPPostNode) StateDuration added in v1.3.0

func (n *HTTPPostNode) StateDuration(expression *ast.LambdaNode) *StateDurationNode

Create a node that tracks duration in a given state.

func (*HTTPPostNode) Stddev added in v1.3.0

func (n *HTTPPostNode) Stddev(field string) *InfluxQLNode

Compute the standard deviation.

func (*HTTPPostNode) Sum added in v1.3.0

func (n *HTTPPostNode) Sum(field string) *InfluxQLNode

Compute the sum of all values.

func (*HTTPPostNode) Top added in v1.3.0

func (n *HTTPPostNode) Top(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the top `num` points for `field` and sort by any extra tags or fields.

func (*HTTPPostNode) Union added in v1.3.0

func (n *HTTPPostNode) Union(node ...Node) *UnionNode

Perform the union of this node and all other given nodes.

func (*HTTPPostNode) Where added in v1.3.0

func (n *HTTPPostNode) Where(expression *ast.LambdaNode) *WhereNode

Create a new node that filters the data stream by a given expression.

func (*HTTPPostNode) Window added in v1.3.0

func (n *HTTPPostNode) Window() *WindowNode

Create a new node that windows the stream by time.

NOTE: Window can only be applied to stream edges.

type HipChatHandler added in v0.2.4

type HipChatHandler struct {
	*AlertNode

	// HipChat room in which to post messages.
	// If empty uses the channel from the configuration.
	Room string

	// HipChat authentication token.
	// If empty uses the token from the configuration.
	Token string
}

tick:embedded:AlertNode.HipChat

func (HipChatHandler) Alert added in v0.13.0

func (n HipChatHandler) Alert() *AlertNode

Create an alert node, which can trigger alerts.

func (HipChatHandler) Bottom added in v0.13.0

func (n HipChatHandler) Bottom(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the bottom `num` points for `field` and sort by any extra tags or fields.

func (HipChatHandler) Combine added in v1.0.0

func (n HipChatHandler) Combine(expressions ...*ast.LambdaNode) *CombineNode

Combine this node with itself. The data are combined on timestamp.

func (HipChatHandler) Count added in v0.13.0

func (n HipChatHandler) Count(field string) *InfluxQLNode

Count the number of points.

func (HipChatHandler) CumulativeSum added in v1.1.0

func (n HipChatHandler) CumulativeSum(field string) *InfluxQLNode

Compute a cumulative sum of each point that is received. A point is emitted for every point collected.

func (HipChatHandler) Default added in v0.13.0

func (n HipChatHandler) Default() *DefaultNode

Create a node that can set defaults for missing tags or fields.

func (HipChatHandler) Delete added in v1.0.0

func (n HipChatHandler) Delete() *DeleteNode

Create a node that can delete tags or fields.

func (HipChatHandler) Derivative added in v0.13.0

func (n HipChatHandler) Derivative(field string) *DerivativeNode

Create a new node that computes the derivative of adjacent points.

func (HipChatHandler) Difference added in v1.0.0

func (n HipChatHandler) Difference(field string) *InfluxQLNode

Compute the difference between points independent of elapsed time.

func (HipChatHandler) Distinct added in v0.13.0

func (n HipChatHandler) Distinct(field string) *InfluxQLNode

Produce batch of only the distinct points.

func (HipChatHandler) Elapsed added in v0.13.0

func (n HipChatHandler) Elapsed(field string, unit time.Duration) *InfluxQLNode

Compute the elapsed time between points

func (HipChatHandler) Eval added in v0.13.0

func (n HipChatHandler) Eval(expressions ...*ast.LambdaNode) *EvalNode

Create an eval node that will evaluate the given transformation function to each data point. A list of expressions may be provided and will be evaluated in the order they are given. The results are available to later expressions.

func (HipChatHandler) First added in v0.13.0

func (n HipChatHandler) First(field string) *InfluxQLNode

Select the first point.

func (HipChatHandler) Flatten added in v1.0.0

func (n HipChatHandler) Flatten() *FlattenNode

Flatten points with similar times into a single point.

func (HipChatHandler) GroupBy added in v0.13.0

func (n HipChatHandler) GroupBy(tag ...interface{}) *GroupByNode

Group the data by a set of tags.

Can pass literal * to group by all dimensions. Example:

|groupBy(*)

func (HipChatHandler) HoltWinters added in v1.0.0

func (n HipChatHandler) HoltWinters(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set.

func (HipChatHandler) HoltWintersWithFit added in v1.0.0

func (n HipChatHandler) HoltWintersWithFit(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set. This method also outputs all the points used to fit the data in addition to the forecasted data.

func (HipChatHandler) HttpOut added in v0.13.0

func (n HipChatHandler) HttpOut(endpoint string) *HTTPOutNode

Create an HTTP output node that caches the most recent data it has received. The cached data are available at the given endpoint. The endpoint is the relative path from the API endpoint of the running task. For example, if the task endpoint is at `/kapacitor/v1/tasks/<task_id>` and endpoint is `top10`, then the data can be requested from `/kapacitor/v1/tasks/<task_id>/top10`.

func (HipChatHandler) HttpPost added in v1.3.0

func (n HipChatHandler) HttpPost(url string) *HTTPPostNode

Creates an HTTP Post node that POSTS received data to the provided HTTP endpoint.

func (HipChatHandler) InfluxDBOut added in v0.13.0

func (n HipChatHandler) InfluxDBOut() *InfluxDBOutNode

Create an influxdb output node that will store the incoming data into InfluxDB.

func (HipChatHandler) Join added in v0.13.0

func (n HipChatHandler) Join(others ...Node) *JoinNode

Join this node with other nodes. The data are joined on timestamp.

func (HipChatHandler) K8sAutoscale added in v1.1.0

func (n HipChatHandler) K8sAutoscale() *K8sAutoscaleNode

Create a node that can trigger autoscale events for a kubernetes cluster.

func (HipChatHandler) Last added in v0.13.0

func (n HipChatHandler) Last(field string) *InfluxQLNode

Select the last point.

func (HipChatHandler) Max added in v0.13.0

func (n HipChatHandler) Max(field string) *InfluxQLNode

Select the maximum point.

func (HipChatHandler) Mean added in v0.13.0

func (n HipChatHandler) Mean(field string) *InfluxQLNode

Compute the mean of the data.

func (HipChatHandler) Median added in v0.13.0

func (n HipChatHandler) Median(field string) *InfluxQLNode

Compute the median of the data. Note, this method is not a selector, if you want the median point use `.percentile(field, 50.0)`.

func (HipChatHandler) Min added in v0.13.0

func (n HipChatHandler) Min(field string) *InfluxQLNode

Select the minimum point.

func (HipChatHandler) Mode added in v1.0.0

func (n HipChatHandler) Mode(field string) *InfluxQLNode

Compute the mode of the data.

func (HipChatHandler) MovingAverage added in v1.0.0

func (n HipChatHandler) MovingAverage(field string, window int64) *InfluxQLNode

Compute a moving average of the last window points. No points are emitted until the window is full.

func (HipChatHandler) Percentile added in v0.13.0

func (n HipChatHandler) Percentile(field string, percentile float64) *InfluxQLNode

Select a point at the given percentile. This is a selector function, no interpolation between points is performed.

func (HipChatHandler) Sample added in v0.13.0

func (n HipChatHandler) Sample(rate interface{}) *SampleNode

Create a new node that samples the incoming points or batches.

One point will be emitted every count or duration specified.

func (HipChatHandler) Shift added in v0.13.0

func (n HipChatHandler) Shift(shift time.Duration) *ShiftNode

Create a new node that shifts the incoming points or batches in time.

func (HipChatHandler) Spread added in v0.13.0

func (n HipChatHandler) Spread(field string) *InfluxQLNode

Compute the difference between `min` and `max` points.

func (HipChatHandler) StateCount added in v1.3.0

func (n HipChatHandler) StateCount(expression *ast.LambdaNode) *StateCountNode

Create a node that tracks number of consecutive points in a given state.

func (HipChatHandler) StateDuration added in v1.3.0

func (n HipChatHandler) StateDuration(expression *ast.LambdaNode) *StateDurationNode

Create a node that tracks duration in a given state.

func (HipChatHandler) Stddev added in v0.13.0

func (n HipChatHandler) Stddev(field string) *InfluxQLNode

Compute the standard deviation.

func (HipChatHandler) Sum added in v0.13.0

func (n HipChatHandler) Sum(field string) *InfluxQLNode

Compute the sum of all values.

func (HipChatHandler) Top added in v0.13.0

func (n HipChatHandler) Top(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the top `num` points for `field` and sort by any extra tags or fields.

func (HipChatHandler) Union added in v0.13.0

func (n HipChatHandler) Union(node ...Node) *UnionNode

Perform the union of this node and all other given nodes.

func (HipChatHandler) Where added in v0.13.0

func (n HipChatHandler) Where(expression *ast.LambdaNode) *WhereNode

Create a new node that filters the data stream by a given expression.

func (HipChatHandler) Window added in v0.13.0

func (n HipChatHandler) Window() *WindowNode

Create a new node that windows the stream by time.

NOTE: Window can only be applied to stream edges.

type ID

type ID int

type InfluxDBOutNode

type InfluxDBOutNode struct {

	// The name of the InfluxDB instance to connect to.
	// If empty the configured default will be used.
	Cluster string
	// The name of the database.
	Database string
	// The name of the retention policy.
	RetentionPolicy string
	// The name of the measurement.
	Measurement string
	// The write consistency to use when writing the data.
	WriteConsistency string
	// The precision to use when writing the data.
	Precision string
	// Number of points to buffer when writing to InfluxDB.
	// Default: 1000
	Buffer int64
	// Write points to InfluxDB after interval even if buffer is not full.
	// Default: 10s
	FlushInterval time.Duration
	// Static set of tags to add to all data points before writing them.
	// tick:ignore
	Tags map[string]string `tick:"Tag"`
	// Create the specified database and retention policy
	// tick:ignore
	CreateFlag bool `tick:"Create"`
	// contains filtered or unexported fields
}

Writes the data to InfluxDB as it is received.

Example:

stream
    |eval(lambda: "errors" / "total")
        .as('error_percent')
    // Write the transformed data to InfluxDB
    |influxDBOut()
        .database('mydb')
        .retentionPolicy('myrp')
        .measurement('errors')
        .tag('kapacitor', 'true')
        .tag('version', '0.2')

Available Statistics:

  • points_written -- number of points written to InfluxDB
  • write_errors -- number of errors attempting to write to InfluxDB

func (*InfluxDBOutNode) Children

func (n *InfluxDBOutNode) Children() []Node

tick:ignore

func (*InfluxDBOutNode) Create added in v1.0.1

func (i *InfluxDBOutNode) Create() *InfluxDBOutNode

Create indicates that both the database and retention policy will be created, when the task is started. If the retention policy name is empty than no retention policy will be specified and the default retention policy name will be created.

If the database already exists nothing happens.

tick:property

func (*InfluxDBOutNode) Deadman added in v0.10.0

func (n *InfluxDBOutNode) Deadman(threshold float64, interval time.Duration, expr ...*ast.LambdaNode) *AlertNode

Helper function for creating an alert on low throughput, a.k.a. deadman's switch.

- Threshold -- trigger alert if throughput drops below threshold in points/interval. - Interval -- how often to check the throughput. - Expressions -- optional list of expressions to also evaluate. Useful for time of day alerting.

Example:

var data = stream
    |from()...
// Trigger critical alert if the throughput drops below 100 points per 10s and checked every 10s.
data
    |deadman(100.0, 10s)
//Do normal processing of data
data...

The above is equivalent to this Example:

var data = stream
    |from()...
// Trigger critical alert if the throughput drops below 100 points per 10s and checked every 10s.
data
    |stats(10s)
        .align()
    |derivative('emitted')
        .unit(10s)
        .nonNegative()
    |alert()
        .id('node \'stream0\' in task \'{{ .TaskName }}\'')
        .message('{{ .ID }} is {{ if eq .Level "OK" }}alive{{ else }}dead{{ end }}: {{ index .Fields "emitted" | printf "%0.3f" }} points/10s.')
        .crit(lambda: "emitted" <= 100.0)
//Do normal processing of data
data...

The `id` and `message` alert properties can be configured globally via the 'deadman' configuration section.

Since the AlertNode is the last piece it can be further modified as usual. Example:

var data = stream
    |from()...
// Trigger critical alert if the throughput drops below 100 points per 10s and checked every 10s.
data
    |deadman(100.0, 10s)
        .slack()
        .channel('#dead_tasks')
//Do normal processing of data
data...

You can specify additional lambda expressions to further constrain when the deadman's switch is triggered. Example:

var data = stream
    |from()...
// Trigger critical alert if the throughput drops below 100 points per 10s and checked every 10s.
// Only trigger the alert if the time of day is between 8am-5pm.
data
    |deadman(100.0, 10s, lambda: hour("time") >= 8 AND hour("time") <= 17)
//Do normal processing of data
data...

func (*InfluxDBOutNode) Desc

func (n *InfluxDBOutNode) Desc() string

tick:ignore

func (*InfluxDBOutNode) ID

func (n *InfluxDBOutNode) ID() ID

tick:ignore

func (*InfluxDBOutNode) Name

func (n *InfluxDBOutNode) Name() string

tick:ignore

func (*InfluxDBOutNode) Parents

func (n *InfluxDBOutNode) Parents() []Node

tick:ignore

func (*InfluxDBOutNode) Provides

func (n *InfluxDBOutNode) Provides() EdgeType

tick:ignore

func (*InfluxDBOutNode) SetName

func (n *InfluxDBOutNode) SetName(name string)

tick:ignore

func (*InfluxDBOutNode) Stats added in v0.10.0

func (n *InfluxDBOutNode) Stats(interval time.Duration) *StatsNode

Create a new stream of data that contains the internal statistics of the node. The interval represents how often to emit the statistics based on real time. This means the interval time is independent of the times of the data points the source node is receiving.

func (*InfluxDBOutNode) Tag

func (i *InfluxDBOutNode) Tag(key, value string) *InfluxDBOutNode

Add a static tag to all data points. Tag can be called more than once.

tick:property

func (*InfluxDBOutNode) Wants

func (n *InfluxDBOutNode) Wants() EdgeType

tick:ignore

type InfluxQLNode added in v0.11.0

type InfluxQLNode struct {

	// tick:ignore
	Method string
	// tick:ignore
	Field string

	// The name of the field, defaults to the name of
	// function used (i.e. .mean -> 'mean')
	As string

	// tick:ignore
	ReduceCreater ReduceCreater

	// tick:ignore
	PointTimes bool `tick:"UsePointTimes"`
	// contains filtered or unexported fields
}

An InfluxQLNode performs the available function from the InfluxQL language. These function can be performed on a stream or batch edge. The resulting edge is dependent on the function. For a stream edge, all points with the same time are accumulated into the function. For a batch edge, all points in the batch are accumulated into the function.

Example:

stream
    |window()
        .period(10s)
        .every(10s)
    // Sum the values for each 10s window of data.
    |sum('value')

Note: Derivative has its own implementation as a DerivativeNode instead of as part of the InfluxQL functions.

func (*InfluxQLNode) Alert added in v0.11.0

func (n *InfluxQLNode) Alert() *AlertNode

Create an alert node, which can trigger alerts.

func (*InfluxQLNode) Bottom added in v0.11.0

func (n *InfluxQLNode) Bottom(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the bottom `num` points for `field` and sort by any extra tags or fields.

func (*InfluxQLNode) Combine added in v1.0.0

func (n *InfluxQLNode) Combine(expressions ...*ast.LambdaNode) *CombineNode

Combine this node with itself. The data are combined on timestamp.

func (*InfluxQLNode) Count added in v0.11.0

func (n *InfluxQLNode) Count(field string) *InfluxQLNode

Count the number of points.

func (*InfluxQLNode) CumulativeSum added in v1.1.0

func (n *InfluxQLNode) CumulativeSum(field string) *InfluxQLNode

Compute a cumulative sum of each point that is received. A point is emitted for every point collected.

func (*InfluxQLNode) Default added in v0.13.0

func (n *InfluxQLNode) Default() *DefaultNode

Create a node that can set defaults for missing tags or fields.

func (*InfluxQLNode) Delete added in v1.0.0

func (n *InfluxQLNode) Delete() *DeleteNode

Create a node that can delete tags or fields.

func (*InfluxQLNode) Derivative added in v0.11.0

func (n *InfluxQLNode) Derivative(field string) *DerivativeNode

Create a new node that computes the derivative of adjacent points.

func (*InfluxQLNode) Difference added in v1.0.0

func (n *InfluxQLNode) Difference(field string) *InfluxQLNode

Compute the difference between points independent of elapsed time.

func (*InfluxQLNode) Distinct added in v0.11.0

func (n *InfluxQLNode) Distinct(field string) *InfluxQLNode

Produce batch of only the distinct points.

func (*InfluxQLNode) Elapsed added in v0.13.0

func (n *InfluxQLNode) Elapsed(field string, unit time.Duration) *InfluxQLNode

Compute the elapsed time between points

func (*InfluxQLNode) Eval added in v0.11.0

func (n *InfluxQLNode) Eval(expressions ...*ast.LambdaNode) *EvalNode

Create an eval node that will evaluate the given transformation function to each data point. A list of expressions may be provided and will be evaluated in the order they are given. The results are available to later expressions.

func (*InfluxQLNode) First added in v0.11.0

func (n *InfluxQLNode) First(field string) *InfluxQLNode

Select the first point.

func (*InfluxQLNode) Flatten added in v1.0.0

func (n *InfluxQLNode) Flatten() *FlattenNode

Flatten points with similar times into a single point.

func (*InfluxQLNode) GroupBy added in v0.11.0

func (n *InfluxQLNode) GroupBy(tag ...interface{}) *GroupByNode

Group the data by a set of tags.

Can pass literal * to group by all dimensions. Example:

|groupBy(*)

func (*InfluxQLNode) HoltWinters added in v1.0.0

func (n *InfluxQLNode) HoltWinters(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set.

func (*InfluxQLNode) HoltWintersWithFit added in v1.0.0

func (n *InfluxQLNode) HoltWintersWithFit(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set. This method also outputs all the points used to fit the data in addition to the forecasted data.

func (*InfluxQLNode) HttpOut added in v0.11.0

func (n *InfluxQLNode) HttpOut(endpoint string) *HTTPOutNode

Create an HTTP output node that caches the most recent data it has received. The cached data are available at the given endpoint. The endpoint is the relative path from the API endpoint of the running task. For example, if the task endpoint is at `/kapacitor/v1/tasks/<task_id>` and endpoint is `top10`, then the data can be requested from `/kapacitor/v1/tasks/<task_id>/top10`.

func (*InfluxQLNode) HttpPost added in v1.3.0

func (n *InfluxQLNode) HttpPost(url string) *HTTPPostNode

Creates an HTTP Post node that POSTS received data to the provided HTTP endpoint.

func (*InfluxQLNode) InfluxDBOut added in v0.11.0

func (n *InfluxQLNode) InfluxDBOut() *InfluxDBOutNode

Create an influxdb output node that will store the incoming data into InfluxDB.

func (*InfluxQLNode) Join added in v0.11.0

func (n *InfluxQLNode) Join(others ...Node) *JoinNode

Join this node with other nodes. The data are joined on timestamp.

func (*InfluxQLNode) K8sAutoscale added in v1.1.0

func (n *InfluxQLNode) K8sAutoscale() *K8sAutoscaleNode

Create a node that can trigger autoscale events for a kubernetes cluster.

func (*InfluxQLNode) Last added in v0.11.0

func (n *InfluxQLNode) Last(field string) *InfluxQLNode

Select the last point.

func (*InfluxQLNode) Log added in v0.11.0

func (n *InfluxQLNode) Log() *LogNode

Create a node that logs all data it receives.

func (*InfluxQLNode) Max added in v0.11.0

func (n *InfluxQLNode) Max(field string) *InfluxQLNode

Select the maximum point.

func (*InfluxQLNode) Mean added in v0.11.0

func (n *InfluxQLNode) Mean(field string) *InfluxQLNode

Compute the mean of the data.

func (*InfluxQLNode) Median added in v0.11.0

func (n *InfluxQLNode) Median(field string) *InfluxQLNode

Compute the median of the data. Note, this method is not a selector, if you want the median point use `.percentile(field, 50.0)`.

func (*InfluxQLNode) Min added in v0.11.0

func (n *InfluxQLNode) Min(field string) *InfluxQLNode

Select the minimum point.

func (*InfluxQLNode) Mode added in v1.0.0

func (n *InfluxQLNode) Mode(field string) *InfluxQLNode

Compute the mode of the data.

func (*InfluxQLNode) MovingAverage added in v1.0.0

func (n *InfluxQLNode) MovingAverage(field string, window int64) *InfluxQLNode

Compute a moving average of the last window points. No points are emitted until the window is full.

func (*InfluxQLNode) Percentile added in v0.11.0

func (n *InfluxQLNode) Percentile(field string, percentile float64) *InfluxQLNode

Select a point at the given percentile. This is a selector function, no interpolation between points is performed.

func (*InfluxQLNode) Sample added in v0.11.0

func (n *InfluxQLNode) Sample(rate interface{}) *SampleNode

Create a new node that samples the incoming points or batches.

One point will be emitted every count or duration specified.

func (*InfluxQLNode) Shift added in v0.11.0

func (n *InfluxQLNode) Shift(shift time.Duration) *ShiftNode

Create a new node that shifts the incoming points or batches in time.

func (*InfluxQLNode) Spread added in v0.11.0

func (n *InfluxQLNode) Spread(field string) *InfluxQLNode

Compute the difference between `min` and `max` points.

func (*InfluxQLNode) StateCount added in v1.3.0

func (n *InfluxQLNode) StateCount(expression *ast.LambdaNode) *StateCountNode

Create a node that tracks number of consecutive points in a given state.

func (*InfluxQLNode) StateDuration added in v1.3.0

func (n *InfluxQLNode) StateDuration(expression *ast.LambdaNode) *StateDurationNode

Create a node that tracks duration in a given state.

func (*InfluxQLNode) Stddev added in v0.11.0

func (n *InfluxQLNode) Stddev(field string) *InfluxQLNode

Compute the standard deviation.

func (*InfluxQLNode) Sum added in v0.11.0

func (n *InfluxQLNode) Sum(field string) *InfluxQLNode

Compute the sum of all values.

func (*InfluxQLNode) Top added in v0.11.0

func (n *InfluxQLNode) Top(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the top `num` points for `field` and sort by any extra tags or fields.

func (*InfluxQLNode) Union added in v0.11.0

func (n *InfluxQLNode) Union(node ...Node) *UnionNode

Perform the union of this node and all other given nodes.

func (*InfluxQLNode) UsePointTimes added in v0.11.0

func (n *InfluxQLNode) UsePointTimes() *InfluxQLNode

Use the time of the selected point instead of the time of the batch.

Only applies to selector functions like first, last, top, bottom, etc. Aggregation functions always use the batch time. tick:property

func (*InfluxQLNode) Where added in v0.11.0

func (n *InfluxQLNode) Where(expression *ast.LambdaNode) *WhereNode

Create a new node that filters the data stream by a given expression.

func (*InfluxQLNode) Window added in v0.11.0

func (n *InfluxQLNode) Window() *WindowNode

Create a new node that windows the stream by time.

NOTE: Window can only be applied to stream edges.

type IntegerBulkPointAggregator added in v0.11.0

type IntegerBulkPointAggregator interface {
	influxql.IntegerPointAggregator
	influxql.IntegerBulkPointAggregator
}

type JoinNode

type JoinNode struct {

	// The alias names of the two parents.
	// Note:
	//       Names[1] corresponds to the left  parent
	//       Names[0] corresponds to the right parent
	// tick:ignore
	Names []string `tick:"As"`

	// The dimensions on which to join
	// tick:ignore
	Dimensions []string `tick:"On"`

	// The delimiter for the field name prefixes.
	// Can be the empty string.
	Delimiter string

	// The name of this new joined data stream.
	// If empty the name of the left parent is used.
	StreamName string

	// The maximum duration of time that two incoming points
	// can be apart and still be considered to be equal in time.
	// The joined data point's time will be rounded to the nearest
	// multiple of the tolerance duration.
	Tolerance time.Duration

	// Fill the data.
	// The fill option implies the type of join: inner or full outer
	// Options are:
	//
	//   - none - (default) skip rows where a point is missing, inner join.
	//   - null - fill missing points with null, full outer join.
	//   - Any numerical value - fill fields with given value, full outer join.
	//
	// When using a numerical or null fill, the fields names are determined by copying
	// the field names from another point.
	// This doesn't work well when different sources have different field names.
	// Use the DefaultNode and DeleteNode to finalize the fill operation if necessary.
	//
	// Example:
	//    var maintlock = stream
	//        |from()
	//            .measurement('maintlock')
	//            .groupBy('service')
	//    var requests = stream
	//        |from()
	//            .measurement('requests')
	//            .groupBy('service')
	//    // Join the maintlock and requests streams
	//    // The intent it to drop any points in maintenance mode.
	//    maintlock
	//        |join(requests)
	//            // Provide prefix names for the fields of the data points.
	//            .as('maintlock', 'requests')
	//            // points that are within 1 second are considered the same time.
	//            .tolerance(1s)
	//            // fill missing fields with null, implies outer join.
	//            // a better default per field will be set later.
	//            .fill('null')
	//            // name the resulting stream.
	//            .streamName('requests')
	//        |default()
	//            // default maintenance mode to false, overwriting the null value if present.
	//            .field('maintlock.mode', false)
	//            // default the requests to 0, again overwriting the null value if present.
	//            .field('requests.value', 0.0)
	//        // drop any points that are in maintenance mode.
	//        |where(lambda: "maintlock.mode")
	//        |...
	Fill interface{}
	// contains filtered or unexported fields
}

Joins the data from any number of nodes. As each data point is received from a parent node it is paired with the next data points from the other parent nodes with a matching timestamp. Each parent node contributes at most one point to each joined point. A tolerance can be supplied to join points that do not have perfectly aligned timestamps. Any points that fall within the tolerance are joined on the timestamp. If multiple points fall within the same tolerance window than they are joined in the order they arrive.

Aliases are used to prefix all fields from the respective nodes.

The join can be an inner or outer join, see the JoinNode.Fill property.

Example:

var errors = stream
    |from()
        .measurement('errors')
var requests = stream
    |from()
        .measurement('requests')
// Join the errors and requests streams
errors
    |join(requests)
        // Provide prefix names for the fields of the data points.
        .as('errors', 'requests')
        // points that are within 1 second are considered the same time.
        .tolerance(1s)
        // fill missing values with 0, implies outer join.
        .fill(0.0)
        // name the resulting stream
        .streamName('error_rate')
    // Both the "value" fields from each parent have been prefixed
    // with the respective names 'errors' and 'requests'.
    |eval(lambda: "errors.value" / "requests.value")
       .as('rate')
    ...

In the above example the `errors` and `requests` streams are joined and then transformed to calculate a combined field.

func (*JoinNode) Alert

func (n *JoinNode) Alert() *AlertNode

Create an alert node, which can trigger alerts.

func (*JoinNode) As

func (j *JoinNode) As(names ...string) *JoinNode

Prefix names for all fields from the respective nodes. Each field from the parent nodes will be prefixed with the provided name and a '.'. See the example above.

The names cannot have a dot '.' character.

tick:property

func (*JoinNode) Bottom added in v0.11.0

func (n *JoinNode) Bottom(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the bottom `num` points for `field` and sort by any extra tags or fields.

func (*JoinNode) Combine added in v1.0.0

func (n *JoinNode) Combine(expressions ...*ast.LambdaNode) *CombineNode

Combine this node with itself. The data are combined on timestamp.

func (*JoinNode) Count added in v0.11.0

func (n *JoinNode) Count(field string) *InfluxQLNode

Count the number of points.

func (*JoinNode) CumulativeSum added in v1.1.0

func (n *JoinNode) CumulativeSum(field string) *InfluxQLNode

Compute a cumulative sum of each point that is received. A point is emitted for every point collected.

func (*JoinNode) Default added in v0.13.0

func (n *JoinNode) Default() *DefaultNode

Create a node that can set defaults for missing tags or fields.

func (*JoinNode) Delete added in v1.0.0

func (n *JoinNode) Delete() *DeleteNode

Create a node that can delete tags or fields.

func (*JoinNode) Derivative

func (n *JoinNode) Derivative(field string) *DerivativeNode

Create a new node that computes the derivative of adjacent points.

func (*JoinNode) Difference added in v1.0.0

func (n *JoinNode) Difference(field string) *InfluxQLNode

Compute the difference between points independent of elapsed time.

func (*JoinNode) Distinct added in v0.11.0

func (n *JoinNode) Distinct(field string) *InfluxQLNode

Produce batch of only the distinct points.

func (*JoinNode) Elapsed added in v0.13.0

func (n *JoinNode) Elapsed(field string, unit time.Duration) *InfluxQLNode

Compute the elapsed time between points

func (*JoinNode) Eval

func (n *JoinNode) Eval(expressions ...*ast.LambdaNode) *EvalNode

Create an eval node that will evaluate the given transformation function to each data point. A list of expressions may be provided and will be evaluated in the order they are given. The results are available to later expressions.

func (*JoinNode) First added in v0.11.0

func (n *JoinNode) First(field string) *InfluxQLNode

Select the first point.

func (*JoinNode) Flatten added in v1.0.0

func (n *JoinNode) Flatten() *FlattenNode

Flatten points with similar times into a single point.

func (*JoinNode) GroupBy

func (n *JoinNode) GroupBy(tag ...interface{}) *GroupByNode

Group the data by a set of tags.

Can pass literal * to group by all dimensions. Example:

|groupBy(*)

func (*JoinNode) HoltWinters added in v1.0.0

func (n *JoinNode) HoltWinters(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set.

func (*JoinNode) HoltWintersWithFit added in v1.0.0

func (n *JoinNode) HoltWintersWithFit(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set. This method also outputs all the points used to fit the data in addition to the forecasted data.

func (*JoinNode) HttpOut

func (n *JoinNode) HttpOut(endpoint string) *HTTPOutNode

Create an HTTP output node that caches the most recent data it has received. The cached data are available at the given endpoint. The endpoint is the relative path from the API endpoint of the running task. For example, if the task endpoint is at `/kapacitor/v1/tasks/<task_id>` and endpoint is `top10`, then the data can be requested from `/kapacitor/v1/tasks/<task_id>/top10`.

func (*JoinNode) HttpPost added in v1.3.0

func (n *JoinNode) HttpPost(url string) *HTTPPostNode

Creates an HTTP Post node that POSTS received data to the provided HTTP endpoint.

func (*JoinNode) InfluxDBOut

func (n *JoinNode) InfluxDBOut() *InfluxDBOutNode

Create an influxdb output node that will store the incoming data into InfluxDB.

func (*JoinNode) Join

func (n *JoinNode) Join(others ...Node) *JoinNode

Join this node with other nodes. The data are joined on timestamp.

func (*JoinNode) K8sAutoscale added in v1.1.0

func (n *JoinNode) K8sAutoscale() *K8sAutoscaleNode

Create a node that can trigger autoscale events for a kubernetes cluster.

func (*JoinNode) Last added in v0.11.0

func (n *JoinNode) Last(field string) *InfluxQLNode

Select the last point.

func (*JoinNode) Log added in v0.11.0

func (n *JoinNode) Log() *LogNode

Create a node that logs all data it receives.

func (*JoinNode) Max added in v0.11.0

func (n *JoinNode) Max(field string) *InfluxQLNode

Select the maximum point.

func (*JoinNode) Mean added in v0.11.0

func (n *JoinNode) Mean(field string) *InfluxQLNode

Compute the mean of the data.

func (*JoinNode) Median added in v0.11.0

func (n *JoinNode) Median(field string) *InfluxQLNode

Compute the median of the data. Note, this method is not a selector, if you want the median point use `.percentile(field, 50.0)`.

func (*JoinNode) Min added in v0.11.0

func (n *JoinNode) Min(field string) *InfluxQLNode

Select the minimum point.

func (*JoinNode) Mode added in v1.0.0

func (n *JoinNode) Mode(field string) *InfluxQLNode

Compute the mode of the data.

func (*JoinNode) MovingAverage added in v1.0.0

func (n *JoinNode) MovingAverage(field string, window int64) *InfluxQLNode

Compute a moving average of the last window points. No points are emitted until the window is full.

func (*JoinNode) On added in v0.11.0

func (j *JoinNode) On(dims ...string) *JoinNode

Join on a subset of the group by dimensions. This is a special case where you want a single point from one parent to join with multiple points from a different parent.

For example given two measurements:

1. building_power (a single value) -- tagged by building, value is the total power consumed by the building. 2. floor_power (multiple values) -- tagged by building and floor, values are the total power consumed by each floor.

You want to calculate the percentage of the total building power consumed by each floor. Since you only have one point per building you need it to join multiple times with the points from each floor. By defining the `on` dimensions as `building` we are saying that we want points that only have the building tag to be joined with more specifc points that more tags, in this case the `floor` tag. In other words while we have points with tags building and floor we only want to join on the building tag.

Example:

var building = stream
    |from()
        .measurement('building_power')
        .groupBy('building')
var floor = stream
    |from()
        .measurement('floor_power')
        .groupBy('building', 'floor')
building
    |join(floor)
        .as('building', 'floor')
        .on('building')
    |eval(lambda: "floor.value" / "building.value")
        ... // Values here are grouped by 'building' and 'floor'

tick:property

func (*JoinNode) Percentile added in v0.11.0

func (n *JoinNode) Percentile(field string, percentile float64) *InfluxQLNode

Select a point at the given percentile. This is a selector function, no interpolation between points is performed.

func (*JoinNode) Sample

func (n *JoinNode) Sample(rate interface{}) *SampleNode

Create a new node that samples the incoming points or batches.

One point will be emitted every count or duration specified.

func (*JoinNode) Shift added in v0.11.0

func (n *JoinNode) Shift(shift time.Duration) *ShiftNode

Create a new node that shifts the incoming points or batches in time.

func (*JoinNode) Spread added in v0.11.0

func (n *JoinNode) Spread(field string) *InfluxQLNode

Compute the difference between `min` and `max` points.

func (*JoinNode) StateCount added in v1.3.0

func (n *JoinNode) StateCount(expression *ast.LambdaNode) *StateCountNode

Create a node that tracks number of consecutive points in a given state.

func (*JoinNode) StateDuration added in v1.3.0

func (n *JoinNode) StateDuration(expression *ast.LambdaNode) *StateDurationNode

Create a node that tracks duration in a given state.

func (*JoinNode) Stddev added in v0.11.0

func (n *JoinNode) Stddev(field string) *InfluxQLNode

Compute the standard deviation.

func (*JoinNode) Sum added in v0.11.0

func (n *JoinNode) Sum(field string) *InfluxQLNode

Compute the sum of all values.

func (*JoinNode) Top added in v0.11.0

func (n *JoinNode) Top(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the top `num` points for `field` and sort by any extra tags or fields.

func (*JoinNode) Union

func (n *JoinNode) Union(node ...Node) *UnionNode

Perform the union of this node and all other given nodes.

func (*JoinNode) Where

func (n *JoinNode) Where(expression *ast.LambdaNode) *WhereNode

Create a new node that filters the data stream by a given expression.

func (*JoinNode) Window

func (n *JoinNode) Window() *WindowNode

Create a new node that windows the stream by time.

NOTE: Window can only be applied to stream edges.

type K8sAutoscaleNode added in v1.1.0

type K8sAutoscaleNode struct {

	// Cluster is the name of the Kubernetes cluster to use.
	Cluster string

	// Namespace is the namespace of the resource, if empty the default namespace will be used.
	Namespace string

	// Kind is the type of resources to autoscale.
	// Currently only "deployments", "replicasets" and "replicationcontrollers" are supported.
	// Default: "deployments"
	Kind string

	// ResourceName is the name of the resource to autoscale.
	ResourceName string

	// ResourceNameTag is the name of a tag that names the resource to autoscale.
	ResourceNameTag string

	// CurrentField is the name of a field into which the current replica count will be set as an int.
	// If empty no field will be set.
	// Useful for computing deltas on the current state.
	//
	// Example:
	//    |k8sAutoscale()
	//        .currentField('replicas')
	//        // Increase the replicas by 1 if the qps is over the threshold
	//        .replicas(lambda: if("qps" > threshold, "replicas" + 1, "replicas"))
	//
	CurrentField string

	// The maximum scale factor to set.
	// If 0 then there is no upper limit.
	// Default: 0, a.k.a no limit.
	Max int64

	// The minimum scale factor to set.
	// Default: 1
	Min int64

	// Replicas is a lambda expression that should evaluate to the desired number of replicas for the resource.
	Replicas *ast.LambdaNode

	// Only one increase event can be triggered per resource every IncreaseCooldown interval.
	IncreaseCooldown time.Duration
	// Only one decrease event can be triggered per resource every DecreaseCooldown interval.
	DecreaseCooldown time.Duration

	// NamespaceTag is the name of a tag to use when tagging emitted points with the namespace.
	// If empty the point will not be tagged with the resource.
	// Default: namespace
	NamespaceTag string

	// KindTag is the name of a tag to use when tagging emitted points with the kind.
	// If empty the point will not be tagged with the resource.
	// Default: kind
	KindTag string

	// ResourceTag is the name of a tag to use when tagging emitted points the resource.
	// If empty the point will not be tagged with the resource.
	// Default: resource
	ResourceTag string
	// contains filtered or unexported fields
}

K8sAutoscaleNode triggers autoscale events for a resource on a Kubernetes cluster. The node also outputs points for the triggered events.

Example:

// Target 100 requests per second per host
var target = 100.0
var min = 1
var max = 100
var period = 5m
var every = period
stream
    |from()
        .measurement('requests')
        .groupBy('host', 'deployment')
        .truncate(1s)
    |derivative('value')
        .as('requests_per_second')
        .unit(1s)
        .nonNegative()
    |groupBy('deployment')
    |sum('requests_per_second')
        .as('total_requests')
    |window()
        .period(period)
        .every(every)
    |mean('total_requests')
        .as('total_requests')
    |k8sAutoscale()
        // Get the name of the deployment from the 'deployment' tag.
        .resourceNameTag('deployment')
        .min(min)
        .max(max)
        // Set the desired number of replicas based on target.
        .replicas(lambda: int(ceil("total_requests" / target)))
    |influxDBOut()
        .database('deployments')
        .measurement('scale_events')
        .precision('s')

The above example computes the requests per second by deployment and host. Then the total_requests per second across all hosts is computed per deployment. Using the mean of the total_requests over the last time period a desired number of replicas is computed based on the target number of request per second per host.

If the desired number of replicas has changed, Kapacitor makes the appropriate API call to Kubernetes to update the replicas spec.

Any time the k8sAutoscale node changes a replica count, it emits a point. The point is tagged with the namespace, kind and resource name, using the NamespaceTag, KindTag, and ResourceTag properties respectively. In addition the group by tags will be preserved on the emitted point. The point contains two fields: `old`, and `new` representing change in the replicas.

Available Statistics:

  • increase_events -- number of times the replica count was increased.
  • decrease_events -- number of times the replica count was decreased.
  • cooldown_drops -- number of times an event was dropped because of a cooldown timer.
  • errors -- number of errors encountered, typically related to communicating with the Kubernetes API.

func (*K8sAutoscaleNode) Alert added in v1.1.0

func (n *K8sAutoscaleNode) Alert() *AlertNode

Create an alert node, which can trigger alerts.

func (*K8sAutoscaleNode) Bottom added in v1.1.0

func (n *K8sAutoscaleNode) Bottom(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the bottom `num` points for `field` and sort by any extra tags or fields.

func (*K8sAutoscaleNode) Combine added in v1.1.0

func (n *K8sAutoscaleNode) Combine(expressions ...*ast.LambdaNode) *CombineNode

Combine this node with itself. The data are combined on timestamp.

func (*K8sAutoscaleNode) Count added in v1.1.0

func (n *K8sAutoscaleNode) Count(field string) *InfluxQLNode

Count the number of points.

func (*K8sAutoscaleNode) CumulativeSum added in v1.1.0

func (n *K8sAutoscaleNode) CumulativeSum(field string) *InfluxQLNode

Compute a cumulative sum of each point that is received. A point is emitted for every point collected.

func (*K8sAutoscaleNode) Default added in v1.1.0

func (n *K8sAutoscaleNode) Default() *DefaultNode

Create a node that can set defaults for missing tags or fields.

func (*K8sAutoscaleNode) Delete added in v1.1.0

func (n *K8sAutoscaleNode) Delete() *DeleteNode

Create a node that can delete tags or fields.

func (*K8sAutoscaleNode) Derivative added in v1.1.0

func (n *K8sAutoscaleNode) Derivative(field string) *DerivativeNode

Create a new node that computes the derivative of adjacent points.

func (*K8sAutoscaleNode) Difference added in v1.1.0

func (n *K8sAutoscaleNode) Difference(field string) *InfluxQLNode

Compute the difference between points independent of elapsed time.

func (*K8sAutoscaleNode) Distinct added in v1.1.0

func (n *K8sAutoscaleNode) Distinct(field string) *InfluxQLNode

Produce batch of only the distinct points.

func (*K8sAutoscaleNode) Elapsed added in v1.1.0

func (n *K8sAutoscaleNode) Elapsed(field string, unit time.Duration) *InfluxQLNode

Compute the elapsed time between points

func (*K8sAutoscaleNode) Eval added in v1.1.0

func (n *K8sAutoscaleNode) Eval(expressions ...*ast.LambdaNode) *EvalNode

Create an eval node that will evaluate the given transformation function to each data point. A list of expressions may be provided and will be evaluated in the order they are given. The results are available to later expressions.

func (*K8sAutoscaleNode) First added in v1.1.0

func (n *K8sAutoscaleNode) First(field string) *InfluxQLNode

Select the first point.

func (*K8sAutoscaleNode) Flatten added in v1.1.0

func (n *K8sAutoscaleNode) Flatten() *FlattenNode

Flatten points with similar times into a single point.

func (*K8sAutoscaleNode) GroupBy added in v1.1.0

func (n *K8sAutoscaleNode) GroupBy(tag ...interface{}) *GroupByNode

Group the data by a set of tags.

Can pass literal * to group by all dimensions. Example:

|groupBy(*)

func (*K8sAutoscaleNode) HoltWinters added in v1.1.0

func (n *K8sAutoscaleNode) HoltWinters(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set.

func (*K8sAutoscaleNode) HoltWintersWithFit added in v1.1.0

func (n *K8sAutoscaleNode) HoltWintersWithFit(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set. This method also outputs all the points used to fit the data in addition to the forecasted data.

func (*K8sAutoscaleNode) HttpOut added in v1.1.0

func (n *K8sAutoscaleNode) HttpOut(endpoint string) *HTTPOutNode

Create an HTTP output node that caches the most recent data it has received. The cached data are available at the given endpoint. The endpoint is the relative path from the API endpoint of the running task. For example, if the task endpoint is at `/kapacitor/v1/tasks/<task_id>` and endpoint is `top10`, then the data can be requested from `/kapacitor/v1/tasks/<task_id>/top10`.

func (*K8sAutoscaleNode) HttpPost added in v1.3.0

func (n *K8sAutoscaleNode) HttpPost(url string) *HTTPPostNode

Creates an HTTP Post node that POSTS received data to the provided HTTP endpoint.

func (*K8sAutoscaleNode) InfluxDBOut added in v1.1.0

func (n *K8sAutoscaleNode) InfluxDBOut() *InfluxDBOutNode

Create an influxdb output node that will store the incoming data into InfluxDB.

func (*K8sAutoscaleNode) Join added in v1.1.0

func (n *K8sAutoscaleNode) Join(others ...Node) *JoinNode

Join this node with other nodes. The data are joined on timestamp.

func (*K8sAutoscaleNode) K8sAutoscale added in v1.1.0

func (n *K8sAutoscaleNode) K8sAutoscale() *K8sAutoscaleNode

Create a node that can trigger autoscale events for a kubernetes cluster.

func (*K8sAutoscaleNode) Last added in v1.1.0

func (n *K8sAutoscaleNode) Last(field string) *InfluxQLNode

Select the last point.

func (*K8sAutoscaleNode) Log added in v1.1.0

func (n *K8sAutoscaleNode) Log() *LogNode

Create a node that logs all data it receives.

func (*K8sAutoscaleNode) Max added in v1.1.0

func (n *K8sAutoscaleNode) Max(field string) *InfluxQLNode

Select the maximum point.

func (*K8sAutoscaleNode) Mean added in v1.1.0

func (n *K8sAutoscaleNode) Mean(field string) *InfluxQLNode

Compute the mean of the data.

func (*K8sAutoscaleNode) Median added in v1.1.0

func (n *K8sAutoscaleNode) Median(field string) *InfluxQLNode

Compute the median of the data. Note, this method is not a selector, if you want the median point use `.percentile(field, 50.0)`.

func (*K8sAutoscaleNode) Min added in v1.1.0

func (n *K8sAutoscaleNode) Min(field string) *InfluxQLNode

Select the minimum point.

func (*K8sAutoscaleNode) Mode added in v1.1.0

func (n *K8sAutoscaleNode) Mode(field string) *InfluxQLNode

Compute the mode of the data.

func (*K8sAutoscaleNode) MovingAverage added in v1.1.0

func (n *K8sAutoscaleNode) MovingAverage(field string, window int64) *InfluxQLNode

Compute a moving average of the last window points. No points are emitted until the window is full.

func (*K8sAutoscaleNode) Percentile added in v1.1.0

func (n *K8sAutoscaleNode) Percentile(field string, percentile float64) *InfluxQLNode

Select a point at the given percentile. This is a selector function, no interpolation between points is performed.

func (*K8sAutoscaleNode) Sample added in v1.1.0

func (n *K8sAutoscaleNode) Sample(rate interface{}) *SampleNode

Create a new node that samples the incoming points or batches.

One point will be emitted every count or duration specified.

func (*K8sAutoscaleNode) Shift added in v1.1.0

func (n *K8sAutoscaleNode) Shift(shift time.Duration) *ShiftNode

Create a new node that shifts the incoming points or batches in time.

func (*K8sAutoscaleNode) Spread added in v1.1.0

func (n *K8sAutoscaleNode) Spread(field string) *InfluxQLNode

Compute the difference between `min` and `max` points.

func (*K8sAutoscaleNode) StateCount added in v1.3.0

func (n *K8sAutoscaleNode) StateCount(expression *ast.LambdaNode) *StateCountNode

Create a node that tracks number of consecutive points in a given state.

func (*K8sAutoscaleNode) StateDuration added in v1.3.0

func (n *K8sAutoscaleNode) StateDuration(expression *ast.LambdaNode) *StateDurationNode

Create a node that tracks duration in a given state.

func (*K8sAutoscaleNode) Stddev added in v1.1.0

func (n *K8sAutoscaleNode) Stddev(field string) *InfluxQLNode

Compute the standard deviation.

func (*K8sAutoscaleNode) Sum added in v1.1.0

func (n *K8sAutoscaleNode) Sum(field string) *InfluxQLNode

Compute the sum of all values.

func (*K8sAutoscaleNode) Top added in v1.1.0

func (n *K8sAutoscaleNode) Top(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the top `num` points for `field` and sort by any extra tags or fields.

func (*K8sAutoscaleNode) Union added in v1.1.0

func (n *K8sAutoscaleNode) Union(node ...Node) *UnionNode

Perform the union of this node and all other given nodes.

func (*K8sAutoscaleNode) Where added in v1.1.0

func (n *K8sAutoscaleNode) Where(expression *ast.LambdaNode) *WhereNode

Create a new node that filters the data stream by a given expression.

func (*K8sAutoscaleNode) Window added in v1.1.0

func (n *K8sAutoscaleNode) Window() *WindowNode

Create a new node that windows the stream by time.

NOTE: Window can only be applied to stream edges.

type LogHandler added in v0.2.4

type LogHandler struct {
	*AlertNode

	// Absolute path the the log file.
	// It will be created if it does not exist.
	// tick:ignore
	FilePath string

	// File's mode and permissions, default is 0600
	// NOTE: The leading 0 is required to interpret the value as an octal integer.
	Mode int64
}

tick:embedded:AlertNode.Log

func (LogHandler) Alert added in v0.13.0

func (n LogHandler) Alert() *AlertNode

Create an alert node, which can trigger alerts.

func (LogHandler) Bottom added in v0.13.0

func (n LogHandler) Bottom(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the bottom `num` points for `field` and sort by any extra tags or fields.

func (LogHandler) Combine added in v1.0.0

func (n LogHandler) Combine(expressions ...*ast.LambdaNode) *CombineNode

Combine this node with itself. The data are combined on timestamp.

func (LogHandler) Count added in v0.13.0

func (n LogHandler) Count(field string) *InfluxQLNode

Count the number of points.

func (LogHandler) CumulativeSum added in v1.1.0

func (n LogHandler) CumulativeSum(field string) *InfluxQLNode

Compute a cumulative sum of each point that is received. A point is emitted for every point collected.

func (LogHandler) Default added in v0.13.0

func (n LogHandler) Default() *DefaultNode

Create a node that can set defaults for missing tags or fields.

func (LogHandler) Delete added in v1.0.0

func (n LogHandler) Delete() *DeleteNode

Create a node that can delete tags or fields.

func (LogHandler) Derivative added in v0.13.0

func (n LogHandler) Derivative(field string) *DerivativeNode

Create a new node that computes the derivative of adjacent points.

func (LogHandler) Difference added in v1.0.0

func (n LogHandler) Difference(field string) *InfluxQLNode

Compute the difference between points independent of elapsed time.

func (LogHandler) Distinct added in v0.13.0

func (n LogHandler) Distinct(field string) *InfluxQLNode

Produce batch of only the distinct points.

func (LogHandler) Elapsed added in v0.13.0

func (n LogHandler) Elapsed(field string, unit time.Duration) *InfluxQLNode

Compute the elapsed time between points

func (LogHandler) Eval added in v0.13.0

func (n LogHandler) Eval(expressions ...*ast.LambdaNode) *EvalNode

Create an eval node that will evaluate the given transformation function to each data point. A list of expressions may be provided and will be evaluated in the order they are given. The results are available to later expressions.

func (LogHandler) First added in v0.13.0

func (n LogHandler) First(field string) *InfluxQLNode

Select the first point.

func (LogHandler) Flatten added in v1.0.0

func (n LogHandler) Flatten() *FlattenNode

Flatten points with similar times into a single point.

func (LogHandler) GroupBy added in v0.13.0

func (n LogHandler) GroupBy(tag ...interface{}) *GroupByNode

Group the data by a set of tags.

Can pass literal * to group by all dimensions. Example:

|groupBy(*)

func (LogHandler) HoltWinters added in v1.0.0

func (n LogHandler) HoltWinters(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set.

func (LogHandler) HoltWintersWithFit added in v1.0.0

func (n LogHandler) HoltWintersWithFit(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set. This method also outputs all the points used to fit the data in addition to the forecasted data.

func (LogHandler) HttpOut added in v0.13.0

func (n LogHandler) HttpOut(endpoint string) *HTTPOutNode

Create an HTTP output node that caches the most recent data it has received. The cached data are available at the given endpoint. The endpoint is the relative path from the API endpoint of the running task. For example, if the task endpoint is at `/kapacitor/v1/tasks/<task_id>` and endpoint is `top10`, then the data can be requested from `/kapacitor/v1/tasks/<task_id>/top10`.

func (LogHandler) HttpPost added in v1.3.0

func (n LogHandler) HttpPost(url string) *HTTPPostNode

Creates an HTTP Post node that POSTS received data to the provided HTTP endpoint.

func (LogHandler) InfluxDBOut added in v0.13.0

func (n LogHandler) InfluxDBOut() *InfluxDBOutNode

Create an influxdb output node that will store the incoming data into InfluxDB.

func (LogHandler) Join added in v0.13.0

func (n LogHandler) Join(others ...Node) *JoinNode

Join this node with other nodes. The data are joined on timestamp.

func (LogHandler) K8sAutoscale added in v1.1.0

func (n LogHandler) K8sAutoscale() *K8sAutoscaleNode

Create a node that can trigger autoscale events for a kubernetes cluster.

func (LogHandler) Last added in v0.13.0

func (n LogHandler) Last(field string) *InfluxQLNode

Select the last point.

func (LogHandler) Max added in v0.13.0

func (n LogHandler) Max(field string) *InfluxQLNode

Select the maximum point.

func (LogHandler) Mean added in v0.13.0

func (n LogHandler) Mean(field string) *InfluxQLNode

Compute the mean of the data.

func (LogHandler) Median added in v0.13.0

func (n LogHandler) Median(field string) *InfluxQLNode

Compute the median of the data. Note, this method is not a selector, if you want the median point use `.percentile(field, 50.0)`.

func (LogHandler) Min added in v0.13.0

func (n LogHandler) Min(field string) *InfluxQLNode

Select the minimum point.

func (LogHandler) Mode added in v0.12.0

func (n LogHandler) Mode(field string) *InfluxQLNode

Compute the mode of the data.

func (LogHandler) MovingAverage added in v1.0.0

func (n LogHandler) MovingAverage(field string, window int64) *InfluxQLNode

Compute a moving average of the last window points. No points are emitted until the window is full.

func (LogHandler) Percentile added in v0.13.0

func (n LogHandler) Percentile(field string, percentile float64) *InfluxQLNode

Select a point at the given percentile. This is a selector function, no interpolation between points is performed.

func (LogHandler) Sample added in v0.13.0

func (n LogHandler) Sample(rate interface{}) *SampleNode

Create a new node that samples the incoming points or batches.

One point will be emitted every count or duration specified.

func (LogHandler) Shift added in v0.13.0

func (n LogHandler) Shift(shift time.Duration) *ShiftNode

Create a new node that shifts the incoming points or batches in time.

func (LogHandler) Spread added in v0.13.0

func (n LogHandler) Spread(field string) *InfluxQLNode

Compute the difference between `min` and `max` points.

func (LogHandler) StateCount added in v1.3.0

func (n LogHandler) StateCount(expression *ast.LambdaNode) *StateCountNode

Create a node that tracks number of consecutive points in a given state.

func (LogHandler) StateDuration added in v1.3.0

func (n LogHandler) StateDuration(expression *ast.LambdaNode) *StateDurationNode

Create a node that tracks duration in a given state.

func (LogHandler) Stddev added in v0.13.0

func (n LogHandler) Stddev(field string) *InfluxQLNode

Compute the standard deviation.

func (LogHandler) Sum added in v0.13.0

func (n LogHandler) Sum(field string) *InfluxQLNode

Compute the sum of all values.

func (LogHandler) Top added in v0.13.0

func (n LogHandler) Top(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the top `num` points for `field` and sort by any extra tags or fields.

func (LogHandler) Union added in v0.13.0

func (n LogHandler) Union(node ...Node) *UnionNode

Perform the union of this node and all other given nodes.

func (LogHandler) Where added in v0.13.0

func (n LogHandler) Where(expression *ast.LambdaNode) *WhereNode

Create a new node that filters the data stream by a given expression.

func (LogHandler) Window added in v0.13.0

func (n LogHandler) Window() *WindowNode

Create a new node that windows the stream by time.

NOTE: Window can only be applied to stream edges.

type LogNode added in v0.11.0

type LogNode struct {

	// The level at which to log the data.
	// One of: DEBUG, INFO, WARN, ERROR
	// Default: INFO
	Level string
	// Optional prefix to add to all log messages
	Prefix string
	// contains filtered or unexported fields
}

A node that logs all data that passes through the node.

Example:

stream.from()...
  |window()
      .period(10s)
      .every(10s)
  |log()
  |count('value')

func (*LogNode) Alert added in v0.11.0

func (n *LogNode) Alert() *AlertNode

Create an alert node, which can trigger alerts.

func (*LogNode) Bottom added in v0.11.0

func (n *LogNode) Bottom(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the bottom `num` points for `field` and sort by any extra tags or fields.

func (*LogNode) Combine added in v1.0.0

func (n *LogNode) Combine(expressions ...*ast.LambdaNode) *CombineNode

Combine this node with itself. The data are combined on timestamp.

func (*LogNode) Count added in v0.11.0

func (n *LogNode) Count(field string) *InfluxQLNode

Count the number of points.

func (*LogNode) CumulativeSum added in v1.1.0

func (n *LogNode) CumulativeSum(field string) *InfluxQLNode

Compute a cumulative sum of each point that is received. A point is emitted for every point collected.

func (*LogNode) Default added in v0.13.0

func (n *LogNode) Default() *DefaultNode

Create a node that can set defaults for missing tags or fields.

func (*LogNode) Delete added in v1.0.0

func (n *LogNode) Delete() *DeleteNode

Create a node that can delete tags or fields.

func (*LogNode) Derivative added in v0.11.0

func (n *LogNode) Derivative(field string) *DerivativeNode

Create a new node that computes the derivative of adjacent points.

func (*LogNode) Difference added in v1.0.0

func (n *LogNode) Difference(field string) *InfluxQLNode

Compute the difference between points independent of elapsed time.

func (*LogNode) Distinct added in v0.11.0

func (n *LogNode) Distinct(field string) *InfluxQLNode

Produce batch of only the distinct points.

func (*LogNode) Elapsed added in v0.13.0

func (n *LogNode) Elapsed(field string, unit time.Duration) *InfluxQLNode

Compute the elapsed time between points

func (*LogNode) Eval added in v0.11.0

func (n *LogNode) Eval(expressions ...*ast.LambdaNode) *EvalNode

Create an eval node that will evaluate the given transformation function to each data point. A list of expressions may be provided and will be evaluated in the order they are given. The results are available to later expressions.

func (*LogNode) First added in v0.11.0

func (n *LogNode) First(field string) *InfluxQLNode

Select the first point.

func (*LogNode) Flatten added in v1.0.0

func (n *LogNode) Flatten() *FlattenNode

Flatten points with similar times into a single point.

func (*LogNode) GroupBy added in v0.11.0

func (n *LogNode) GroupBy(tag ...interface{}) *GroupByNode

Group the data by a set of tags.

Can pass literal * to group by all dimensions. Example:

|groupBy(*)

func (*LogNode) HoltWinters added in v1.0.0

func (n *LogNode) HoltWinters(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set.

func (*LogNode) HoltWintersWithFit added in v1.0.0

func (n *LogNode) HoltWintersWithFit(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set. This method also outputs all the points used to fit the data in addition to the forecasted data.

func (*LogNode) HttpOut added in v0.11.0

func (n *LogNode) HttpOut(endpoint string) *HTTPOutNode

Create an HTTP output node that caches the most recent data it has received. The cached data are available at the given endpoint. The endpoint is the relative path from the API endpoint of the running task. For example, if the task endpoint is at `/kapacitor/v1/tasks/<task_id>` and endpoint is `top10`, then the data can be requested from `/kapacitor/v1/tasks/<task_id>/top10`.

func (*LogNode) HttpPost added in v1.3.0

func (n *LogNode) HttpPost(url string) *HTTPPostNode

Creates an HTTP Post node that POSTS received data to the provided HTTP endpoint.

func (*LogNode) InfluxDBOut added in v0.11.0

func (n *LogNode) InfluxDBOut() *InfluxDBOutNode

Create an influxdb output node that will store the incoming data into InfluxDB.

func (*LogNode) Join added in v0.11.0

func (n *LogNode) Join(others ...Node) *JoinNode

Join this node with other nodes. The data are joined on timestamp.

func (*LogNode) K8sAutoscale added in v1.1.0

func (n *LogNode) K8sAutoscale() *K8sAutoscaleNode

Create a node that can trigger autoscale events for a kubernetes cluster.

func (*LogNode) Last added in v0.11.0

func (n *LogNode) Last(field string) *InfluxQLNode

Select the last point.

func (*LogNode) Log added in v0.11.0

func (n *LogNode) Log() *LogNode

Create a node that logs all data it receives.

func (*LogNode) Max added in v0.11.0

func (n *LogNode) Max(field string) *InfluxQLNode

Select the maximum point.

func (*LogNode) Mean added in v0.11.0

func (n *LogNode) Mean(field string) *InfluxQLNode

Compute the mean of the data.

func (*LogNode) Median added in v0.11.0

func (n *LogNode) Median(field string) *InfluxQLNode

Compute the median of the data. Note, this method is not a selector, if you want the median point use `.percentile(field, 50.0)`.

func (*LogNode) Min added in v0.11.0

func (n *LogNode) Min(field string) *InfluxQLNode

Select the minimum point.

func (*LogNode) Mode added in v1.0.0

func (n *LogNode) Mode(field string) *InfluxQLNode

Compute the mode of the data.

func (*LogNode) MovingAverage added in v1.0.0

func (n *LogNode) MovingAverage(field string, window int64) *InfluxQLNode

Compute a moving average of the last window points. No points are emitted until the window is full.

func (*LogNode) Percentile added in v0.11.0

func (n *LogNode) Percentile(field string, percentile float64) *InfluxQLNode

Select a point at the given percentile. This is a selector function, no interpolation between points is performed.

func (*LogNode) Sample added in v0.11.0

func (n *LogNode) Sample(rate interface{}) *SampleNode

Create a new node that samples the incoming points or batches.

One point will be emitted every count or duration specified.

func (*LogNode) Shift added in v0.11.0

func (n *LogNode) Shift(shift time.Duration) *ShiftNode

Create a new node that shifts the incoming points or batches in time.

func (*LogNode) Spread added in v0.11.0

func (n *LogNode) Spread(field string) *InfluxQLNode

Compute the difference between `min` and `max` points.

func (*LogNode) StateCount added in v1.3.0

func (n *LogNode) StateCount(expression *ast.LambdaNode) *StateCountNode

Create a node that tracks number of consecutive points in a given state.

func (*LogNode) StateDuration added in v1.3.0

func (n *LogNode) StateDuration(expression *ast.LambdaNode) *StateDurationNode

Create a node that tracks duration in a given state.

func (*LogNode) Stddev added in v0.11.0

func (n *LogNode) Stddev(field string) *InfluxQLNode

Compute the standard deviation.

func (*LogNode) Sum added in v0.11.0

func (n *LogNode) Sum(field string) *InfluxQLNode

Compute the sum of all values.

func (*LogNode) Top added in v0.11.0

func (n *LogNode) Top(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the top `num` points for `field` and sort by any extra tags or fields.

func (*LogNode) Union added in v0.11.0

func (n *LogNode) Union(node ...Node) *UnionNode

Perform the union of this node and all other given nodes.

func (*LogNode) Where added in v0.11.0

func (n *LogNode) Where(expression *ast.LambdaNode) *WhereNode

Create a new node that filters the data stream by a given expression.

func (*LogNode) Window added in v0.11.0

func (n *LogNode) Window() *WindowNode

Create a new node that windows the stream by time.

NOTE: Window can only be applied to stream edges.

type NoOpNode added in v0.11.0

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

A node that does not perform any operation.

*Do not use this node in a TICKscript there should be no need for it.*

If a node does not have any children, then its emitted count remains zero. Using a NoOpNode is a work around so that statistics are accurately reported for nodes with no real children. A NoOpNode is automatically appended to any node that is a source for a StatsNode and does not have any children.

func (*NoOpNode) Alert added in v0.11.0

func (n *NoOpNode) Alert() *AlertNode

Create an alert node, which can trigger alerts.

func (*NoOpNode) Bottom added in v0.11.0

func (n *NoOpNode) Bottom(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the bottom `num` points for `field` and sort by any extra tags or fields.

func (*NoOpNode) Combine added in v1.0.0

func (n *NoOpNode) Combine(expressions ...*ast.LambdaNode) *CombineNode

Combine this node with itself. The data are combined on timestamp.

func (*NoOpNode) Count added in v0.11.0

func (n *NoOpNode) Count(field string) *InfluxQLNode

Count the number of points.

func (*NoOpNode) CumulativeSum added in v1.1.0

func (n *NoOpNode) CumulativeSum(field string) *InfluxQLNode

Compute a cumulative sum of each point that is received. A point is emitted for every point collected.

func (*NoOpNode) Default added in v0.13.0

func (n *NoOpNode) Default() *DefaultNode

Create a node that can set defaults for missing tags or fields.

func (*NoOpNode) Delete added in v1.0.0

func (n *NoOpNode) Delete() *DeleteNode

Create a node that can delete tags or fields.

func (*NoOpNode) Derivative added in v0.11.0

func (n *NoOpNode) Derivative(field string) *DerivativeNode

Create a new node that computes the derivative of adjacent points.

func (*NoOpNode) Difference added in v1.0.0

func (n *NoOpNode) Difference(field string) *InfluxQLNode

Compute the difference between points independent of elapsed time.

func (*NoOpNode) Distinct added in v0.11.0

func (n *NoOpNode) Distinct(field string) *InfluxQLNode

Produce batch of only the distinct points.

func (*NoOpNode) Elapsed added in v0.13.0

func (n *NoOpNode) Elapsed(field string, unit time.Duration) *InfluxQLNode

Compute the elapsed time between points

func (*NoOpNode) Eval added in v0.11.0

func (n *NoOpNode) Eval(expressions ...*ast.LambdaNode) *EvalNode

Create an eval node that will evaluate the given transformation function to each data point. A list of expressions may be provided and will be evaluated in the order they are given. The results are available to later expressions.

func (*NoOpNode) First added in v0.11.0

func (n *NoOpNode) First(field string) *InfluxQLNode

Select the first point.

func (*NoOpNode) Flatten added in v1.0.0

func (n *NoOpNode) Flatten() *FlattenNode

Flatten points with similar times into a single point.

func (*NoOpNode) GroupBy added in v0.11.0

func (n *NoOpNode) GroupBy(tag ...interface{}) *GroupByNode

Group the data by a set of tags.

Can pass literal * to group by all dimensions. Example:

|groupBy(*)

func (*NoOpNode) HoltWinters added in v1.0.0

func (n *NoOpNode) HoltWinters(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set.

func (*NoOpNode) HoltWintersWithFit added in v1.0.0

func (n *NoOpNode) HoltWintersWithFit(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set. This method also outputs all the points used to fit the data in addition to the forecasted data.

func (*NoOpNode) HttpOut added in v0.11.0

func (n *NoOpNode) HttpOut(endpoint string) *HTTPOutNode

Create an HTTP output node that caches the most recent data it has received. The cached data are available at the given endpoint. The endpoint is the relative path from the API endpoint of the running task. For example, if the task endpoint is at `/kapacitor/v1/tasks/<task_id>` and endpoint is `top10`, then the data can be requested from `/kapacitor/v1/tasks/<task_id>/top10`.

func (*NoOpNode) HttpPost added in v1.3.0

func (n *NoOpNode) HttpPost(url string) *HTTPPostNode

Creates an HTTP Post node that POSTS received data to the provided HTTP endpoint.

func (*NoOpNode) InfluxDBOut added in v0.11.0

func (n *NoOpNode) InfluxDBOut() *InfluxDBOutNode

Create an influxdb output node that will store the incoming data into InfluxDB.

func (*NoOpNode) Join added in v0.11.0

func (n *NoOpNode) Join(others ...Node) *JoinNode

Join this node with other nodes. The data are joined on timestamp.

func (*NoOpNode) K8sAutoscale added in v1.1.0

func (n *NoOpNode) K8sAutoscale() *K8sAutoscaleNode

Create a node that can trigger autoscale events for a kubernetes cluster.

func (*NoOpNode) Last added in v0.11.0

func (n *NoOpNode) Last(field string) *InfluxQLNode

Select the last point.

func (*NoOpNode) Log added in v0.11.0

func (n *NoOpNode) Log() *LogNode

Create a node that logs all data it receives.

func (*NoOpNode) Max added in v0.11.0

func (n *NoOpNode) Max(field string) *InfluxQLNode

Select the maximum point.

func (*NoOpNode) Mean added in v0.11.0

func (n *NoOpNode) Mean(field string) *InfluxQLNode

Compute the mean of the data.

func (*NoOpNode) Median added in v0.11.0

func (n *NoOpNode) Median(field string) *InfluxQLNode

Compute the median of the data. Note, this method is not a selector, if you want the median point use `.percentile(field, 50.0)`.

func (*NoOpNode) Min added in v0.11.0

func (n *NoOpNode) Min(field string) *InfluxQLNode

Select the minimum point.

func (*NoOpNode) Mode added in v1.0.0

func (n *NoOpNode) Mode(field string) *InfluxQLNode

Compute the mode of the data.

func (*NoOpNode) MovingAverage added in v1.0.0

func (n *NoOpNode) MovingAverage(field string, window int64) *InfluxQLNode

Compute a moving average of the last window points. No points are emitted until the window is full.

func (*NoOpNode) Percentile added in v0.11.0

func (n *NoOpNode) Percentile(field string, percentile float64) *InfluxQLNode

Select a point at the given percentile. This is a selector function, no interpolation between points is performed.

func (*NoOpNode) Sample added in v0.11.0

func (n *NoOpNode) Sample(rate interface{}) *SampleNode

Create a new node that samples the incoming points or batches.

One point will be emitted every count or duration specified.

func (*NoOpNode) Shift added in v0.11.0

func (n *NoOpNode) Shift(shift time.Duration) *ShiftNode

Create a new node that shifts the incoming points or batches in time.

func (*NoOpNode) Spread added in v0.11.0

func (n *NoOpNode) Spread(field string) *InfluxQLNode

Compute the difference between `min` and `max` points.

func (*NoOpNode) StateCount added in v1.3.0

func (n *NoOpNode) StateCount(expression *ast.LambdaNode) *StateCountNode

Create a node that tracks number of consecutive points in a given state.

func (*NoOpNode) StateDuration added in v1.3.0

func (n *NoOpNode) StateDuration(expression *ast.LambdaNode) *StateDurationNode

Create a node that tracks duration in a given state.

func (*NoOpNode) Stddev added in v0.11.0

func (n *NoOpNode) Stddev(field string) *InfluxQLNode

Compute the standard deviation.

func (*NoOpNode) Sum added in v0.11.0

func (n *NoOpNode) Sum(field string) *InfluxQLNode

Compute the sum of all values.

func (*NoOpNode) Top added in v0.11.0

func (n *NoOpNode) Top(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the top `num` points for `field` and sort by any extra tags or fields.

func (*NoOpNode) Union added in v0.11.0

func (n *NoOpNode) Union(node ...Node) *UnionNode

Perform the union of this node and all other given nodes.

func (*NoOpNode) Where added in v0.11.0

func (n *NoOpNode) Where(expression *ast.LambdaNode) *WhereNode

Create a new node that filters the data stream by a given expression.

func (*NoOpNode) Window added in v0.11.0

func (n *NoOpNode) Window() *WindowNode

Create a new node that windows the stream by time.

NOTE: Window can only be applied to stream edges.

type Node

type Node interface {
	// List of parents of this node.
	Parents() []Node
	// List of children of this node.
	Children() []Node

	// Short description of the node does not need to be unique
	Desc() string

	// Friendly readable unique name of the node
	Name() string
	SetName(string)

	// Unique id for the node
	ID() ID

	// The type of input the node wants.
	Wants() EdgeType
	// The type of output the node provides.
	Provides() EdgeType
	// contains filtered or unexported methods
}

Generic node in a pipeline

type OpsGenieHandler added in v0.2.4

type OpsGenieHandler struct {
	*AlertNode

	// OpsGenie Teams.
	// tick:ignore
	TeamsList []string `tick:"Teams"`

	// OpsGenie Recipients.
	// tick:ignore
	RecipientsList []string `tick:"Recipients"`
}

tick:embedded:AlertNode.OpsGenie

func (OpsGenieHandler) Alert added in v0.13.0

func (n OpsGenieHandler) Alert() *AlertNode

Create an alert node, which can trigger alerts.

func (OpsGenieHandler) Bottom added in v0.13.0

func (n OpsGenieHandler) Bottom(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the bottom `num` points for `field` and sort by any extra tags or fields.

func (OpsGenieHandler) Combine added in v1.0.0

func (n OpsGenieHandler) Combine(expressions ...*ast.LambdaNode) *CombineNode

Combine this node with itself. The data are combined on timestamp.

func (OpsGenieHandler) Count added in v0.13.0

func (n OpsGenieHandler) Count(field string) *InfluxQLNode

Count the number of points.

func (OpsGenieHandler) CumulativeSum added in v1.1.0

func (n OpsGenieHandler) CumulativeSum(field string) *InfluxQLNode

Compute a cumulative sum of each point that is received. A point is emitted for every point collected.

func (OpsGenieHandler) Default added in v0.13.0

func (n OpsGenieHandler) Default() *DefaultNode

Create a node that can set defaults for missing tags or fields.

func (OpsGenieHandler) Delete added in v1.0.0

func (n OpsGenieHandler) Delete() *DeleteNode

Create a node that can delete tags or fields.

func (OpsGenieHandler) Derivative added in v0.13.0

func (n OpsGenieHandler) Derivative(field string) *DerivativeNode

Create a new node that computes the derivative of adjacent points.

func (OpsGenieHandler) Difference added in v1.0.0

func (n OpsGenieHandler) Difference(field string) *InfluxQLNode

Compute the difference between points independent of elapsed time.

func (OpsGenieHandler) Distinct added in v0.13.0

func (n OpsGenieHandler) Distinct(field string) *InfluxQLNode

Produce batch of only the distinct points.

func (OpsGenieHandler) Elapsed added in v0.13.0

func (n OpsGenieHandler) Elapsed(field string, unit time.Duration) *InfluxQLNode

Compute the elapsed time between points

func (OpsGenieHandler) Eval added in v0.13.0

func (n OpsGenieHandler) Eval(expressions ...*ast.LambdaNode) *EvalNode

Create an eval node that will evaluate the given transformation function to each data point. A list of expressions may be provided and will be evaluated in the order they are given. The results are available to later expressions.

func (OpsGenieHandler) First added in v0.13.0

func (n OpsGenieHandler) First(field string) *InfluxQLNode

Select the first point.

func (OpsGenieHandler) Flatten added in v1.0.0

func (n OpsGenieHandler) Flatten() *FlattenNode

Flatten points with similar times into a single point.

func (OpsGenieHandler) GroupBy added in v0.13.0

func (n OpsGenieHandler) GroupBy(tag ...interface{}) *GroupByNode

Group the data by a set of tags.

Can pass literal * to group by all dimensions. Example:

|groupBy(*)

func (OpsGenieHandler) HoltWinters added in v1.0.0

func (n OpsGenieHandler) HoltWinters(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set.

func (OpsGenieHandler) HoltWintersWithFit added in v1.0.0

func (n OpsGenieHandler) HoltWintersWithFit(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set. This method also outputs all the points used to fit the data in addition to the forecasted data.

func (OpsGenieHandler) HttpOut added in v0.13.0

func (n OpsGenieHandler) HttpOut(endpoint string) *HTTPOutNode

Create an HTTP output node that caches the most recent data it has received. The cached data are available at the given endpoint. The endpoint is the relative path from the API endpoint of the running task. For example, if the task endpoint is at `/kapacitor/v1/tasks/<task_id>` and endpoint is `top10`, then the data can be requested from `/kapacitor/v1/tasks/<task_id>/top10`.

func (OpsGenieHandler) HttpPost added in v1.3.0

func (n OpsGenieHandler) HttpPost(url string) *HTTPPostNode

Creates an HTTP Post node that POSTS received data to the provided HTTP endpoint.

func (OpsGenieHandler) InfluxDBOut added in v0.13.0

func (n OpsGenieHandler) InfluxDBOut() *InfluxDBOutNode

Create an influxdb output node that will store the incoming data into InfluxDB.

func (OpsGenieHandler) Join added in v0.13.0

func (n OpsGenieHandler) Join(others ...Node) *JoinNode

Join this node with other nodes. The data are joined on timestamp.

func (OpsGenieHandler) K8sAutoscale added in v1.1.0

func (n OpsGenieHandler) K8sAutoscale() *K8sAutoscaleNode

Create a node that can trigger autoscale events for a kubernetes cluster.

func (OpsGenieHandler) Last added in v0.13.0

func (n OpsGenieHandler) Last(field string) *InfluxQLNode

Select the last point.

func (OpsGenieHandler) Max added in v0.13.0

func (n OpsGenieHandler) Max(field string) *InfluxQLNode

Select the maximum point.

func (OpsGenieHandler) Mean added in v0.13.0

func (n OpsGenieHandler) Mean(field string) *InfluxQLNode

Compute the mean of the data.

func (OpsGenieHandler) Median added in v0.13.0

func (n OpsGenieHandler) Median(field string) *InfluxQLNode

Compute the median of the data. Note, this method is not a selector, if you want the median point use `.percentile(field, 50.0)`.

func (OpsGenieHandler) Min added in v0.13.0

func (n OpsGenieHandler) Min(field string) *InfluxQLNode

Select the minimum point.

func (OpsGenieHandler) Mode added in v1.0.0

func (n OpsGenieHandler) Mode(field string) *InfluxQLNode

Compute the mode of the data.

func (OpsGenieHandler) MovingAverage added in v1.0.0

func (n OpsGenieHandler) MovingAverage(field string, window int64) *InfluxQLNode

Compute a moving average of the last window points. No points are emitted until the window is full.

func (OpsGenieHandler) Percentile added in v0.13.0

func (n OpsGenieHandler) Percentile(field string, percentile float64) *InfluxQLNode

Select a point at the given percentile. This is a selector function, no interpolation between points is performed.

func (*OpsGenieHandler) Recipients added in v0.2.4

func (og *OpsGenieHandler) Recipients(recipients ...string) *OpsGenieHandler

The list of recipients to be alerted. If empty defaults to the recipients from the configuration. tick:property

func (OpsGenieHandler) Sample added in v0.13.0

func (n OpsGenieHandler) Sample(rate interface{}) *SampleNode

Create a new node that samples the incoming points or batches.

One point will be emitted every count or duration specified.

func (OpsGenieHandler) Shift added in v0.13.0

func (n OpsGenieHandler) Shift(shift time.Duration) *ShiftNode

Create a new node that shifts the incoming points or batches in time.

func (OpsGenieHandler) Spread added in v0.13.0

func (n OpsGenieHandler) Spread(field string) *InfluxQLNode

Compute the difference between `min` and `max` points.

func (OpsGenieHandler) StateCount added in v1.3.0

func (n OpsGenieHandler) StateCount(expression *ast.LambdaNode) *StateCountNode

Create a node that tracks number of consecutive points in a given state.

func (OpsGenieHandler) StateDuration added in v1.3.0

func (n OpsGenieHandler) StateDuration(expression *ast.LambdaNode) *StateDurationNode

Create a node that tracks duration in a given state.

func (OpsGenieHandler) Stddev added in v0.13.0

func (n OpsGenieHandler) Stddev(field string) *InfluxQLNode

Compute the standard deviation.

func (OpsGenieHandler) Sum added in v0.13.0

func (n OpsGenieHandler) Sum(field string) *InfluxQLNode

Compute the sum of all values.

func (*OpsGenieHandler) Teams added in v0.2.4

func (og *OpsGenieHandler) Teams(teams ...string) *OpsGenieHandler

The list of teams to be alerted. If empty defaults to the teams from the configuration. tick:property

func (OpsGenieHandler) Top added in v0.13.0

func (n OpsGenieHandler) Top(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the top `num` points for `field` and sort by any extra tags or fields.

func (OpsGenieHandler) Union added in v0.13.0

func (n OpsGenieHandler) Union(node ...Node) *UnionNode

Perform the union of this node and all other given nodes.

func (OpsGenieHandler) Where added in v0.13.0

func (n OpsGenieHandler) Where(expression *ast.LambdaNode) *WhereNode

Create a new node that filters the data stream by a given expression.

func (OpsGenieHandler) Window added in v0.13.0

func (n OpsGenieHandler) Window() *WindowNode

Create a new node that windows the stream by time.

NOTE: Window can only be applied to stream edges.

type PagerDutyHandler added in v0.2.4

type PagerDutyHandler struct {
	*AlertNode

	// The service key to use for the alert.
	// Defaults to the value in the configuration if empty.
	ServiceKey string
}

tick:embedded:AlertNode.PagerDuty

func (PagerDutyHandler) Alert added in v0.13.0

func (n PagerDutyHandler) Alert() *AlertNode

Create an alert node, which can trigger alerts.

func (PagerDutyHandler) Bottom added in v0.13.0

func (n PagerDutyHandler) Bottom(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the bottom `num` points for `field` and sort by any extra tags or fields.

func (PagerDutyHandler) Combine added in v1.0.0

func (n PagerDutyHandler) Combine(expressions ...*ast.LambdaNode) *CombineNode

Combine this node with itself. The data are combined on timestamp.

func (PagerDutyHandler) Count added in v0.13.0

func (n PagerDutyHandler) Count(field string) *InfluxQLNode

Count the number of points.

func (PagerDutyHandler) CumulativeSum added in v1.1.0

func (n PagerDutyHandler) CumulativeSum(field string) *InfluxQLNode

Compute a cumulative sum of each point that is received. A point is emitted for every point collected.

func (PagerDutyHandler) Default added in v0.13.0

func (n PagerDutyHandler) Default() *DefaultNode

Create a node that can set defaults for missing tags or fields.

func (PagerDutyHandler) Delete added in v1.0.0

func (n PagerDutyHandler) Delete() *DeleteNode

Create a node that can delete tags or fields.

func (PagerDutyHandler) Derivative added in v0.13.0

func (n PagerDutyHandler) Derivative(field string) *DerivativeNode

Create a new node that computes the derivative of adjacent points.

func (PagerDutyHandler) Difference added in v1.0.0

func (n PagerDutyHandler) Difference(field string) *InfluxQLNode

Compute the difference between points independent of elapsed time.

func (PagerDutyHandler) Distinct added in v0.13.0

func (n PagerDutyHandler) Distinct(field string) *InfluxQLNode

Produce batch of only the distinct points.

func (PagerDutyHandler) Elapsed added in v0.13.0

func (n PagerDutyHandler) Elapsed(field string, unit time.Duration) *InfluxQLNode

Compute the elapsed time between points

func (PagerDutyHandler) Eval added in v0.13.0

func (n PagerDutyHandler) Eval(expressions ...*ast.LambdaNode) *EvalNode

Create an eval node that will evaluate the given transformation function to each data point. A list of expressions may be provided and will be evaluated in the order they are given. The results are available to later expressions.

func (PagerDutyHandler) First added in v0.13.0

func (n PagerDutyHandler) First(field string) *InfluxQLNode

Select the first point.

func (PagerDutyHandler) Flatten added in v1.0.0

func (n PagerDutyHandler) Flatten() *FlattenNode

Flatten points with similar times into a single point.

func (PagerDutyHandler) GroupBy added in v0.13.0

func (n PagerDutyHandler) GroupBy(tag ...interface{}) *GroupByNode

Group the data by a set of tags.

Can pass literal * to group by all dimensions. Example:

|groupBy(*)

func (PagerDutyHandler) HoltWinters added in v1.0.0

func (n PagerDutyHandler) HoltWinters(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set.

func (PagerDutyHandler) HoltWintersWithFit added in v1.0.0

func (n PagerDutyHandler) HoltWintersWithFit(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set. This method also outputs all the points used to fit the data in addition to the forecasted data.

func (PagerDutyHandler) HttpOut added in v0.13.0

func (n PagerDutyHandler) HttpOut(endpoint string) *HTTPOutNode

Create an HTTP output node that caches the most recent data it has received. The cached data are available at the given endpoint. The endpoint is the relative path from the API endpoint of the running task. For example, if the task endpoint is at `/kapacitor/v1/tasks/<task_id>` and endpoint is `top10`, then the data can be requested from `/kapacitor/v1/tasks/<task_id>/top10`.

func (PagerDutyHandler) HttpPost added in v1.3.0

func (n PagerDutyHandler) HttpPost(url string) *HTTPPostNode

Creates an HTTP Post node that POSTS received data to the provided HTTP endpoint.

func (PagerDutyHandler) InfluxDBOut added in v0.13.0

func (n PagerDutyHandler) InfluxDBOut() *InfluxDBOutNode

Create an influxdb output node that will store the incoming data into InfluxDB.

func (PagerDutyHandler) Join added in v0.13.0

func (n PagerDutyHandler) Join(others ...Node) *JoinNode

Join this node with other nodes. The data are joined on timestamp.

func (PagerDutyHandler) K8sAutoscale added in v1.1.0

func (n PagerDutyHandler) K8sAutoscale() *K8sAutoscaleNode

Create a node that can trigger autoscale events for a kubernetes cluster.

func (PagerDutyHandler) Last added in v0.13.0

func (n PagerDutyHandler) Last(field string) *InfluxQLNode

Select the last point.

func (PagerDutyHandler) Max added in v0.13.0

func (n PagerDutyHandler) Max(field string) *InfluxQLNode

Select the maximum point.

func (PagerDutyHandler) Mean added in v0.13.0

func (n PagerDutyHandler) Mean(field string) *InfluxQLNode

Compute the mean of the data.

func (PagerDutyHandler) Median added in v0.13.0

func (n PagerDutyHandler) Median(field string) *InfluxQLNode

Compute the median of the data. Note, this method is not a selector, if you want the median point use `.percentile(field, 50.0)`.

func (PagerDutyHandler) Min added in v0.13.0

func (n PagerDutyHandler) Min(field string) *InfluxQLNode

Select the minimum point.

func (PagerDutyHandler) Mode added in v1.0.0

func (n PagerDutyHandler) Mode(field string) *InfluxQLNode

Compute the mode of the data.

func (PagerDutyHandler) MovingAverage added in v1.0.0

func (n PagerDutyHandler) MovingAverage(field string, window int64) *InfluxQLNode

Compute a moving average of the last window points. No points are emitted until the window is full.

func (PagerDutyHandler) Percentile added in v0.13.0

func (n PagerDutyHandler) Percentile(field string, percentile float64) *InfluxQLNode

Select a point at the given percentile. This is a selector function, no interpolation between points is performed.

func (PagerDutyHandler) Sample added in v0.13.0

func (n PagerDutyHandler) Sample(rate interface{}) *SampleNode

Create a new node that samples the incoming points or batches.

One point will be emitted every count or duration specified.

func (PagerDutyHandler) Shift added in v0.13.0

func (n PagerDutyHandler) Shift(shift time.Duration) *ShiftNode

Create a new node that shifts the incoming points or batches in time.

func (PagerDutyHandler) Spread added in v0.13.0

func (n PagerDutyHandler) Spread(field string) *InfluxQLNode

Compute the difference between `min` and `max` points.

func (PagerDutyHandler) StateCount added in v1.3.0

func (n PagerDutyHandler) StateCount(expression *ast.LambdaNode) *StateCountNode

Create a node that tracks number of consecutive points in a given state.

func (PagerDutyHandler) StateDuration added in v1.3.0

func (n PagerDutyHandler) StateDuration(expression *ast.LambdaNode) *StateDurationNode

Create a node that tracks duration in a given state.

func (PagerDutyHandler) Stddev added in v0.13.0

func (n PagerDutyHandler) Stddev(field string) *InfluxQLNode

Compute the standard deviation.

func (PagerDutyHandler) Sum added in v0.13.0

func (n PagerDutyHandler) Sum(field string) *InfluxQLNode

Compute the sum of all values.

func (PagerDutyHandler) Top added in v0.13.0

func (n PagerDutyHandler) Top(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the top `num` points for `field` and sort by any extra tags or fields.

func (PagerDutyHandler) Union added in v0.13.0

func (n PagerDutyHandler) Union(node ...Node) *UnionNode

Perform the union of this node and all other given nodes.

func (PagerDutyHandler) Where added in v0.13.0

func (n PagerDutyHandler) Where(expression *ast.LambdaNode) *WhereNode

Create a new node that filters the data stream by a given expression.

func (PagerDutyHandler) Window added in v0.13.0

func (n PagerDutyHandler) Window() *WindowNode

Create a new node that windows the stream by time.

NOTE: Window can only be applied to stream edges.

type Pipeline

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

A complete data processing pipeline. Starts with a single source. tick:ignore

func CreatePipeline

func CreatePipeline(
	script string,
	sourceEdge EdgeType,
	scope *stateful.Scope,
	deadman DeadmanService,
	predefinedVars map[string]tick.Var,
) (*Pipeline, error)

Create a pipeline from a given script. tick:ignore

func (*Pipeline) Dot

func (p *Pipeline) Dot(name string) []byte

Return a graphviz .dot formatted byte array. tick:ignore

func (*Pipeline) Len added in v1.0.0

func (p *Pipeline) Len() int

The number of nodes in the pipeline. tick:ignore

func (*Pipeline) Walk

func (p *Pipeline) Walk(f func(n Node) error) error

Walks the entire pipeline and calls func f on each node exactly once. f will be called on a node n only after all of its parents have already had f called. tick:ignore

type PostHandler added in v0.2.4

type PostHandler struct {
	*AlertNode

	// The POST URL.
	// tick:ignore
	URL string
}

tick:embedded:AlertNode.Post

func (PostHandler) Alert added in v0.13.0

func (n PostHandler) Alert() *AlertNode

Create an alert node, which can trigger alerts.

func (PostHandler) Bottom added in v0.13.0

func (n PostHandler) Bottom(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the bottom `num` points for `field` and sort by any extra tags or fields.

func (PostHandler) Combine added in v1.0.0

func (n PostHandler) Combine(expressions ...*ast.LambdaNode) *CombineNode

Combine this node with itself. The data are combined on timestamp.

func (PostHandler) Count added in v0.13.0

func (n PostHandler) Count(field string) *InfluxQLNode

Count the number of points.

func (PostHandler) CumulativeSum added in v1.1.0

func (n PostHandler) CumulativeSum(field string) *InfluxQLNode

Compute a cumulative sum of each point that is received. A point is emitted for every point collected.

func (PostHandler) Default added in v0.13.0

func (n PostHandler) Default() *DefaultNode

Create a node that can set defaults for missing tags or fields.

func (PostHandler) Delete added in v1.0.0

func (n PostHandler) Delete() *DeleteNode

Create a node that can delete tags or fields.

func (PostHandler) Derivative added in v0.13.0

func (n PostHandler) Derivative(field string) *DerivativeNode

Create a new node that computes the derivative of adjacent points.

func (PostHandler) Difference added in v1.0.0

func (n PostHandler) Difference(field string) *InfluxQLNode

Compute the difference between points independent of elapsed time.

func (PostHandler) Distinct added in v0.13.0

func (n PostHandler) Distinct(field string) *InfluxQLNode

Produce batch of only the distinct points.

func (PostHandler) Elapsed added in v0.13.0

func (n PostHandler) Elapsed(field string, unit time.Duration) *InfluxQLNode

Compute the elapsed time between points

func (PostHandler) Eval added in v0.13.0

func (n PostHandler) Eval(expressions ...*ast.LambdaNode) *EvalNode

Create an eval node that will evaluate the given transformation function to each data point. A list of expressions may be provided and will be evaluated in the order they are given. The results are available to later expressions.

func (PostHandler) First added in v0.13.0

func (n PostHandler) First(field string) *InfluxQLNode

Select the first point.

func (PostHandler) Flatten added in v1.0.0

func (n PostHandler) Flatten() *FlattenNode

Flatten points with similar times into a single point.

func (PostHandler) GroupBy added in v0.13.0

func (n PostHandler) GroupBy(tag ...interface{}) *GroupByNode

Group the data by a set of tags.

Can pass literal * to group by all dimensions. Example:

|groupBy(*)

func (PostHandler) HoltWinters added in v1.0.0

func (n PostHandler) HoltWinters(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set.

func (PostHandler) HoltWintersWithFit added in v1.0.0

func (n PostHandler) HoltWintersWithFit(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set. This method also outputs all the points used to fit the data in addition to the forecasted data.

func (PostHandler) HttpOut added in v0.13.0

func (n PostHandler) HttpOut(endpoint string) *HTTPOutNode

Create an HTTP output node that caches the most recent data it has received. The cached data are available at the given endpoint. The endpoint is the relative path from the API endpoint of the running task. For example, if the task endpoint is at `/kapacitor/v1/tasks/<task_id>` and endpoint is `top10`, then the data can be requested from `/kapacitor/v1/tasks/<task_id>/top10`.

func (PostHandler) HttpPost

func (n PostHandler) HttpPost(url string) *HTTPPostNode

Creates an HTTP Post node that POSTS received data to the provided HTTP endpoint.

func (PostHandler) InfluxDBOut added in v0.13.0

func (n PostHandler) InfluxDBOut() *InfluxDBOutNode

Create an influxdb output node that will store the incoming data into InfluxDB.

func (PostHandler) Join added in v0.13.0

func (n PostHandler) Join(others ...Node) *JoinNode

Join this node with other nodes. The data are joined on timestamp.

func (PostHandler) K8sAutoscale added in v1.1.0

func (n PostHandler) K8sAutoscale() *K8sAutoscaleNode

Create a node that can trigger autoscale events for a kubernetes cluster.

func (PostHandler) Last added in v0.13.0

func (n PostHandler) Last(field string) *InfluxQLNode

Select the last point.

func (PostHandler) Max added in v0.13.0

func (n PostHandler) Max(field string) *InfluxQLNode

Select the maximum point.

func (PostHandler) Mean added in v0.13.0

func (n PostHandler) Mean(field string) *InfluxQLNode

Compute the mean of the data.

func (PostHandler) Median added in v0.13.0

func (n PostHandler) Median(field string) *InfluxQLNode

Compute the median of the data. Note, this method is not a selector, if you want the median point use `.percentile(field, 50.0)`.

func (PostHandler) Min added in v0.13.0

func (n PostHandler) Min(field string) *InfluxQLNode

Select the minimum point.

func (PostHandler) Mode added in v1.0.0

func (n PostHandler) Mode(field string) *InfluxQLNode

Compute the mode of the data.

func (PostHandler) MovingAverage added in v1.0.0

func (n PostHandler) MovingAverage(field string, window int64) *InfluxQLNode

Compute a moving average of the last window points. No points are emitted until the window is full.

func (PostHandler) Percentile added in v0.13.0

func (n PostHandler) Percentile(field string, percentile float64) *InfluxQLNode

Select a point at the given percentile. This is a selector function, no interpolation between points is performed.

func (PostHandler) Sample added in v0.13.0

func (n PostHandler) Sample(rate interface{}) *SampleNode

Create a new node that samples the incoming points or batches.

One point will be emitted every count or duration specified.

func (PostHandler) Shift added in v0.13.0

func (n PostHandler) Shift(shift time.Duration) *ShiftNode

Create a new node that shifts the incoming points or batches in time.

func (PostHandler) Spread added in v0.13.0

func (n PostHandler) Spread(field string) *InfluxQLNode

Compute the difference between `min` and `max` points.

func (PostHandler) StateCount

func (n PostHandler) StateCount(expression *ast.LambdaNode) *StateCountNode

Create a node that tracks number of consecutive points in a given state.

func (PostHandler) StateDuration

func (n PostHandler) StateDuration(expression *ast.LambdaNode) *StateDurationNode

Create a node that tracks duration in a given state.

func (PostHandler) Stddev added in v0.13.0

func (n PostHandler) Stddev(field string) *InfluxQLNode

Compute the standard deviation.

func (PostHandler) Sum added in v0.13.0

func (n PostHandler) Sum(field string) *InfluxQLNode

Compute the sum of all values.

func (PostHandler) Top added in v0.13.0

func (n PostHandler) Top(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the top `num` points for `field` and sort by any extra tags or fields.

func (PostHandler) Union added in v0.13.0

func (n PostHandler) Union(node ...Node) *UnionNode

Perform the union of this node and all other given nodes.

func (PostHandler) Where added in v0.13.0

func (n PostHandler) Where(expression *ast.LambdaNode) *WhereNode

Create a new node that filters the data stream by a given expression.

func (PostHandler) Window added in v0.13.0

func (n PostHandler) Window() *WindowNode

Create a new node that windows the stream by time.

NOTE: Window can only be applied to stream edges.

type PushoverHandler added in v1.3.0

type PushoverHandler struct {
	*AlertNode

	// User/Group key of your user (or you), viewable when logged
	// into the Pushover dashboard. Often referred to as USER_KEY
	// in the Pushover documentation.
	// If empty uses the user from the configuration.
	UserKey string

	// Users device name to send message directly to that device,
	// rather than all of a user's devices (multiple device names may
	// be separated by a comma)
	Device string

	// Your message's title, otherwise your apps name is used
	Title string

	// A supplementary URL to show with your message
	URL string

	// A title for your supplementary URL, otherwise just URL is shown
	URLTitle string

	// The name of one of the sounds supported by the device clients to override
	// the user's default sound choice
	Sound string
}

tick:embedded:AlertNode.Pushover

func (PushoverHandler) Alert added in v1.3.0

func (n PushoverHandler) Alert() *AlertNode

Create an alert node, which can trigger alerts.

func (PushoverHandler) Bottom added in v1.3.0

func (n PushoverHandler) Bottom(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the bottom `num` points for `field` and sort by any extra tags or fields.

func (PushoverHandler) Combine added in v1.3.0

func (n PushoverHandler) Combine(expressions ...*ast.LambdaNode) *CombineNode

Combine this node with itself. The data are combined on timestamp.

func (PushoverHandler) Count added in v1.3.0

func (n PushoverHandler) Count(field string) *InfluxQLNode

Count the number of points.

func (PushoverHandler) CumulativeSum added in v1.3.0

func (n PushoverHandler) CumulativeSum(field string) *InfluxQLNode

Compute a cumulative sum of each point that is received. A point is emitted for every point collected.

func (PushoverHandler) Default added in v1.3.0

func (n PushoverHandler) Default() *DefaultNode

Create a node that can set defaults for missing tags or fields.

func (PushoverHandler) Delete added in v1.3.0

func (n PushoverHandler) Delete() *DeleteNode

Create a node that can delete tags or fields.

func (PushoverHandler) Derivative added in v1.3.0

func (n PushoverHandler) Derivative(field string) *DerivativeNode

Create a new node that computes the derivative of adjacent points.

func (PushoverHandler) Difference added in v1.3.0

func (n PushoverHandler) Difference(field string) *InfluxQLNode

Compute the difference between points independent of elapsed time.

func (PushoverHandler) Distinct added in v1.3.0

func (n PushoverHandler) Distinct(field string) *InfluxQLNode

Produce batch of only the distinct points.

func (PushoverHandler) Elapsed added in v1.3.0

func (n PushoverHandler) Elapsed(field string, unit time.Duration) *InfluxQLNode

Compute the elapsed time between points

func (PushoverHandler) Eval added in v1.3.0

func (n PushoverHandler) Eval(expressions ...*ast.LambdaNode) *EvalNode

Create an eval node that will evaluate the given transformation function to each data point. A list of expressions may be provided and will be evaluated in the order they are given. The results are available to later expressions.

func (PushoverHandler) First added in v1.3.0

func (n PushoverHandler) First(field string) *InfluxQLNode

Select the first point.

func (PushoverHandler) Flatten added in v1.3.0

func (n PushoverHandler) Flatten() *FlattenNode

Flatten points with similar times into a single point.

func (PushoverHandler) GroupBy added in v1.3.0

func (n PushoverHandler) GroupBy(tag ...interface{}) *GroupByNode

Group the data by a set of tags.

Can pass literal * to group by all dimensions. Example:

|groupBy(*)

func (PushoverHandler) HoltWinters added in v1.3.0

func (n PushoverHandler) HoltWinters(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set.

func (PushoverHandler) HoltWintersWithFit added in v1.3.0

func (n PushoverHandler) HoltWintersWithFit(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set. This method also outputs all the points used to fit the data in addition to the forecasted data.

func (PushoverHandler) HttpOut added in v1.3.0

func (n PushoverHandler) HttpOut(endpoint string) *HTTPOutNode

Create an HTTP output node that caches the most recent data it has received. The cached data are available at the given endpoint. The endpoint is the relative path from the API endpoint of the running task. For example, if the task endpoint is at `/kapacitor/v1/tasks/<task_id>` and endpoint is `top10`, then the data can be requested from `/kapacitor/v1/tasks/<task_id>/top10`.

func (PushoverHandler) HttpPost added in v1.3.0

func (n PushoverHandler) HttpPost(url string) *HTTPPostNode

Creates an HTTP Post node that POSTS received data to the provided HTTP endpoint.

func (PushoverHandler) InfluxDBOut added in v1.3.0

func (n PushoverHandler) InfluxDBOut() *InfluxDBOutNode

Create an influxdb output node that will store the incoming data into InfluxDB.

func (PushoverHandler) Join added in v1.3.0

func (n PushoverHandler) Join(others ...Node) *JoinNode

Join this node with other nodes. The data are joined on timestamp.

func (PushoverHandler) K8sAutoscale added in v1.3.0

func (n PushoverHandler) K8sAutoscale() *K8sAutoscaleNode

Create a node that can trigger autoscale events for a kubernetes cluster.

func (PushoverHandler) Last added in v1.3.0

func (n PushoverHandler) Last(field string) *InfluxQLNode

Select the last point.

func (PushoverHandler) Max added in v1.3.0

func (n PushoverHandler) Max(field string) *InfluxQLNode

Select the maximum point.

func (PushoverHandler) Mean added in v1.3.0

func (n PushoverHandler) Mean(field string) *InfluxQLNode

Compute the mean of the data.

func (PushoverHandler) Median added in v1.3.0

func (n PushoverHandler) Median(field string) *InfluxQLNode

Compute the median of the data. Note, this method is not a selector, if you want the median point use `.percentile(field, 50.0)`.

func (PushoverHandler) Min added in v1.3.0

func (n PushoverHandler) Min(field string) *InfluxQLNode

Select the minimum point.

func (PushoverHandler) Mode added in v1.3.0

func (n PushoverHandler) Mode(field string) *InfluxQLNode

Compute the mode of the data.

func (PushoverHandler) MovingAverage added in v1.3.0

func (n PushoverHandler) MovingAverage(field string, window int64) *InfluxQLNode

Compute a moving average of the last window points. No points are emitted until the window is full.

func (PushoverHandler) Percentile added in v1.3.0

func (n PushoverHandler) Percentile(field string, percentile float64) *InfluxQLNode

Select a point at the given percentile. This is a selector function, no interpolation between points is performed.

func (PushoverHandler) Sample added in v1.3.0

func (n PushoverHandler) Sample(rate interface{}) *SampleNode

Create a new node that samples the incoming points or batches.

One point will be emitted every count or duration specified.

func (PushoverHandler) Shift added in v1.3.0

func (n PushoverHandler) Shift(shift time.Duration) *ShiftNode

Create a new node that shifts the incoming points or batches in time.

func (PushoverHandler) Spread added in v1.3.0

func (n PushoverHandler) Spread(field string) *InfluxQLNode

Compute the difference between `min` and `max` points.

func (PushoverHandler) StateCount added in v1.3.0

func (n PushoverHandler) StateCount(expression *ast.LambdaNode) *StateCountNode

Create a node that tracks number of consecutive points in a given state.

func (PushoverHandler) StateDuration added in v1.3.0

func (n PushoverHandler) StateDuration(expression *ast.LambdaNode) *StateDurationNode

Create a node that tracks duration in a given state.

func (PushoverHandler) Stddev added in v1.3.0

func (n PushoverHandler) Stddev(field string) *InfluxQLNode

Compute the standard deviation.

func (PushoverHandler) Sum added in v1.3.0

func (n PushoverHandler) Sum(field string) *InfluxQLNode

Compute the sum of all values.

func (PushoverHandler) Top added in v1.3.0

func (n PushoverHandler) Top(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the top `num` points for `field` and sort by any extra tags or fields.

func (PushoverHandler) Union added in v1.3.0

func (n PushoverHandler) Union(node ...Node) *UnionNode

Perform the union of this node and all other given nodes.

func (PushoverHandler) Where added in v1.3.0

func (n PushoverHandler) Where(expression *ast.LambdaNode) *WhereNode

Create a new node that filters the data stream by a given expression.

func (PushoverHandler) Window added in v1.3.0

func (n PushoverHandler) Window() *WindowNode

Create a new node that windows the stream by time.

NOTE: Window can only be applied to stream edges.

type QueryNode added in v0.13.0

type QueryNode struct {

	// The query text
	//tick:ignore
	QueryStr string

	// The period or length of time that will be queried from InfluxDB
	Period time.Duration

	// How often to query InfluxDB.
	//
	// The Every property is mutually exclusive with the Cron property.
	Every time.Duration

	// Align start and end times with the Every value
	// Does not apply if Cron is used.
	// tick:ignore
	AlignFlag bool `tick:"Align"`

	// Define a schedule using a cron syntax.
	//
	// The specific cron implementation is documented here:
	// https://github.com/gorhill/cronexpr#implementation
	//
	// The Cron property is mutually exclusive with the Every property.
	Cron string

	// How far back in time to query from the current time
	//
	// For example an Offest of 2 hours and an Every of 5m,
	// Kapacitor will query InfluxDB every 5 minutes for the window of data 2 hours ago.
	//
	// This applies to Cron schedules as well. If the cron specifies to run every Sunday at
	// 1 AM and the Offset is 1 hour. Then at 1 AM on Sunday the data from 12 AM will be queried.
	Offset time.Duration

	// Align the group by time intervals with the start time of the query
	// tick:ignore
	AlignGroupFlag bool `tick:"AlignGroup"`

	// The list of dimensions for the group-by clause.
	//tick:ignore
	Dimensions []interface{} `tick:"GroupBy"`

	// Whether to include the measurement in the group ID.
	// tick:ignore
	GroupByMeasurementFlag bool `tick:"GroupByMeasurement"`

	// Fill the data.
	// Options are:
	//
	//   - Any numerical value
	//   - null - exhibits the same behavior as the default
	//   - previous - reports the value of the previous window
	//   - none - suppresses timestamps and values where the value is null
	Fill interface{}

	// The name of a configured InfluxDB cluster.
	// If empty the default cluster will be used.
	Cluster string
	// contains filtered or unexported fields
}

A QueryNode defines a source and a schedule for processing batch data. The data is queried from an InfluxDB database and then passed into the data pipeline.

Example: batch

|query('''
    SELECT mean("value")
    FROM "telegraf"."default".cpu_usage_idle
    WHERE "host" = 'serverA'
''')
    .period(1m)
    .every(20s)
    .groupBy(time(10s), 'cpu')
...

In the above example InfluxDB is queried every 20 seconds; the window of time returned spans 1 minute and is grouped into 10 second buckets.

func (*QueryNode) Alert added in v0.13.0

func (n *QueryNode) Alert() *AlertNode

Create an alert node, which can trigger alerts.

func (*QueryNode) Align added in v0.13.0

func (b *QueryNode) Align() *QueryNode

Align start and stop times for quiries with even boundaries of the QueryNode.Every property. Does not apply if using the QueryNode.Cron property. tick:property

func (*QueryNode) AlignGroup added in v1.2.0

func (b *QueryNode) AlignGroup() *QueryNode

Align the group by time intervals with the start time of the query tick:property

func (*QueryNode) Bottom added in v0.13.0

func (n *QueryNode) Bottom(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the bottom `num` points for `field` and sort by any extra tags or fields.

func (*QueryNode) ChainMethods added in v0.13.0

func (n *QueryNode) ChainMethods() map[string]reflect.Value

func (*QueryNode) Combine added in v1.0.0

func (n *QueryNode) Combine(expressions ...*ast.LambdaNode) *CombineNode

Combine this node with itself. The data are combined on timestamp.

func (*QueryNode) Count added in v0.13.0

func (n *QueryNode) Count(field string) *InfluxQLNode

Count the number of points.

func (*QueryNode) CumulativeSum added in v1.1.0

func (n *QueryNode) CumulativeSum(field string) *InfluxQLNode

Compute a cumulative sum of each point that is received. A point is emitted for every point collected.

func (*QueryNode) Default added in v0.13.0

func (n *QueryNode) Default() *DefaultNode

Create a node that can set defaults for missing tags or fields.

func (*QueryNode) Delete added in v1.0.0

func (n *QueryNode) Delete() *DeleteNode

Create a node that can delete tags or fields.

func (*QueryNode) Derivative added in v0.13.0

func (n *QueryNode) Derivative(field string) *DerivativeNode

Create a new node that computes the derivative of adjacent points.

func (*QueryNode) Difference added in v1.0.0

func (n *QueryNode) Difference(field string) *InfluxQLNode

Compute the difference between points independent of elapsed time.

func (*QueryNode) Distinct added in v0.13.0

func (n *QueryNode) Distinct(field string) *InfluxQLNode

Produce batch of only the distinct points.

func (*QueryNode) Elapsed added in v0.13.0

func (n *QueryNode) Elapsed(field string, unit time.Duration) *InfluxQLNode

Compute the elapsed time between points

func (*QueryNode) Eval added in v0.13.0

func (n *QueryNode) Eval(expressions ...*ast.LambdaNode) *EvalNode

Create an eval node that will evaluate the given transformation function to each data point. A list of expressions may be provided and will be evaluated in the order they are given. The results are available to later expressions.

func (*QueryNode) First added in v0.13.0

func (n *QueryNode) First(field string) *InfluxQLNode

Select the first point.

func (*QueryNode) Flatten added in v1.0.0

func (n *QueryNode) Flatten() *FlattenNode

Flatten points with similar times into a single point.

func (*QueryNode) GroupBy added in v0.13.0

func (b *QueryNode) GroupBy(d ...interface{}) *QueryNode

Group the data by a set of dimensions. Can specify one time dimension.

This property adds a `GROUP BY` clause to the query so all the normal behaviors when quering InfluxDB with a `GROUP BY` apply.

Use group by time when your period is longer than your group by time interval.

Example:

batch
    |query(...)
        .period(1m)
        .every(1m)
        .groupBy(time(10s), 'tag1', 'tag2'))
        .align()

A group by time offset is also possible.

Example:

batch
    |query(...)
        .period(1m)
        .every(1m)
        .groupBy(time(10s, -5s), 'tag1', 'tag2'))
        .align()
        .offset(5s)

It is recommended to use QueryNode.Align and QueryNode.Offset in conjunction with group by time dimensions so that the time bounds match up with the group by intervals. To automatically align the group by intervals to the start of the query time, use QueryNode.AlignGroup. This is useful in more complex situations, such as when the groupBy time period is longer than the query frequency.

Example:

batch
    |query(...)
        .period(5m)
        .every(30s)
        .groupBy(time(1m), 'tag1', 'tag2')
        .align()
        .alignGroup()

For the above example, without QueryNode.AlignGroup, every other query issued by Kapacitor (at :30 past the minute) will align to :00 seconds instead of the desired :30 seconds, which would create 6 group by intervals instead of 5, the first and last of which would only have 30 seconds of data instead of a full minute. If the group by time offset (i.e. time(t, offset)) is used in conjunction with QueryNode.AlignGroup, the alignment will occur first, and will be offset the specified amount after.

NOTE: Since QueryNode.Offset is inherently a negative property the second "offset" argument to the "time" function is negative to match.

tick:property

func (*QueryNode) GroupByMeasurement added in v1.0.0

func (n *QueryNode) GroupByMeasurement() *QueryNode

If set will include the measurement name in the group ID. Along with any other group by dimensions.

Example: batch

|query('SELECT sum("value") FROM "telegraf"."autogen"./process_.*/')
    .groupByMeasurement()
    .groupBy('host')

The above example selects data from several measurements matching `/process_.*/ and then each point is grouped by the host tag and measurement name. Thus keeping measurements in their own groups. tick:property

func (*QueryNode) HoltWinters added in v1.0.0

func (n *QueryNode) HoltWinters(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set.

func (*QueryNode) HoltWintersWithFit added in v1.0.0

func (n *QueryNode) HoltWintersWithFit(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set. This method also outputs all the points used to fit the data in addition to the forecasted data.

func (*QueryNode) HttpOut added in v0.13.0

func (n *QueryNode) HttpOut(endpoint string) *HTTPOutNode

Create an HTTP output node that caches the most recent data it has received. The cached data are available at the given endpoint. The endpoint is the relative path from the API endpoint of the running task. For example, if the task endpoint is at `/kapacitor/v1/tasks/<task_id>` and endpoint is `top10`, then the data can be requested from `/kapacitor/v1/tasks/<task_id>/top10`.

func (*QueryNode) HttpPost added in v1.3.0

func (n *QueryNode) HttpPost(url string) *HTTPPostNode

Creates an HTTP Post node that POSTS received data to the provided HTTP endpoint.

func (*QueryNode) InfluxDBOut added in v0.13.0

func (n *QueryNode) InfluxDBOut() *InfluxDBOutNode

Create an influxdb output node that will store the incoming data into InfluxDB.

func (*QueryNode) Join added in v0.13.0

func (n *QueryNode) Join(others ...Node) *JoinNode

Join this node with other nodes. The data are joined on timestamp.

func (*QueryNode) K8sAutoscale added in v1.1.0

func (n *QueryNode) K8sAutoscale() *K8sAutoscaleNode

Create a node that can trigger autoscale events for a kubernetes cluster.

func (*QueryNode) Last added in v0.13.0

func (n *QueryNode) Last(field string) *InfluxQLNode

Select the last point.

func (*QueryNode) Log added in v0.13.0

func (n *QueryNode) Log() *LogNode

Create a node that logs all data it receives.

func (*QueryNode) Max added in v0.13.0

func (n *QueryNode) Max(field string) *InfluxQLNode

Select the maximum point.

func (*QueryNode) Mean added in v0.13.0

func (n *QueryNode) Mean(field string) *InfluxQLNode

Compute the mean of the data.

func (*QueryNode) Median added in v0.13.0

func (n *QueryNode) Median(field string) *InfluxQLNode

Compute the median of the data. Note, this method is not a selector, if you want the median point use `.percentile(field, 50.0)`.

func (*QueryNode) Min added in v0.13.0

func (n *QueryNode) Min(field string) *InfluxQLNode

Select the minimum point.

func (*QueryNode) Mode added in v1.0.0

func (n *QueryNode) Mode(field string) *InfluxQLNode

Compute the mode of the data.

func (*QueryNode) MovingAverage added in v1.0.0

func (n *QueryNode) MovingAverage(field string, window int64) *InfluxQLNode

Compute a moving average of the last window points. No points are emitted until the window is full.

func (*QueryNode) Percentile added in v0.13.0

func (n *QueryNode) Percentile(field string, percentile float64) *InfluxQLNode

Select a point at the given percentile. This is a selector function, no interpolation between points is performed.

func (*QueryNode) Sample added in v0.13.0

func (n *QueryNode) Sample(rate interface{}) *SampleNode

Create a new node that samples the incoming points or batches.

One point will be emitted every count or duration specified.

func (*QueryNode) Shift added in v0.13.0

func (n *QueryNode) Shift(shift time.Duration) *ShiftNode

Create a new node that shifts the incoming points or batches in time.

func (*QueryNode) Spread added in v0.13.0

func (n *QueryNode) Spread(field string) *InfluxQLNode

Compute the difference between `min` and `max` points.

func (*QueryNode) StateCount added in v1.3.0

func (n *QueryNode) StateCount(expression *ast.LambdaNode) *StateCountNode

Create a node that tracks number of consecutive points in a given state.

func (*QueryNode) StateDuration added in v1.3.0

func (n *QueryNode) StateDuration(expression *ast.LambdaNode) *StateDurationNode

Create a node that tracks duration in a given state.

func (*QueryNode) Stddev added in v0.13.0

func (n *QueryNode) Stddev(field string) *InfluxQLNode

Compute the standard deviation.

func (*QueryNode) Sum added in v0.13.0

func (n *QueryNode) Sum(field string) *InfluxQLNode

Compute the sum of all values.

func (*QueryNode) Top added in v0.13.0

func (n *QueryNode) Top(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the top `num` points for `field` and sort by any extra tags or fields.

func (*QueryNode) Union added in v0.13.0

func (n *QueryNode) Union(node ...Node) *UnionNode

Perform the union of this node and all other given nodes.

func (*QueryNode) Where added in v0.13.0

func (n *QueryNode) Where(expression *ast.LambdaNode) *WhereNode

Create a new node that filters the data stream by a given expression.

func (*QueryNode) Window added in v0.13.0

func (n *QueryNode) Window() *WindowNode

Create a new node that windows the stream by time.

NOTE: Window can only be applied to stream edges.

type ReduceCreater added in v0.11.0

type ReduceCreater struct {
	CreateFloatReducer     func() (influxql.FloatPointAggregator, influxql.FloatPointEmitter)
	CreateFloatBulkReducer func() (FloatBulkPointAggregator, influxql.FloatPointEmitter)

	CreateFloatIntegerReducer     func() (influxql.FloatPointAggregator, influxql.IntegerPointEmitter)
	CreateFloatBulkIntegerReducer func() (FloatBulkPointAggregator, influxql.IntegerPointEmitter)

	CreateFloatStringReducer     func() (influxql.FloatPointAggregator, influxql.StringPointEmitter)
	CreateFloatBulkStringReducer func() (FloatBulkPointAggregator, influxql.StringPointEmitter)

	CreateFloatBooleanReducer     func() (influxql.FloatPointAggregator, influxql.BooleanPointEmitter)
	CreateFloatBulkBooleanReducer func() (FloatBulkPointAggregator, influxql.BooleanPointEmitter)

	CreateIntegerFloatReducer     func() (influxql.IntegerPointAggregator, influxql.FloatPointEmitter)
	CreateIntegerBulkFloatReducer func() (IntegerBulkPointAggregator, influxql.FloatPointEmitter)

	CreateIntegerReducer     func() (influxql.IntegerPointAggregator, influxql.IntegerPointEmitter)
	CreateIntegerBulkReducer func() (IntegerBulkPointAggregator, influxql.IntegerPointEmitter)

	CreateIntegerStringReducer     func() (influxql.IntegerPointAggregator, influxql.StringPointEmitter)
	CreateIntegerBulkStringReducer func() (IntegerBulkPointAggregator, influxql.StringPointEmitter)

	CreateIntegerBooleanReducer     func() (influxql.IntegerPointAggregator, influxql.BooleanPointEmitter)
	CreateIntegerBulkBooleanReducer func() (IntegerBulkPointAggregator, influxql.BooleanPointEmitter)

	CreateStringFloatReducer     func() (influxql.StringPointAggregator, influxql.FloatPointEmitter)
	CreateStringBulkFloatReducer func() (StringBulkPointAggregator, influxql.FloatPointEmitter)

	CreateStringIntegerReducer     func() (influxql.StringPointAggregator, influxql.IntegerPointEmitter)
	CreateStringBulkIntegerReducer func() (StringBulkPointAggregator, influxql.IntegerPointEmitter)

	CreateStringReducer     func() (influxql.StringPointAggregator, influxql.StringPointEmitter)
	CreateStringBulkReducer func() (StringBulkPointAggregator, influxql.StringPointEmitter)

	CreateStringBooleanReducer     func() (influxql.StringPointAggregator, influxql.BooleanPointEmitter)
	CreateStringBulkBooleanReducer func() (StringBulkPointAggregator, influxql.BooleanPointEmitter)

	CreateBooleanFloatReducer     func() (influxql.BooleanPointAggregator, influxql.FloatPointEmitter)
	CreateBooleanBulkFloatReducer func() (BooleanBulkPointAggregator, influxql.FloatPointEmitter)

	CreateBooleanIntegerReducer     func() (influxql.BooleanPointAggregator, influxql.IntegerPointEmitter)
	CreateBooleanBulkIntegerReducer func() (BooleanBulkPointAggregator, influxql.IntegerPointEmitter)

	CreateBooleanStringReducer     func() (influxql.BooleanPointAggregator, influxql.StringPointEmitter)
	CreateBooleanBulkStringReducer func() (BooleanBulkPointAggregator, influxql.StringPointEmitter)

	CreateBooleanReducer     func() (influxql.BooleanPointAggregator, influxql.BooleanPointEmitter)
	CreateBooleanBulkReducer func() (BooleanBulkPointAggregator, influxql.BooleanPointEmitter)

	TopBottomCallInfo      *TopBottomCallInfo
	IsSimpleSelector       bool
	IsStreamTransformation bool
	IsEmptyOK              bool
}

type SNMPData added in v1.2.0

type SNMPData struct {
	Oid   string
	Type  string
	Value string
}

tick:ignore

type SNMPTrapHandler added in v1.2.0

type SNMPTrapHandler struct {
	*AlertNode

	// TrapOid
	// tick:ignore
	TrapOid string

	// List of trap data.
	// tick:ignore
	DataList []SNMPData `tick:"Data"`
}

SNMPTrap AlertHandler tick:embedded:AlertNode.SnmpTrap

func (SNMPTrapHandler) Alert added in v1.2.0

func (n SNMPTrapHandler) Alert() *AlertNode

Create an alert node, which can trigger alerts.

func (SNMPTrapHandler) Bottom added in v1.2.0

func (n SNMPTrapHandler) Bottom(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the bottom `num` points for `field` and sort by any extra tags or fields.

func (SNMPTrapHandler) Combine added in v1.2.0

func (n SNMPTrapHandler) Combine(expressions ...*ast.LambdaNode) *CombineNode

Combine this node with itself. The data are combined on timestamp.

func (SNMPTrapHandler) Count added in v1.2.0

func (n SNMPTrapHandler) Count(field string) *InfluxQLNode

Count the number of points.

func (SNMPTrapHandler) CumulativeSum added in v1.2.0

func (n SNMPTrapHandler) CumulativeSum(field string) *InfluxQLNode

Compute a cumulative sum of each point that is received. A point is emitted for every point collected.

func (*SNMPTrapHandler) Data added in v1.2.0

func (h *SNMPTrapHandler) Data(oid, typ, value string) *SNMPTrapHandler

Define Data for SNMP Trap alert. Multiple calls append to the existing list of data.

Available types:

| Abbreviation | Datatype | | ------------ | -------- | | c | Counter | | i | Integer | | n | Null | | s | String | | t | Time ticks |

Example:

|alert()
   .message('{{ .ID }}:{{ .Level }}')
   .snmpTrap('1.3.6.1.4.1.1')
      .data('1.3.6.1.4.1.1.5', 's', '{{ .Level }}' )
      .data('1.3.6.1.4.1.1.6', 'i', '50' )
      .data('1.3.6.1.4.1.1.7', 'c', '{{ index .Fields "num_requests" }}' )
      .data('1.3.6.1.4.1.1.8', 's', '{{ .Message }}' )

tick:property

func (SNMPTrapHandler) Default added in v1.2.0

func (n SNMPTrapHandler) Default() *DefaultNode

Create a node that can set defaults for missing tags or fields.

func (SNMPTrapHandler) Delete added in v1.2.0

func (n SNMPTrapHandler) Delete() *DeleteNode

Create a node that can delete tags or fields.

func (SNMPTrapHandler) Derivative added in v1.2.0

func (n SNMPTrapHandler) Derivative(field string) *DerivativeNode

Create a new node that computes the derivative of adjacent points.

func (SNMPTrapHandler) Difference added in v1.2.0

func (n SNMPTrapHandler) Difference(field string) *InfluxQLNode

Compute the difference between points independent of elapsed time.

func (SNMPTrapHandler) Distinct added in v1.2.0

func (n SNMPTrapHandler) Distinct(field string) *InfluxQLNode

Produce batch of only the distinct points.

func (SNMPTrapHandler) Elapsed added in v1.2.0

func (n SNMPTrapHandler) Elapsed(field string, unit time.Duration) *InfluxQLNode

Compute the elapsed time between points

func (SNMPTrapHandler) Eval added in v1.2.0

func (n SNMPTrapHandler) Eval(expressions ...*ast.LambdaNode) *EvalNode

Create an eval node that will evaluate the given transformation function to each data point. A list of expressions may be provided and will be evaluated in the order they are given. The results are available to later expressions.

func (SNMPTrapHandler) First added in v1.2.0

func (n SNMPTrapHandler) First(field string) *InfluxQLNode

Select the first point.

func (SNMPTrapHandler) Flatten added in v1.2.0

func (n SNMPTrapHandler) Flatten() *FlattenNode

Flatten points with similar times into a single point.

func (SNMPTrapHandler) GroupBy added in v1.2.0

func (n SNMPTrapHandler) GroupBy(tag ...interface{}) *GroupByNode

Group the data by a set of tags.

Can pass literal * to group by all dimensions. Example:

|groupBy(*)

func (SNMPTrapHandler) HoltWinters added in v1.2.0

func (n SNMPTrapHandler) HoltWinters(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set.

func (SNMPTrapHandler) HoltWintersWithFit added in v1.2.0

func (n SNMPTrapHandler) HoltWintersWithFit(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set. This method also outputs all the points used to fit the data in addition to the forecasted data.

func (SNMPTrapHandler) HttpOut added in v1.2.0

func (n SNMPTrapHandler) HttpOut(endpoint string) *HTTPOutNode

Create an HTTP output node that caches the most recent data it has received. The cached data are available at the given endpoint. The endpoint is the relative path from the API endpoint of the running task. For example, if the task endpoint is at `/kapacitor/v1/tasks/<task_id>` and endpoint is `top10`, then the data can be requested from `/kapacitor/v1/tasks/<task_id>/top10`.

func (SNMPTrapHandler) HttpPost added in v1.3.0

func (n SNMPTrapHandler) HttpPost(url string) *HTTPPostNode

Creates an HTTP Post node that POSTS received data to the provided HTTP endpoint.

func (SNMPTrapHandler) InfluxDBOut added in v1.2.0

func (n SNMPTrapHandler) InfluxDBOut() *InfluxDBOutNode

Create an influxdb output node that will store the incoming data into InfluxDB.

func (SNMPTrapHandler) Join added in v1.2.0

func (n SNMPTrapHandler) Join(others ...Node) *JoinNode

Join this node with other nodes. The data are joined on timestamp.

func (SNMPTrapHandler) K8sAutoscale added in v1.2.0

func (n SNMPTrapHandler) K8sAutoscale() *K8sAutoscaleNode

Create a node that can trigger autoscale events for a kubernetes cluster.

func (SNMPTrapHandler) Last added in v1.2.0

func (n SNMPTrapHandler) Last(field string) *InfluxQLNode

Select the last point.

func (SNMPTrapHandler) Max added in v1.2.0

func (n SNMPTrapHandler) Max(field string) *InfluxQLNode

Select the maximum point.

func (SNMPTrapHandler) Mean added in v1.2.0

func (n SNMPTrapHandler) Mean(field string) *InfluxQLNode

Compute the mean of the data.

func (SNMPTrapHandler) Median added in v1.2.0

func (n SNMPTrapHandler) Median(field string) *InfluxQLNode

Compute the median of the data. Note, this method is not a selector, if you want the median point use `.percentile(field, 50.0)`.

func (SNMPTrapHandler) Min added in v1.2.0

func (n SNMPTrapHandler) Min(field string) *InfluxQLNode

Select the minimum point.

func (SNMPTrapHandler) Mode added in v1.2.0

func (n SNMPTrapHandler) Mode(field string) *InfluxQLNode

Compute the mode of the data.

func (SNMPTrapHandler) MovingAverage added in v1.2.0

func (n SNMPTrapHandler) MovingAverage(field string, window int64) *InfluxQLNode

Compute a moving average of the last window points. No points are emitted until the window is full.

func (SNMPTrapHandler) Percentile added in v1.2.0

func (n SNMPTrapHandler) Percentile(field string, percentile float64) *InfluxQLNode

Select a point at the given percentile. This is a selector function, no interpolation between points is performed.

func (SNMPTrapHandler) Sample added in v1.2.0

func (n SNMPTrapHandler) Sample(rate interface{}) *SampleNode

Create a new node that samples the incoming points or batches.

One point will be emitted every count or duration specified.

func (SNMPTrapHandler) Shift added in v1.2.0

func (n SNMPTrapHandler) Shift(shift time.Duration) *ShiftNode

Create a new node that shifts the incoming points or batches in time.

func (SNMPTrapHandler) Spread added in v1.2.0

func (n SNMPTrapHandler) Spread(field string) *InfluxQLNode

Compute the difference between `min` and `max` points.

func (SNMPTrapHandler) StateCount added in v1.3.0

func (n SNMPTrapHandler) StateCount(expression *ast.LambdaNode) *StateCountNode

Create a node that tracks number of consecutive points in a given state.

func (SNMPTrapHandler) StateDuration added in v1.3.0

func (n SNMPTrapHandler) StateDuration(expression *ast.LambdaNode) *StateDurationNode

Create a node that tracks duration in a given state.

func (SNMPTrapHandler) Stddev added in v1.2.0

func (n SNMPTrapHandler) Stddev(field string) *InfluxQLNode

Compute the standard deviation.

func (SNMPTrapHandler) Sum added in v1.2.0

func (n SNMPTrapHandler) Sum(field string) *InfluxQLNode

Compute the sum of all values.

func (SNMPTrapHandler) Top added in v1.2.0

func (n SNMPTrapHandler) Top(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the top `num` points for `field` and sort by any extra tags or fields.

func (SNMPTrapHandler) Union added in v1.2.0

func (n SNMPTrapHandler) Union(node ...Node) *UnionNode

Perform the union of this node and all other given nodes.

func (SNMPTrapHandler) Where added in v1.2.0

func (n SNMPTrapHandler) Where(expression *ast.LambdaNode) *WhereNode

Create a new node that filters the data stream by a given expression.

func (SNMPTrapHandler) Window added in v1.2.0

func (n SNMPTrapHandler) Window() *WindowNode

Create a new node that windows the stream by time.

NOTE: Window can only be applied to stream edges.

type SampleNode

type SampleNode struct {

	// Keep every N point or batch
	// tick:ignore
	N int64

	// Keep one point or batch every Duration
	// tick:ignore
	Duration time.Duration
	// contains filtered or unexported fields
}

Sample points or batches. One point will be emitted every count or duration specified.

Example:

stream
    |sample(3)

Keep every third data point or batch.

Example:

stream
    |sample(10s)

Keep only samples that land on the 10s boundary. See FromNode.Truncate, QueryNode.GroupBy time or WindowNode.Align for ensuring data is aligned with a boundary.

func (*SampleNode) Alert

func (n *SampleNode) Alert() *AlertNode

Create an alert node, which can trigger alerts.

func (*SampleNode) Bottom added in v0.11.0

func (n *SampleNode) Bottom(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the bottom `num` points for `field` and sort by any extra tags or fields.

func (*SampleNode) Combine added in v1.0.0

func (n *SampleNode) Combine(expressions ...*ast.LambdaNode) *CombineNode

Combine this node with itself. The data are combined on timestamp.

func (*SampleNode) Count

func (n *SampleNode) Count(field string) *InfluxQLNode

Count the number of points.

func (*SampleNode) CumulativeSum added in v1.1.0

func (n *SampleNode) CumulativeSum(field string) *InfluxQLNode

Compute a cumulative sum of each point that is received. A point is emitted for every point collected.

func (*SampleNode) Default added in v0.13.0

func (n *SampleNode) Default() *DefaultNode

Create a node that can set defaults for missing tags or fields.

func (*SampleNode) Delete added in v1.0.0

func (n *SampleNode) Delete() *DeleteNode

Create a node that can delete tags or fields.

func (*SampleNode) Derivative

func (n *SampleNode) Derivative(field string) *DerivativeNode

Create a new node that computes the derivative of adjacent points.

func (*SampleNode) Difference added in v1.0.0

func (n *SampleNode) Difference(field string) *InfluxQLNode

Compute the difference between points independent of elapsed time.

func (*SampleNode) Distinct added in v0.11.0

func (n *SampleNode) Distinct(field string) *InfluxQLNode

Produce batch of only the distinct points.

func (*SampleNode) Elapsed added in v0.13.0

func (n *SampleNode) Elapsed(field string, unit time.Duration) *InfluxQLNode

Compute the elapsed time between points

func (*SampleNode) Eval

func (n *SampleNode) Eval(expressions ...*ast.LambdaNode) *EvalNode

Create an eval node that will evaluate the given transformation function to each data point. A list of expressions may be provided and will be evaluated in the order they are given. The results are available to later expressions.

func (*SampleNode) First added in v0.11.0

func (n *SampleNode) First(field string) *InfluxQLNode

Select the first point.

func (*SampleNode) Flatten added in v1.0.0

func (n *SampleNode) Flatten() *FlattenNode

Flatten points with similar times into a single point.

func (*SampleNode) GroupBy

func (n *SampleNode) GroupBy(tag ...interface{}) *GroupByNode

Group the data by a set of tags.

Can pass literal * to group by all dimensions. Example:

|groupBy(*)

func (*SampleNode) HoltWinters added in v1.0.0

func (n *SampleNode) HoltWinters(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set.

func (*SampleNode) HoltWintersWithFit added in v1.0.0

func (n *SampleNode) HoltWintersWithFit(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set. This method also outputs all the points used to fit the data in addition to the forecasted data.

func (*SampleNode) HttpOut

func (n *SampleNode) HttpOut(endpoint string) *HTTPOutNode

Create an HTTP output node that caches the most recent data it has received. The cached data are available at the given endpoint. The endpoint is the relative path from the API endpoint of the running task. For example, if the task endpoint is at `/kapacitor/v1/tasks/<task_id>` and endpoint is `top10`, then the data can be requested from `/kapacitor/v1/tasks/<task_id>/top10`.

func (*SampleNode) HttpPost added in v1.3.0

func (n *SampleNode) HttpPost(url string) *HTTPPostNode

Creates an HTTP Post node that POSTS received data to the provided HTTP endpoint.

func (*SampleNode) InfluxDBOut

func (n *SampleNode) InfluxDBOut() *InfluxDBOutNode

Create an influxdb output node that will store the incoming data into InfluxDB.

func (*SampleNode) Join

func (n *SampleNode) Join(others ...Node) *JoinNode

Join this node with other nodes. The data are joined on timestamp.

func (*SampleNode) K8sAutoscale added in v1.1.0

func (n *SampleNode) K8sAutoscale() *K8sAutoscaleNode

Create a node that can trigger autoscale events for a kubernetes cluster.

func (*SampleNode) Last added in v0.11.0

func (n *SampleNode) Last(field string) *InfluxQLNode

Select the last point.

func (*SampleNode) Log added in v0.11.0

func (n *SampleNode) Log() *LogNode

Create a node that logs all data it receives.

func (*SampleNode) Max added in v0.11.0

func (n *SampleNode) Max(field string) *InfluxQLNode

Select the maximum point.

func (*SampleNode) Mean added in v0.11.0

func (n *SampleNode) Mean(field string) *InfluxQLNode

Compute the mean of the data.

func (*SampleNode) Median added in v0.11.0

func (n *SampleNode) Median(field string) *InfluxQLNode

Compute the median of the data. Note, this method is not a selector, if you want the median point use `.percentile(field, 50.0)`.

func (*SampleNode) Min added in v0.11.0

func (n *SampleNode) Min(field string) *InfluxQLNode

Select the minimum point.

func (*SampleNode) Mode added in v1.0.0

func (n *SampleNode) Mode(field string) *InfluxQLNode

Compute the mode of the data.

func (*SampleNode) MovingAverage added in v1.0.0

func (n *SampleNode) MovingAverage(field string, window int64) *InfluxQLNode

Compute a moving average of the last window points. No points are emitted until the window is full.

func (*SampleNode) Percentile added in v0.11.0

func (n *SampleNode) Percentile(field string, percentile float64) *InfluxQLNode

Select a point at the given percentile. This is a selector function, no interpolation between points is performed.

func (*SampleNode) Sample

func (n *SampleNode) Sample(rate interface{}) *SampleNode

Create a new node that samples the incoming points or batches.

One point will be emitted every count or duration specified.

func (*SampleNode) Shift added in v0.11.0

func (n *SampleNode) Shift(shift time.Duration) *ShiftNode

Create a new node that shifts the incoming points or batches in time.

func (*SampleNode) Spread added in v0.11.0

func (n *SampleNode) Spread(field string) *InfluxQLNode

Compute the difference between `min` and `max` points.

func (*SampleNode) StateCount added in v1.3.0

func (n *SampleNode) StateCount(expression *ast.LambdaNode) *StateCountNode

Create a node that tracks number of consecutive points in a given state.

func (*SampleNode) StateDuration added in v1.3.0

func (n *SampleNode) StateDuration(expression *ast.LambdaNode) *StateDurationNode

Create a node that tracks duration in a given state.

func (*SampleNode) Stddev added in v0.11.0

func (n *SampleNode) Stddev(field string) *InfluxQLNode

Compute the standard deviation.

func (*SampleNode) Sum added in v0.11.0

func (n *SampleNode) Sum(field string) *InfluxQLNode

Compute the sum of all values.

func (*SampleNode) Top added in v0.11.0

func (n *SampleNode) Top(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the top `num` points for `field` and sort by any extra tags or fields.

func (*SampleNode) Union

func (n *SampleNode) Union(node ...Node) *UnionNode

Perform the union of this node and all other given nodes.

func (*SampleNode) Where

func (n *SampleNode) Where(expression *ast.LambdaNode) *WhereNode

Create a new node that filters the data stream by a given expression.

func (*SampleNode) Window

func (n *SampleNode) Window() *WindowNode

Create a new node that windows the stream by time.

NOTE: Window can only be applied to stream edges.

type SensuHandler added in v0.10.0

type SensuHandler struct {
	*AlertNode

	// Sensu source in which to post messages.
	// If empty uses the Source from the configuration.
	Source string
}

tick:embedded:AlertNode.Sensu

func (SensuHandler) Alert added in v0.13.0

func (n SensuHandler) Alert() *AlertNode

Create an alert node, which can trigger alerts.

func (SensuHandler) Bottom added in v0.13.0

func (n SensuHandler) Bottom(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the bottom `num` points for `field` and sort by any extra tags or fields.

func (SensuHandler) Combine added in v1.0.0

func (n SensuHandler) Combine(expressions ...*ast.LambdaNode) *CombineNode

Combine this node with itself. The data are combined on timestamp.

func (SensuHandler) Count added in v0.13.0

func (n SensuHandler) Count(field string) *InfluxQLNode

Count the number of points.

func (SensuHandler) CumulativeSum added in v1.1.0

func (n SensuHandler) CumulativeSum(field string) *InfluxQLNode

Compute a cumulative sum of each point that is received. A point is emitted for every point collected.

func (SensuHandler) Default added in v0.13.0

func (n SensuHandler) Default() *DefaultNode

Create a node that can set defaults for missing tags or fields.

func (SensuHandler) Delete added in v1.0.0

func (n SensuHandler) Delete() *DeleteNode

Create a node that can delete tags or fields.

func (SensuHandler) Derivative added in v0.13.0

func (n SensuHandler) Derivative(field string) *DerivativeNode

Create a new node that computes the derivative of adjacent points.

func (SensuHandler) Difference added in v1.0.0

func (n SensuHandler) Difference(field string) *InfluxQLNode

Compute the difference between points independent of elapsed time.

func (SensuHandler) Distinct added in v0.13.0

func (n SensuHandler) Distinct(field string) *InfluxQLNode

Produce batch of only the distinct points.

func (SensuHandler) Elapsed added in v0.13.0

func (n SensuHandler) Elapsed(field string, unit time.Duration) *InfluxQLNode

Compute the elapsed time between points

func (SensuHandler) Eval added in v0.13.0

func (n SensuHandler) Eval(expressions ...*ast.LambdaNode) *EvalNode

Create an eval node that will evaluate the given transformation function to each data point. A list of expressions may be provided and will be evaluated in the order they are given. The results are available to later expressions.

func (SensuHandler) First added in v0.13.0

func (n SensuHandler) First(field string) *InfluxQLNode

Select the first point.

func (SensuHandler) Flatten added in v1.0.0

func (n SensuHandler) Flatten() *FlattenNode

Flatten points with similar times into a single point.

func (SensuHandler) GroupBy added in v0.13.0

func (n SensuHandler) GroupBy(tag ...interface{}) *GroupByNode

Group the data by a set of tags.

Can pass literal * to group by all dimensions. Example:

|groupBy(*)

func (SensuHandler) HoltWinters added in v1.0.0

func (n SensuHandler) HoltWinters(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set.

func (SensuHandler) HoltWintersWithFit added in v1.0.0

func (n SensuHandler) HoltWintersWithFit(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set. This method also outputs all the points used to fit the data in addition to the forecasted data.

func (SensuHandler) HttpOut added in v0.13.0

func (n SensuHandler) HttpOut(endpoint string) *HTTPOutNode

Create an HTTP output node that caches the most recent data it has received. The cached data are available at the given endpoint. The endpoint is the relative path from the API endpoint of the running task. For example, if the task endpoint is at `/kapacitor/v1/tasks/<task_id>` and endpoint is `top10`, then the data can be requested from `/kapacitor/v1/tasks/<task_id>/top10`.

func (SensuHandler) HttpPost added in v1.3.0

func (n SensuHandler) HttpPost(url string) *HTTPPostNode

Creates an HTTP Post node that POSTS received data to the provided HTTP endpoint.

func (SensuHandler) InfluxDBOut added in v0.13.0

func (n SensuHandler) InfluxDBOut() *InfluxDBOutNode

Create an influxdb output node that will store the incoming data into InfluxDB.

func (SensuHandler) Join added in v0.13.0

func (n SensuHandler) Join(others ...Node) *JoinNode

Join this node with other nodes. The data are joined on timestamp.

func (SensuHandler) K8sAutoscale added in v1.1.0

func (n SensuHandler) K8sAutoscale() *K8sAutoscaleNode

Create a node that can trigger autoscale events for a kubernetes cluster.

func (SensuHandler) Last added in v0.13.0

func (n SensuHandler) Last(field string) *InfluxQLNode

Select the last point.

func (SensuHandler) Max added in v0.13.0

func (n SensuHandler) Max(field string) *InfluxQLNode

Select the maximum point.

func (SensuHandler) Mean added in v0.13.0

func (n SensuHandler) Mean(field string) *InfluxQLNode

Compute the mean of the data.

func (SensuHandler) Median added in v0.13.0

func (n SensuHandler) Median(field string) *InfluxQLNode

Compute the median of the data. Note, this method is not a selector, if you want the median point use `.percentile(field, 50.0)`.

func (SensuHandler) Min added in v0.13.0

func (n SensuHandler) Min(field string) *InfluxQLNode

Select the minimum point.

func (SensuHandler) Mode added in v1.0.0

func (n SensuHandler) Mode(field string) *InfluxQLNode

Compute the mode of the data.

func (SensuHandler) MovingAverage added in v1.0.0

func (n SensuHandler) MovingAverage(field string, window int64) *InfluxQLNode

Compute a moving average of the last window points. No points are emitted until the window is full.

func (SensuHandler) Percentile added in v0.13.0

func (n SensuHandler) Percentile(field string, percentile float64) *InfluxQLNode

Select a point at the given percentile. This is a selector function, no interpolation between points is performed.

func (SensuHandler) Sample added in v0.13.0

func (n SensuHandler) Sample(rate interface{}) *SampleNode

Create a new node that samples the incoming points or batches.

One point will be emitted every count or duration specified.

func (SensuHandler) Shift added in v0.13.0

func (n SensuHandler) Shift(shift time.Duration) *ShiftNode

Create a new node that shifts the incoming points or batches in time.

func (SensuHandler) Spread added in v0.13.0

func (n SensuHandler) Spread(field string) *InfluxQLNode

Compute the difference between `min` and `max` points.

func (SensuHandler) StateCount added in v1.3.0

func (n SensuHandler) StateCount(expression *ast.LambdaNode) *StateCountNode

Create a node that tracks number of consecutive points in a given state.

func (SensuHandler) StateDuration added in v1.3.0

func (n SensuHandler) StateDuration(expression *ast.LambdaNode) *StateDurationNode

Create a node that tracks duration in a given state.

func (SensuHandler) Stddev added in v0.13.0

func (n SensuHandler) Stddev(field string) *InfluxQLNode

Compute the standard deviation.

func (SensuHandler) Sum added in v0.13.0

func (n SensuHandler) Sum(field string) *InfluxQLNode

Compute the sum of all values.

func (SensuHandler) Top added in v0.13.0

func (n SensuHandler) Top(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the top `num` points for `field` and sort by any extra tags or fields.

func (SensuHandler) Union added in v0.13.0

func (n SensuHandler) Union(node ...Node) *UnionNode

Perform the union of this node and all other given nodes.

func (SensuHandler) Where added in v0.13.0

func (n SensuHandler) Where(expression *ast.LambdaNode) *WhereNode

Create a new node that filters the data stream by a given expression.

func (SensuHandler) Window added in v0.13.0

func (n SensuHandler) Window() *WindowNode

Create a new node that windows the stream by time.

NOTE: Window can only be applied to stream edges.

type ShiftNode added in v0.11.0

type ShiftNode struct {

	// Keep one point or batch every Duration
	// tick:ignore
	Shift time.Duration
	// contains filtered or unexported fields
}

Shift points and batches in time, this is useful for comparing batches or points from different times.

Example:

stream
    |shift(5m)

Shift all data points 5m forward in time.

Example:

stream
    |shift(-10s)

Shift all data points 10s backward in time.

func (*ShiftNode) Alert added in v0.11.0

func (n *ShiftNode) Alert() *AlertNode

Create an alert node, which can trigger alerts.

func (*ShiftNode) Bottom added in v0.11.0

func (n *ShiftNode) Bottom(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the bottom `num` points for `field` and sort by any extra tags or fields.

func (*ShiftNode) Combine added in v1.0.0

func (n *ShiftNode) Combine(expressions ...*ast.LambdaNode) *CombineNode

Combine this node with itself. The data are combined on timestamp.

func (*ShiftNode) Count added in v0.11.0

func (n *ShiftNode) Count(field string) *InfluxQLNode

Count the number of points.

func (*ShiftNode) CumulativeSum added in v1.1.0

func (n *ShiftNode) CumulativeSum(field string) *InfluxQLNode

Compute a cumulative sum of each point that is received. A point is emitted for every point collected.

func (*ShiftNode) Default added in v0.13.0

func (n *ShiftNode) Default() *DefaultNode

Create a node that can set defaults for missing tags or fields.

func (*ShiftNode) Delete added in v1.0.0

func (n *ShiftNode) Delete() *DeleteNode

Create a node that can delete tags or fields.

func (*ShiftNode) Derivative added in v0.11.0

func (n *ShiftNode) Derivative(field string) *DerivativeNode

Create a new node that computes the derivative of adjacent points.

func (*ShiftNode) Difference added in v1.0.0

func (n *ShiftNode) Difference(field string) *InfluxQLNode

Compute the difference between points independent of elapsed time.

func (*ShiftNode) Distinct added in v0.11.0

func (n *ShiftNode) Distinct(field string) *InfluxQLNode

Produce batch of only the distinct points.

func (*ShiftNode) Elapsed added in v0.13.0

func (n *ShiftNode) Elapsed(field string, unit time.Duration) *InfluxQLNode

Compute the elapsed time between points

func (*ShiftNode) Eval added in v0.11.0

func (n *ShiftNode) Eval(expressions ...*ast.LambdaNode) *EvalNode

Create an eval node that will evaluate the given transformation function to each data point. A list of expressions may be provided and will be evaluated in the order they are given. The results are available to later expressions.

func (*ShiftNode) First added in v0.11.0

func (n *ShiftNode) First(field string) *InfluxQLNode

Select the first point.

func (*ShiftNode) Flatten added in v1.0.0

func (n *ShiftNode) Flatten() *FlattenNode

Flatten points with similar times into a single point.

func (*ShiftNode) GroupBy added in v0.11.0

func (n *ShiftNode) GroupBy(tag ...interface{}) *GroupByNode

Group the data by a set of tags.

Can pass literal * to group by all dimensions. Example:

|groupBy(*)

func (*ShiftNode) HoltWinters added in v1.0.0

func (n *ShiftNode) HoltWinters(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set.

func (*ShiftNode) HoltWintersWithFit added in v1.0.0

func (n *ShiftNode) HoltWintersWithFit(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set. This method also outputs all the points used to fit the data in addition to the forecasted data.

func (*ShiftNode) HttpOut added in v0.11.0

func (n *ShiftNode) HttpOut(endpoint string) *HTTPOutNode

Create an HTTP output node that caches the most recent data it has received. The cached data are available at the given endpoint. The endpoint is the relative path from the API endpoint of the running task. For example, if the task endpoint is at `/kapacitor/v1/tasks/<task_id>` and endpoint is `top10`, then the data can be requested from `/kapacitor/v1/tasks/<task_id>/top10`.

func (*ShiftNode) HttpPost added in v1.3.0

func (n *ShiftNode) HttpPost(url string) *HTTPPostNode

Creates an HTTP Post node that POSTS received data to the provided HTTP endpoint.

func (*ShiftNode) InfluxDBOut added in v0.11.0

func (n *ShiftNode) InfluxDBOut() *InfluxDBOutNode

Create an influxdb output node that will store the incoming data into InfluxDB.

func (*ShiftNode) Join added in v0.11.0

func (n *ShiftNode) Join(others ...Node) *JoinNode

Join this node with other nodes. The data are joined on timestamp.

func (*ShiftNode) K8sAutoscale added in v1.1.0

func (n *ShiftNode) K8sAutoscale() *K8sAutoscaleNode

Create a node that can trigger autoscale events for a kubernetes cluster.

func (*ShiftNode) Last added in v0.11.0

func (n *ShiftNode) Last(field string) *InfluxQLNode

Select the last point.

func (*ShiftNode) Log added in v0.11.0

func (n *ShiftNode) Log() *LogNode

Create a node that logs all data it receives.

func (*ShiftNode) Max added in v0.11.0

func (n *ShiftNode) Max(field string) *InfluxQLNode

Select the maximum point.

func (*ShiftNode) Mean added in v0.11.0

func (n *ShiftNode) Mean(field string) *InfluxQLNode

Compute the mean of the data.

func (*ShiftNode) Median added in v0.11.0

func (n *ShiftNode) Median(field string) *InfluxQLNode

Compute the median of the data. Note, this method is not a selector, if you want the median point use `.percentile(field, 50.0)`.

func (*ShiftNode) Min added in v0.11.0

func (n *ShiftNode) Min(field string) *InfluxQLNode

Select the minimum point.

func (*ShiftNode) Mode added in v1.0.0

func (n *ShiftNode) Mode(field string) *InfluxQLNode

Compute the mode of the data.

func (*ShiftNode) MovingAverage added in v1.0.0

func (n *ShiftNode) MovingAverage(field string, window int64) *InfluxQLNode

Compute a moving average of the last window points. No points are emitted until the window is full.

func (*ShiftNode) Percentile added in v0.11.0

func (n *ShiftNode) Percentile(field string, percentile float64) *InfluxQLNode

Select a point at the given percentile. This is a selector function, no interpolation between points is performed.

func (*ShiftNode) Sample added in v0.11.0

func (n *ShiftNode) Sample(rate interface{}) *SampleNode

Create a new node that samples the incoming points or batches.

One point will be emitted every count or duration specified.

func (*ShiftNode) Shift added in v0.11.0

func (n *ShiftNode) Shift(shift time.Duration) *ShiftNode

Create a new node that shifts the incoming points or batches in time.

func (*ShiftNode) Spread added in v0.11.0

func (n *ShiftNode) Spread(field string) *InfluxQLNode

Compute the difference between `min` and `max` points.

func (*ShiftNode) StateCount added in v1.3.0

func (n *ShiftNode) StateCount(expression *ast.LambdaNode) *StateCountNode

Create a node that tracks number of consecutive points in a given state.

func (*ShiftNode) StateDuration added in v1.3.0

func (n *ShiftNode) StateDuration(expression *ast.LambdaNode) *StateDurationNode

Create a node that tracks duration in a given state.

func (*ShiftNode) Stddev added in v0.11.0

func (n *ShiftNode) Stddev(field string) *InfluxQLNode

Compute the standard deviation.

func (*ShiftNode) Sum added in v0.11.0

func (n *ShiftNode) Sum(field string) *InfluxQLNode

Compute the sum of all values.

func (*ShiftNode) Top added in v0.11.0

func (n *ShiftNode) Top(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the top `num` points for `field` and sort by any extra tags or fields.

func (*ShiftNode) Union added in v0.11.0

func (n *ShiftNode) Union(node ...Node) *UnionNode

Perform the union of this node and all other given nodes.

func (*ShiftNode) Where added in v0.11.0

func (n *ShiftNode) Where(expression *ast.LambdaNode) *WhereNode

Create a new node that filters the data stream by a given expression.

func (*ShiftNode) Window added in v0.11.0

func (n *ShiftNode) Window() *WindowNode

Create a new node that windows the stream by time.

NOTE: Window can only be applied to stream edges.

type SlackHandler added in v0.2.4

type SlackHandler struct {
	*AlertNode

	// Slack channel in which to post messages.
	// If empty uses the channel from the configuration.
	Channel string

	// Username of the Slack bot.
	// If empty uses the username from the configuration.
	Username string

	// IconEmoji is an emoji name surrounded in ':' characters.
	// The emoji image will replace the normal user icon for the slack bot.
	IconEmoji string
}

tick:embedded:AlertNode.Slack

func (SlackHandler) Alert added in v0.13.0

func (n SlackHandler) Alert() *AlertNode

Create an alert node, which can trigger alerts.

func (SlackHandler) Bottom added in v0.13.0

func (n SlackHandler) Bottom(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the bottom `num` points for `field` and sort by any extra tags or fields.

func (SlackHandler) Combine added in v1.0.0

func (n SlackHandler) Combine(expressions ...*ast.LambdaNode) *CombineNode

Combine this node with itself. The data are combined on timestamp.

func (SlackHandler) Count added in v0.13.0

func (n SlackHandler) Count(field string) *InfluxQLNode

Count the number of points.

func (SlackHandler) CumulativeSum added in v1.1.0

func (n SlackHandler) CumulativeSum(field string) *InfluxQLNode

Compute a cumulative sum of each point that is received. A point is emitted for every point collected.

func (SlackHandler) Default added in v0.13.0

func (n SlackHandler) Default() *DefaultNode

Create a node that can set defaults for missing tags or fields.

func (SlackHandler) Delete added in v1.0.0

func (n SlackHandler) Delete() *DeleteNode

Create a node that can delete tags or fields.

func (SlackHandler) Derivative added in v0.13.0

func (n SlackHandler) Derivative(field string) *DerivativeNode

Create a new node that computes the derivative of adjacent points.

func (SlackHandler) Difference added in v1.0.0

func (n SlackHandler) Difference(field string) *InfluxQLNode

Compute the difference between points independent of elapsed time.

func (SlackHandler) Distinct added in v0.13.0

func (n SlackHandler) Distinct(field string) *InfluxQLNode

Produce batch of only the distinct points.

func (SlackHandler) Elapsed added in v0.13.0

func (n SlackHandler) Elapsed(field string, unit time.Duration) *InfluxQLNode

Compute the elapsed time between points

func (SlackHandler) Eval added in v0.13.0

func (n SlackHandler) Eval(expressions ...*ast.LambdaNode) *EvalNode

Create an eval node that will evaluate the given transformation function to each data point. A list of expressions may be provided and will be evaluated in the order they are given. The results are available to later expressions.

func (SlackHandler) First added in v0.13.0

func (n SlackHandler) First(field string) *InfluxQLNode

Select the first point.

func (SlackHandler) Flatten added in v1.0.0

func (n SlackHandler) Flatten() *FlattenNode

Flatten points with similar times into a single point.

func (SlackHandler) GroupBy added in v0.13.0

func (n SlackHandler) GroupBy(tag ...interface{}) *GroupByNode

Group the data by a set of tags.

Can pass literal * to group by all dimensions. Example:

|groupBy(*)

func (SlackHandler) HoltWinters added in v1.0.0

func (n SlackHandler) HoltWinters(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set.

func (SlackHandler) HoltWintersWithFit added in v1.0.0

func (n SlackHandler) HoltWintersWithFit(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set. This method also outputs all the points used to fit the data in addition to the forecasted data.

func (SlackHandler) HttpOut added in v0.13.0

func (n SlackHandler) HttpOut(endpoint string) *HTTPOutNode

Create an HTTP output node that caches the most recent data it has received. The cached data are available at the given endpoint. The endpoint is the relative path from the API endpoint of the running task. For example, if the task endpoint is at `/kapacitor/v1/tasks/<task_id>` and endpoint is `top10`, then the data can be requested from `/kapacitor/v1/tasks/<task_id>/top10`.

func (SlackHandler) HttpPost added in v1.3.0

func (n SlackHandler) HttpPost(url string) *HTTPPostNode

Creates an HTTP Post node that POSTS received data to the provided HTTP endpoint.

func (SlackHandler) InfluxDBOut added in v0.13.0

func (n SlackHandler) InfluxDBOut() *InfluxDBOutNode

Create an influxdb output node that will store the incoming data into InfluxDB.

func (SlackHandler) Join added in v0.13.0

func (n SlackHandler) Join(others ...Node) *JoinNode

Join this node with other nodes. The data are joined on timestamp.

func (SlackHandler) K8sAutoscale added in v1.1.0

func (n SlackHandler) K8sAutoscale() *K8sAutoscaleNode

Create a node that can trigger autoscale events for a kubernetes cluster.

func (SlackHandler) Last added in v0.13.0

func (n SlackHandler) Last(field string) *InfluxQLNode

Select the last point.

func (SlackHandler) Max added in v0.13.0

func (n SlackHandler) Max(field string) *InfluxQLNode

Select the maximum point.

func (SlackHandler) Mean added in v0.13.0

func (n SlackHandler) Mean(field string) *InfluxQLNode

Compute the mean of the data.

func (SlackHandler) Median added in v0.13.0

func (n SlackHandler) Median(field string) *InfluxQLNode

Compute the median of the data. Note, this method is not a selector, if you want the median point use `.percentile(field, 50.0)`.

func (SlackHandler) Min added in v0.13.0

func (n SlackHandler) Min(field string) *InfluxQLNode

Select the minimum point.

func (SlackHandler) Mode added in v1.0.0

func (n SlackHandler) Mode(field string) *InfluxQLNode

Compute the mode of the data.

func (SlackHandler) MovingAverage added in v1.0.0

func (n SlackHandler) MovingAverage(field string, window int64) *InfluxQLNode

Compute a moving average of the last window points. No points are emitted until the window is full.

func (SlackHandler) Percentile added in v0.13.0

func (n SlackHandler) Percentile(field string, percentile float64) *InfluxQLNode

Select a point at the given percentile. This is a selector function, no interpolation between points is performed.

func (SlackHandler) Sample added in v0.13.0

func (n SlackHandler) Sample(rate interface{}) *SampleNode

Create a new node that samples the incoming points or batches.

One point will be emitted every count or duration specified.

func (SlackHandler) Shift added in v0.13.0

func (n SlackHandler) Shift(shift time.Duration) *ShiftNode

Create a new node that shifts the incoming points or batches in time.

func (SlackHandler) Spread added in v0.13.0

func (n SlackHandler) Spread(field string) *InfluxQLNode

Compute the difference between `min` and `max` points.

func (SlackHandler) StateCount added in v1.3.0

func (n SlackHandler) StateCount(expression *ast.LambdaNode) *StateCountNode

Create a node that tracks number of consecutive points in a given state.

func (SlackHandler) StateDuration added in v1.3.0

func (n SlackHandler) StateDuration(expression *ast.LambdaNode) *StateDurationNode

Create a node that tracks duration in a given state.

func (SlackHandler) Stddev added in v0.13.0

func (n SlackHandler) Stddev(field string) *InfluxQLNode

Compute the standard deviation.

func (SlackHandler) Sum added in v0.13.0

func (n SlackHandler) Sum(field string) *InfluxQLNode

Compute the sum of all values.

func (SlackHandler) Top added in v0.13.0

func (n SlackHandler) Top(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the top `num` points for `field` and sort by any extra tags or fields.

func (SlackHandler) Union added in v0.13.0

func (n SlackHandler) Union(node ...Node) *UnionNode

Perform the union of this node and all other given nodes.

func (SlackHandler) Where added in v0.13.0

func (n SlackHandler) Where(expression *ast.LambdaNode) *WhereNode

Create a new node that filters the data stream by a given expression.

func (SlackHandler) Window added in v0.13.0

func (n SlackHandler) Window() *WindowNode

Create a new node that windows the stream by time.

NOTE: Window can only be applied to stream edges.

type StateCountNode added in v1.3.0

type StateCountNode struct {

	// Expression to determine whether state is active.
	// tick:ignore
	Lambda *ast.LambdaNode

	// The new name of the resulting duration field.
	// Default: 'state_count'
	As string
	// contains filtered or unexported fields
}

Compute the number of consecutive points in a given state. The state is defined via a lambda expression. For each consecutive point for which the expression evaluates as true, the state count will be incremented When a point evaluates as false, the state count is reset.

The state count will be added as an additional field to each point. If the expression evaluates as false, the value will be -1. If the expression generates an error during evaluation, the point is discarded, and does not affect the state count.

Example:

stream
    |from()
        .measurement('cpu')
    |where(lambda: "cpu" == 'cpu-total')
    |groupBy('host')
    |stateCount(lambda: "usage_idle" <= 10)
    |alert()
        // Warn after 1 point
        .warn(lambda: "state_count" >= 1)
        // Critical after 5 points
        .crit(lambda: "state_count" >= 5)

func (*StateCountNode) Alert added in v1.3.0

func (n *StateCountNode) Alert() *AlertNode

Create an alert node, which can trigger alerts.

func (*StateCountNode) Bottom added in v1.3.0

func (n *StateCountNode) Bottom(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the bottom `num` points for `field` and sort by any extra tags or fields.

func (*StateCountNode) Combine added in v1.3.0

func (n *StateCountNode) Combine(expressions ...*ast.LambdaNode) *CombineNode

Combine this node with itself. The data are combined on timestamp.

func (*StateCountNode) Count added in v1.3.0

func (n *StateCountNode) Count(field string) *InfluxQLNode

Count the number of points.

func (*StateCountNode) CumulativeSum added in v1.3.0

func (n *StateCountNode) CumulativeSum(field string) *InfluxQLNode

Compute a cumulative sum of each point that is received. A point is emitted for every point collected.

func (*StateCountNode) Default added in v1.3.0

func (n *StateCountNode) Default() *DefaultNode

Create a node that can set defaults for missing tags or fields.

func (*StateCountNode) Delete added in v1.3.0

func (n *StateCountNode) Delete() *DeleteNode

Create a node that can delete tags or fields.

func (*StateCountNode) Derivative added in v1.3.0

func (n *StateCountNode) Derivative(field string) *DerivativeNode

Create a new node that computes the derivative of adjacent points.

func (*StateCountNode) Difference added in v1.3.0

func (n *StateCountNode) Difference(field string) *InfluxQLNode

Compute the difference between points independent of elapsed time.

func (*StateCountNode) Distinct added in v1.3.0

func (n *StateCountNode) Distinct(field string) *InfluxQLNode

Produce batch of only the distinct points.

func (*StateCountNode) Elapsed added in v1.3.0

func (n *StateCountNode) Elapsed(field string, unit time.Duration) *InfluxQLNode

Compute the elapsed time between points

func (*StateCountNode) Eval added in v1.3.0

func (n *StateCountNode) Eval(expressions ...*ast.LambdaNode) *EvalNode

Create an eval node that will evaluate the given transformation function to each data point. A list of expressions may be provided and will be evaluated in the order they are given. The results are available to later expressions.

func (*StateCountNode) First added in v1.3.0

func (n *StateCountNode) First(field string) *InfluxQLNode

Select the first point.

func (*StateCountNode) Flatten added in v1.3.0

func (n *StateCountNode) Flatten() *FlattenNode

Flatten points with similar times into a single point.

func (*StateCountNode) GroupBy added in v1.3.0

func (n *StateCountNode) GroupBy(tag ...interface{}) *GroupByNode

Group the data by a set of tags.

Can pass literal * to group by all dimensions. Example:

|groupBy(*)

func (*StateCountNode) HoltWinters added in v1.3.0

func (n *StateCountNode) HoltWinters(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set.

func (*StateCountNode) HoltWintersWithFit added in v1.3.0

func (n *StateCountNode) HoltWintersWithFit(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set. This method also outputs all the points used to fit the data in addition to the forecasted data.

func (*StateCountNode) HttpOut added in v1.3.0

func (n *StateCountNode) HttpOut(endpoint string) *HTTPOutNode

Create an HTTP output node that caches the most recent data it has received. The cached data are available at the given endpoint. The endpoint is the relative path from the API endpoint of the running task. For example, if the task endpoint is at `/kapacitor/v1/tasks/<task_id>` and endpoint is `top10`, then the data can be requested from `/kapacitor/v1/tasks/<task_id>/top10`.

func (*StateCountNode) HttpPost added in v1.3.0

func (n *StateCountNode) HttpPost(url string) *HTTPPostNode

Creates an HTTP Post node that POSTS received data to the provided HTTP endpoint.

func (*StateCountNode) InfluxDBOut added in v1.3.0

func (n *StateCountNode) InfluxDBOut() *InfluxDBOutNode

Create an influxdb output node that will store the incoming data into InfluxDB.

func (*StateCountNode) Join added in v1.3.0

func (n *StateCountNode) Join(others ...Node) *JoinNode

Join this node with other nodes. The data are joined on timestamp.

func (*StateCountNode) K8sAutoscale added in v1.3.0

func (n *StateCountNode) K8sAutoscale() *K8sAutoscaleNode

Create a node that can trigger autoscale events for a kubernetes cluster.

func (*StateCountNode) Last added in v1.3.0

func (n *StateCountNode) Last(field string) *InfluxQLNode

Select the last point.

func (*StateCountNode) Log added in v1.3.0

func (n *StateCountNode) Log() *LogNode

Create a node that logs all data it receives.

func (*StateCountNode) Max added in v1.3.0

func (n *StateCountNode) Max(field string) *InfluxQLNode

Select the maximum point.

func (*StateCountNode) Mean added in v1.3.0

func (n *StateCountNode) Mean(field string) *InfluxQLNode

Compute the mean of the data.

func (*StateCountNode) Median added in v1.3.0

func (n *StateCountNode) Median(field string) *InfluxQLNode

Compute the median of the data. Note, this method is not a selector, if you want the median point use `.percentile(field, 50.0)`.

func (*StateCountNode) Min added in v1.3.0

func (n *StateCountNode) Min(field string) *InfluxQLNode

Select the minimum point.

func (*StateCountNode) Mode added in v1.3.0

func (n *StateCountNode) Mode(field string) *InfluxQLNode

Compute the mode of the data.

func (*StateCountNode) MovingAverage added in v1.3.0

func (n *StateCountNode) MovingAverage(field string, window int64) *InfluxQLNode

Compute a moving average of the last window points. No points are emitted until the window is full.

func (*StateCountNode) Percentile added in v1.3.0

func (n *StateCountNode) Percentile(field string, percentile float64) *InfluxQLNode

Select a point at the given percentile. This is a selector function, no interpolation between points is performed.

func (*StateCountNode) Sample added in v1.3.0

func (n *StateCountNode) Sample(rate interface{}) *SampleNode

Create a new node that samples the incoming points or batches.

One point will be emitted every count or duration specified.

func (*StateCountNode) Shift added in v1.3.0

func (n *StateCountNode) Shift(shift time.Duration) *ShiftNode

Create a new node that shifts the incoming points or batches in time.

func (*StateCountNode) Spread added in v1.3.0

func (n *StateCountNode) Spread(field string) *InfluxQLNode

Compute the difference between `min` and `max` points.

func (*StateCountNode) StateCount added in v1.3.0

func (n *StateCountNode) StateCount(expression *ast.LambdaNode) *StateCountNode

Create a node that tracks number of consecutive points in a given state.

func (*StateCountNode) StateDuration added in v1.3.0

func (n *StateCountNode) StateDuration(expression *ast.LambdaNode) *StateDurationNode

Create a node that tracks duration in a given state.

func (*StateCountNode) Stddev added in v1.3.0

func (n *StateCountNode) Stddev(field string) *InfluxQLNode

Compute the standard deviation.

func (*StateCountNode) Sum added in v1.3.0

func (n *StateCountNode) Sum(field string) *InfluxQLNode

Compute the sum of all values.

func (*StateCountNode) Top added in v1.3.0

func (n *StateCountNode) Top(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the top `num` points for `field` and sort by any extra tags or fields.

func (*StateCountNode) Union added in v1.3.0

func (n *StateCountNode) Union(node ...Node) *UnionNode

Perform the union of this node and all other given nodes.

func (*StateCountNode) Where added in v1.3.0

func (n *StateCountNode) Where(expression *ast.LambdaNode) *WhereNode

Create a new node that filters the data stream by a given expression.

func (*StateCountNode) Window added in v1.3.0

func (n *StateCountNode) Window() *WindowNode

Create a new node that windows the stream by time.

NOTE: Window can only be applied to stream edges.

type StateDurationNode added in v1.3.0

type StateDurationNode struct {

	// Expression to determine whether state is active.
	// tick:ignore
	Lambda *ast.LambdaNode

	// The new name of the resulting duration field.
	// Default: 'state_duration'
	As string

	// The time unit of the resulting duration value.
	// Default: 1s.
	Unit time.Duration
	// contains filtered or unexported fields
}

Compute the duration of a given state. The state is defined via a lambda expression. For each consecutive point for which the expression evaluates as true, the state duration will be incremented by the duration between points. When a point evaluates as false, the state duration is reset.

The state duration will be added as an additional field to each point. If the expression evaluates as false, the value will be -1. If the expression generates an error during evaluation, the point is discarded, and does not affect the state duration.

Example:

stream
    |from()
        .measurement('cpu')
    |where(lambda: "cpu" == 'cpu-total')
    |groupBy('host')
    |stateDuration(lambda: "usage_idle" <= 10)
        .unit(1m)
    |alert()
        // Warn after 1 minute
        .warn(lambda: "state_duration" >= 1)
        // Critical after 5 minutes
        .crit(lambda: "state_duration" >= 5)

Note that as the first point in the given state has no previous point, its state duration will be 0.

func (*StateDurationNode) Alert added in v1.3.0

func (n *StateDurationNode) Alert() *AlertNode

Create an alert node, which can trigger alerts.

func (*StateDurationNode) Bottom added in v1.3.0

func (n *StateDurationNode) Bottom(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the bottom `num` points for `field` and sort by any extra tags or fields.

func (*StateDurationNode) Combine added in v1.3.0

func (n *StateDurationNode) Combine(expressions ...*ast.LambdaNode) *CombineNode

Combine this node with itself. The data are combined on timestamp.

func (*StateDurationNode) Count added in v1.3.0

func (n *StateDurationNode) Count(field string) *InfluxQLNode

Count the number of points.

func (*StateDurationNode) CumulativeSum added in v1.3.0

func (n *StateDurationNode) CumulativeSum(field string) *InfluxQLNode

Compute a cumulative sum of each point that is received. A point is emitted for every point collected.

func (*StateDurationNode) Default added in v1.3.0

func (n *StateDurationNode) Default() *DefaultNode

Create a node that can set defaults for missing tags or fields.

func (*StateDurationNode) Delete added in v1.3.0

func (n *StateDurationNode) Delete() *DeleteNode

Create a node that can delete tags or fields.

func (*StateDurationNode) Derivative added in v1.3.0

func (n *StateDurationNode) Derivative(field string) *DerivativeNode

Create a new node that computes the derivative of adjacent points.

func (*StateDurationNode) Difference added in v1.3.0

func (n *StateDurationNode) Difference(field string) *InfluxQLNode

Compute the difference between points independent of elapsed time.

func (*StateDurationNode) Distinct added in v1.3.0

func (n *StateDurationNode) Distinct(field string) *InfluxQLNode

Produce batch of only the distinct points.

func (*StateDurationNode) Elapsed added in v1.3.0

func (n *StateDurationNode) Elapsed(field string, unit time.Duration) *InfluxQLNode

Compute the elapsed time between points

func (*StateDurationNode) Eval added in v1.3.0

func (n *StateDurationNode) Eval(expressions ...*ast.LambdaNode) *EvalNode

Create an eval node that will evaluate the given transformation function to each data point. A list of expressions may be provided and will be evaluated in the order they are given. The results are available to later expressions.

func (*StateDurationNode) First added in v1.3.0

func (n *StateDurationNode) First(field string) *InfluxQLNode

Select the first point.

func (*StateDurationNode) Flatten added in v1.3.0

func (n *StateDurationNode) Flatten() *FlattenNode

Flatten points with similar times into a single point.

func (*StateDurationNode) GroupBy added in v1.3.0

func (n *StateDurationNode) GroupBy(tag ...interface{}) *GroupByNode

Group the data by a set of tags.

Can pass literal * to group by all dimensions. Example:

|groupBy(*)

func (*StateDurationNode) HoltWinters added in v1.3.0

func (n *StateDurationNode) HoltWinters(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set.

func (*StateDurationNode) HoltWintersWithFit added in v1.3.0

func (n *StateDurationNode) HoltWintersWithFit(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set. This method also outputs all the points used to fit the data in addition to the forecasted data.

func (*StateDurationNode) HttpOut added in v1.3.0

func (n *StateDurationNode) HttpOut(endpoint string) *HTTPOutNode

Create an HTTP output node that caches the most recent data it has received. The cached data are available at the given endpoint. The endpoint is the relative path from the API endpoint of the running task. For example, if the task endpoint is at `/kapacitor/v1/tasks/<task_id>` and endpoint is `top10`, then the data can be requested from `/kapacitor/v1/tasks/<task_id>/top10`.

func (*StateDurationNode) HttpPost added in v1.3.0

func (n *StateDurationNode) HttpPost(url string) *HTTPPostNode

Creates an HTTP Post node that POSTS received data to the provided HTTP endpoint.

func (*StateDurationNode) InfluxDBOut added in v1.3.0

func (n *StateDurationNode) InfluxDBOut() *InfluxDBOutNode

Create an influxdb output node that will store the incoming data into InfluxDB.

func (*StateDurationNode) Join added in v1.3.0

func (n *StateDurationNode) Join(others ...Node) *JoinNode

Join this node with other nodes. The data are joined on timestamp.

func (*StateDurationNode) K8sAutoscale added in v1.3.0

func (n *StateDurationNode) K8sAutoscale() *K8sAutoscaleNode

Create a node that can trigger autoscale events for a kubernetes cluster.

func (*StateDurationNode) Last added in v1.3.0

func (n *StateDurationNode) Last(field string) *InfluxQLNode

Select the last point.

func (*StateDurationNode) Log added in v1.3.0

func (n *StateDurationNode) Log() *LogNode

Create a node that logs all data it receives.

func (*StateDurationNode) Max added in v1.3.0

func (n *StateDurationNode) Max(field string) *InfluxQLNode

Select the maximum point.

func (*StateDurationNode) Mean added in v1.3.0

func (n *StateDurationNode) Mean(field string) *InfluxQLNode

Compute the mean of the data.

func (*StateDurationNode) Median added in v1.3.0

func (n *StateDurationNode) Median(field string) *InfluxQLNode

Compute the median of the data. Note, this method is not a selector, if you want the median point use `.percentile(field, 50.0)`.

func (*StateDurationNode) Min added in v1.3.0

func (n *StateDurationNode) Min(field string) *InfluxQLNode

Select the minimum point.

func (*StateDurationNode) Mode added in v1.3.0

func (n *StateDurationNode) Mode(field string) *InfluxQLNode

Compute the mode of the data.

func (*StateDurationNode) MovingAverage added in v1.3.0

func (n *StateDurationNode) MovingAverage(field string, window int64) *InfluxQLNode

Compute a moving average of the last window points. No points are emitted until the window is full.

func (*StateDurationNode) Percentile added in v1.3.0

func (n *StateDurationNode) Percentile(field string, percentile float64) *InfluxQLNode

Select a point at the given percentile. This is a selector function, no interpolation between points is performed.

func (*StateDurationNode) Sample added in v1.3.0

func (n *StateDurationNode) Sample(rate interface{}) *SampleNode

Create a new node that samples the incoming points or batches.

One point will be emitted every count or duration specified.

func (*StateDurationNode) Shift added in v1.3.0

func (n *StateDurationNode) Shift(shift time.Duration) *ShiftNode

Create a new node that shifts the incoming points or batches in time.

func (*StateDurationNode) Spread added in v1.3.0

func (n *StateDurationNode) Spread(field string) *InfluxQLNode

Compute the difference between `min` and `max` points.

func (*StateDurationNode) StateCount added in v1.3.0

func (n *StateDurationNode) StateCount(expression *ast.LambdaNode) *StateCountNode

Create a node that tracks number of consecutive points in a given state.

func (*StateDurationNode) StateDuration added in v1.3.0

func (n *StateDurationNode) StateDuration(expression *ast.LambdaNode) *StateDurationNode

Create a node that tracks duration in a given state.

func (*StateDurationNode) Stddev added in v1.3.0

func (n *StateDurationNode) Stddev(field string) *InfluxQLNode

Compute the standard deviation.

func (*StateDurationNode) Sum added in v1.3.0

func (n *StateDurationNode) Sum(field string) *InfluxQLNode

Compute the sum of all values.

func (*StateDurationNode) Top added in v1.3.0

func (n *StateDurationNode) Top(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the top `num` points for `field` and sort by any extra tags or fields.

func (*StateDurationNode) Union added in v1.3.0

func (n *StateDurationNode) Union(node ...Node) *UnionNode

Perform the union of this node and all other given nodes.

func (*StateDurationNode) Where added in v1.3.0

func (n *StateDurationNode) Where(expression *ast.LambdaNode) *WhereNode

Create a new node that filters the data stream by a given expression.

func (*StateDurationNode) Window added in v1.3.0

func (n *StateDurationNode) Window() *WindowNode

Create a new node that windows the stream by time.

NOTE: Window can only be applied to stream edges.

type StatsNode added in v0.10.0

type StatsNode struct {

	// tick:ignore
	SourceNode Node
	// tick:ignore
	Interval time.Duration

	// tick:ignore
	AlignFlag bool `tick:"Align"`
	// contains filtered or unexported fields
}

A StatsNode emits internal statistics about the another node at a given interval.

The interval represents how often to emit the statistics based on real time. This means the interval time is independent of the times of the data points the other node is receiving. As a result the StatsNode is a root node in the task pipeline.

The currently available internal statistics:

  • emitted -- the number of points or batches this node has sent to its children.

Each stat is available as a field in the data stream.

The stats are in groups according to the original data. Meaning that if the source node is grouped by the tag 'host' as an example, then the counts are output per host with the appropriate 'host' tag. Since its possible for groups to change when crossing a node only the emitted groups are considered.

Example:

var data = stream
    |from()...
// Emit statistics every 1 minute and cache them via the HTTP API.
data
    |stats(1m)
    |httpOut('stats')
// Continue normal processing of the data stream
data...

WARNING: It is not recommended to join the stats stream with the original data stream. Since they operate on different clocks you could potentially create a deadlock. This is a limitation of the current implementation and may be removed in the future.

func (*StatsNode) Alert added in v0.10.0

func (n *StatsNode) Alert() *AlertNode

Create an alert node, which can trigger alerts.

func (*StatsNode) Align added in v1.0.0

func (n *StatsNode) Align() *StatsNode

Round times to the StatsNode.Interval value. tick:property

func (*StatsNode) Bottom added in v0.11.0

func (n *StatsNode) Bottom(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the bottom `num` points for `field` and sort by any extra tags or fields.

func (*StatsNode) Combine added in v1.0.0

func (n *StatsNode) Combine(expressions ...*ast.LambdaNode) *CombineNode

Combine this node with itself. The data are combined on timestamp.

func (*StatsNode) Count added in v0.11.0

func (n *StatsNode) Count(field string) *InfluxQLNode

Count the number of points.

func (*StatsNode) CumulativeSum added in v1.1.0

func (n *StatsNode) CumulativeSum(field string) *InfluxQLNode

Compute a cumulative sum of each point that is received. A point is emitted for every point collected.

func (*StatsNode) Default added in v0.13.0

func (n *StatsNode) Default() *DefaultNode

Create a node that can set defaults for missing tags or fields.

func (*StatsNode) Delete added in v1.0.0

func (n *StatsNode) Delete() *DeleteNode

Create a node that can delete tags or fields.

func (*StatsNode) Derivative added in v0.10.0

func (n *StatsNode) Derivative(field string) *DerivativeNode

Create a new node that computes the derivative of adjacent points.

func (*StatsNode) Difference added in v1.0.0

func (n *StatsNode) Difference(field string) *InfluxQLNode

Compute the difference between points independent of elapsed time.

func (*StatsNode) Distinct added in v0.11.0

func (n *StatsNode) Distinct(field string) *InfluxQLNode

Produce batch of only the distinct points.

func (*StatsNode) Elapsed added in v0.13.0

func (n *StatsNode) Elapsed(field string, unit time.Duration) *InfluxQLNode

Compute the elapsed time between points

func (*StatsNode) Eval added in v0.10.0

func (n *StatsNode) Eval(expressions ...*ast.LambdaNode) *EvalNode

Create an eval node that will evaluate the given transformation function to each data point. A list of expressions may be provided and will be evaluated in the order they are given. The results are available to later expressions.

func (*StatsNode) First added in v0.11.0

func (n *StatsNode) First(field string) *InfluxQLNode

Select the first point.

func (*StatsNode) Flatten added in v1.0.0

func (n *StatsNode) Flatten() *FlattenNode

Flatten points with similar times into a single point.

func (*StatsNode) GroupBy added in v0.10.0

func (n *StatsNode) GroupBy(tag ...interface{}) *GroupByNode

Group the data by a set of tags.

Can pass literal * to group by all dimensions. Example:

|groupBy(*)

func (*StatsNode) HoltWinters added in v1.0.0

func (n *StatsNode) HoltWinters(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set.

func (*StatsNode) HoltWintersWithFit added in v1.0.0

func (n *StatsNode) HoltWintersWithFit(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set. This method also outputs all the points used to fit the data in addition to the forecasted data.

func (*StatsNode) HttpOut added in v0.10.0

func (n *StatsNode) HttpOut(endpoint string) *HTTPOutNode

Create an HTTP output node that caches the most recent data it has received. The cached data are available at the given endpoint. The endpoint is the relative path from the API endpoint of the running task. For example, if the task endpoint is at `/kapacitor/v1/tasks/<task_id>` and endpoint is `top10`, then the data can be requested from `/kapacitor/v1/tasks/<task_id>/top10`.

func (*StatsNode) HttpPost added in v1.3.0

func (n *StatsNode) HttpPost(url string) *HTTPPostNode

Creates an HTTP Post node that POSTS received data to the provided HTTP endpoint.

func (*StatsNode) InfluxDBOut added in v0.10.0

func (n *StatsNode) InfluxDBOut() *InfluxDBOutNode

Create an influxdb output node that will store the incoming data into InfluxDB.

func (*StatsNode) Join added in v0.10.0

func (n *StatsNode) Join(others ...Node) *JoinNode

Join this node with other nodes. The data are joined on timestamp.

func (*StatsNode) K8sAutoscale added in v1.1.0

func (n *StatsNode) K8sAutoscale() *K8sAutoscaleNode

Create a node that can trigger autoscale events for a kubernetes cluster.

func (*StatsNode) Last added in v0.11.0

func (n *StatsNode) Last(field string) *InfluxQLNode

Select the last point.

func (*StatsNode) Log added in v0.11.0

func (n *StatsNode) Log() *LogNode

Create a node that logs all data it receives.

func (*StatsNode) Max added in v0.11.0

func (n *StatsNode) Max(field string) *InfluxQLNode

Select the maximum point.

func (*StatsNode) Mean added in v0.11.0

func (n *StatsNode) Mean(field string) *InfluxQLNode

Compute the mean of the data.

func (*StatsNode) Median added in v0.11.0

func (n *StatsNode) Median(field string) *InfluxQLNode

Compute the median of the data. Note, this method is not a selector, if you want the median point use `.percentile(field, 50.0)`.

func (*StatsNode) Min added in v0.11.0

func (n *StatsNode) Min(field string) *InfluxQLNode

Select the minimum point.

func (*StatsNode) Mode added in v1.0.0

func (n *StatsNode) Mode(field string) *InfluxQLNode

Compute the mode of the data.

func (*StatsNode) MovingAverage added in v1.0.0

func (n *StatsNode) MovingAverage(field string, window int64) *InfluxQLNode

Compute a moving average of the last window points. No points are emitted until the window is full.

func (*StatsNode) Percentile added in v0.11.0

func (n *StatsNode) Percentile(field string, percentile float64) *InfluxQLNode

Select a point at the given percentile. This is a selector function, no interpolation between points is performed.

func (*StatsNode) Sample added in v0.10.0

func (n *StatsNode) Sample(rate interface{}) *SampleNode

Create a new node that samples the incoming points or batches.

One point will be emitted every count or duration specified.

func (*StatsNode) Shift added in v0.11.0

func (n *StatsNode) Shift(shift time.Duration) *ShiftNode

Create a new node that shifts the incoming points or batches in time.

func (*StatsNode) Spread added in v0.11.0

func (n *StatsNode) Spread(field string) *InfluxQLNode

Compute the difference between `min` and `max` points.

func (*StatsNode) StateCount added in v1.3.0

func (n *StatsNode) StateCount(expression *ast.LambdaNode) *StateCountNode

Create a node that tracks number of consecutive points in a given state.

func (*StatsNode) StateDuration added in v1.3.0

func (n *StatsNode) StateDuration(expression *ast.LambdaNode) *StateDurationNode

Create a node that tracks duration in a given state.

func (*StatsNode) Stddev added in v0.11.0

func (n *StatsNode) Stddev(field string) *InfluxQLNode

Compute the standard deviation.

func (*StatsNode) Sum added in v0.11.0

func (n *StatsNode) Sum(field string) *InfluxQLNode

Compute the sum of all values.

func (*StatsNode) Top added in v0.11.0

func (n *StatsNode) Top(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the top `num` points for `field` and sort by any extra tags or fields.

func (*StatsNode) Union added in v0.10.0

func (n *StatsNode) Union(node ...Node) *UnionNode

Perform the union of this node and all other given nodes.

func (*StatsNode) Where added in v0.10.0

func (n *StatsNode) Where(expression *ast.LambdaNode) *WhereNode

Create a new node that filters the data stream by a given expression.

func (*StatsNode) Window added in v0.10.0

func (n *StatsNode) Window() *WindowNode

Create a new node that windows the stream by time.

NOTE: Window can only be applied to stream edges.

type StreamNode

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

A StreamNode represents the source of data being streamed to Kapacitor via any of its inputs. The `stream` variable in stream tasks is an instance of a StreamNode. StreamNode.From is the method/property of this node.

func (*StreamNode) Children added in v0.13.0

func (n *StreamNode) Children() []Node

tick:ignore

func (*StreamNode) Deadman added in v0.13.0

func (n *StreamNode) Deadman(threshold float64, interval time.Duration, expr ...*ast.LambdaNode) *AlertNode

Helper function for creating an alert on low throughput, a.k.a. deadman's switch.

- Threshold -- trigger alert if throughput drops below threshold in points/interval. - Interval -- how often to check the throughput. - Expressions -- optional list of expressions to also evaluate. Useful for time of day alerting.

Example:

var data = stream
    |from()...
// Trigger critical alert if the throughput drops below 100 points per 10s and checked every 10s.
data
    |deadman(100.0, 10s)
//Do normal processing of data
data...

The above is equivalent to this Example:

var data = stream
    |from()...
// Trigger critical alert if the throughput drops below 100 points per 10s and checked every 10s.
data
    |stats(10s)
        .align()
    |derivative('emitted')
        .unit(10s)
        .nonNegative()
    |alert()
        .id('node \'stream0\' in task \'{{ .TaskName }}\'')
        .message('{{ .ID }} is {{ if eq .Level "OK" }}alive{{ else }}dead{{ end }}: {{ index .Fields "emitted" | printf "%0.3f" }} points/10s.')
        .crit(lambda: "emitted" <= 100.0)
//Do normal processing of data
data...

The `id` and `message` alert properties can be configured globally via the 'deadman' configuration section.

Since the AlertNode is the last piece it can be further modified as usual. Example:

var data = stream
    |from()...
// Trigger critical alert if the throughput drops below 100 points per 10s and checked every 10s.
data
    |deadman(100.0, 10s)
        .slack()
        .channel('#dead_tasks')
//Do normal processing of data
data...

You can specify additional lambda expressions to further constrain when the deadman's switch is triggered. Example:

var data = stream
    |from()...
// Trigger critical alert if the throughput drops below 100 points per 10s and checked every 10s.
// Only trigger the alert if the time of day is between 8am-5pm.
data
    |deadman(100.0, 10s, lambda: hour("time") >= 8 AND hour("time") <= 17)
//Do normal processing of data
data...

func (*StreamNode) Desc added in v0.13.0

func (n *StreamNode) Desc() string

tick:ignore

func (*StreamNode) From

func (s *StreamNode) From() *FromNode

Creates a new FromNode that can be further filtered using the Database, RetentionPolicy, Measurement and Where properties. From can be called multiple times to create multiple independent forks of the data stream.

Example:

// Select the 'cpu' measurement from just the database 'mydb'
// and retention policy 'myrp'.
var cpu = stream
    |from()
        .database('mydb')
        .retentionPolicy('myrp')
        .measurement('cpu')
// Select the 'load' measurement from any database and retention policy.
var load = stream
    |from()
        .measurement('load')
// Join cpu and load streams and do further processing.
cpu
    |join(load)
        .as('cpu', 'load')
    ...

func (*StreamNode) ID added in v0.13.0

func (n *StreamNode) ID() ID

tick:ignore

func (*StreamNode) Name added in v0.13.0

func (n *StreamNode) Name() string

tick:ignore

func (*StreamNode) Parents added in v0.13.0

func (n *StreamNode) Parents() []Node

tick:ignore

func (*StreamNode) Provides added in v0.13.0

func (n *StreamNode) Provides() EdgeType

tick:ignore

func (*StreamNode) SetName added in v0.13.0

func (n *StreamNode) SetName(name string)

tick:ignore

func (*StreamNode) Stats added in v0.13.0

func (n *StreamNode) Stats(interval time.Duration) *StatsNode

Create a new stream of data that contains the internal statistics of the node. The interval represents how often to emit the statistics based on real time. This means the interval time is independent of the times of the data points the source node is receiving.

func (*StreamNode) Wants added in v0.13.0

func (n *StreamNode) Wants() EdgeType

tick:ignore

type StringBulkPointAggregator added in v1.0.0

type StringBulkPointAggregator interface {
	influxql.StringPointAggregator
	influxql.StringBulkPointAggregator
}

type TalkHandler added in v0.10.1

type TalkHandler struct {
	*AlertNode
}

tick:embedded:AlertNode.Talk

func (TalkHandler) Alert added in v0.13.0

func (n TalkHandler) Alert() *AlertNode

Create an alert node, which can trigger alerts.

func (TalkHandler) Bottom added in v0.13.0

func (n TalkHandler) Bottom(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the bottom `num` points for `field` and sort by any extra tags or fields.

func (TalkHandler) Combine added in v1.0.0

func (n TalkHandler) Combine(expressions ...*ast.LambdaNode) *CombineNode

Combine this node with itself. The data are combined on timestamp.

func (TalkHandler) Count added in v0.13.0

func (n TalkHandler) Count(field string) *InfluxQLNode

Count the number of points.

func (TalkHandler) CumulativeSum added in v1.1.0

func (n TalkHandler) CumulativeSum(field string) *InfluxQLNode

Compute a cumulative sum of each point that is received. A point is emitted for every point collected.

func (TalkHandler) Default added in v0.13.0

func (n TalkHandler) Default() *DefaultNode

Create a node that can set defaults for missing tags or fields.

func (TalkHandler) Delete added in v1.0.0

func (n TalkHandler) Delete() *DeleteNode

Create a node that can delete tags or fields.

func (TalkHandler) Derivative added in v0.13.0

func (n TalkHandler) Derivative(field string) *DerivativeNode

Create a new node that computes the derivative of adjacent points.

func (TalkHandler) Difference added in v1.0.0

func (n TalkHandler) Difference(field string) *InfluxQLNode

Compute the difference between points independent of elapsed time.

func (TalkHandler) Distinct added in v0.13.0

func (n TalkHandler) Distinct(field string) *InfluxQLNode

Produce batch of only the distinct points.

func (TalkHandler) Elapsed added in v0.13.0

func (n TalkHandler) Elapsed(field string, unit time.Duration) *InfluxQLNode

Compute the elapsed time between points

func (TalkHandler) Eval added in v0.13.0

func (n TalkHandler) Eval(expressions ...*ast.LambdaNode) *EvalNode

Create an eval node that will evaluate the given transformation function to each data point. A list of expressions may be provided and will be evaluated in the order they are given. The results are available to later expressions.

func (TalkHandler) First added in v0.13.0

func (n TalkHandler) First(field string) *InfluxQLNode

Select the first point.

func (TalkHandler) Flatten added in v1.0.0

func (n TalkHandler) Flatten() *FlattenNode

Flatten points with similar times into a single point.

func (TalkHandler) GroupBy added in v0.13.0

func (n TalkHandler) GroupBy(tag ...interface{}) *GroupByNode

Group the data by a set of tags.

Can pass literal * to group by all dimensions. Example:

|groupBy(*)

func (TalkHandler) HoltWinters added in v1.0.0

func (n TalkHandler) HoltWinters(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set.

func (TalkHandler) HoltWintersWithFit added in v1.0.0

func (n TalkHandler) HoltWintersWithFit(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set. This method also outputs all the points used to fit the data in addition to the forecasted data.

func (TalkHandler) HttpOut added in v0.13.0

func (n TalkHandler) HttpOut(endpoint string) *HTTPOutNode

Create an HTTP output node that caches the most recent data it has received. The cached data are available at the given endpoint. The endpoint is the relative path from the API endpoint of the running task. For example, if the task endpoint is at `/kapacitor/v1/tasks/<task_id>` and endpoint is `top10`, then the data can be requested from `/kapacitor/v1/tasks/<task_id>/top10`.

func (TalkHandler) HttpPost added in v1.3.0

func (n TalkHandler) HttpPost(url string) *HTTPPostNode

Creates an HTTP Post node that POSTS received data to the provided HTTP endpoint.

func (TalkHandler) InfluxDBOut added in v0.13.0

func (n TalkHandler) InfluxDBOut() *InfluxDBOutNode

Create an influxdb output node that will store the incoming data into InfluxDB.

func (TalkHandler) Join added in v0.13.0

func (n TalkHandler) Join(others ...Node) *JoinNode

Join this node with other nodes. The data are joined on timestamp.

func (TalkHandler) K8sAutoscale added in v1.1.0

func (n TalkHandler) K8sAutoscale() *K8sAutoscaleNode

Create a node that can trigger autoscale events for a kubernetes cluster.

func (TalkHandler) Last added in v0.13.0

func (n TalkHandler) Last(field string) *InfluxQLNode

Select the last point.

func (TalkHandler) Max added in v0.13.0

func (n TalkHandler) Max(field string) *InfluxQLNode

Select the maximum point.

func (TalkHandler) Mean added in v0.13.0

func (n TalkHandler) Mean(field string) *InfluxQLNode

Compute the mean of the data.

func (TalkHandler) Median added in v0.13.0

func (n TalkHandler) Median(field string) *InfluxQLNode

Compute the median of the data. Note, this method is not a selector, if you want the median point use `.percentile(field, 50.0)`.

func (TalkHandler) Min added in v0.13.0

func (n TalkHandler) Min(field string) *InfluxQLNode

Select the minimum point.

func (TalkHandler) Mode added in v1.0.0

func (n TalkHandler) Mode(field string) *InfluxQLNode

Compute the mode of the data.

func (TalkHandler) MovingAverage added in v1.0.0

func (n TalkHandler) MovingAverage(field string, window int64) *InfluxQLNode

Compute a moving average of the last window points. No points are emitted until the window is full.

func (TalkHandler) Percentile added in v0.13.0

func (n TalkHandler) Percentile(field string, percentile float64) *InfluxQLNode

Select a point at the given percentile. This is a selector function, no interpolation between points is performed.

func (TalkHandler) Sample added in v0.13.0

func (n TalkHandler) Sample(rate interface{}) *SampleNode

Create a new node that samples the incoming points or batches.

One point will be emitted every count or duration specified.

func (TalkHandler) Shift added in v0.13.0

func (n TalkHandler) Shift(shift time.Duration) *ShiftNode

Create a new node that shifts the incoming points or batches in time.

func (TalkHandler) Spread added in v0.13.0

func (n TalkHandler) Spread(field string) *InfluxQLNode

Compute the difference between `min` and `max` points.

func (TalkHandler) StateCount added in v1.3.0

func (n TalkHandler) StateCount(expression *ast.LambdaNode) *StateCountNode

Create a node that tracks number of consecutive points in a given state.

func (TalkHandler) StateDuration added in v1.3.0

func (n TalkHandler) StateDuration(expression *ast.LambdaNode) *StateDurationNode

Create a node that tracks duration in a given state.

func (TalkHandler) Stddev added in v0.13.0

func (n TalkHandler) Stddev(field string) *InfluxQLNode

Compute the standard deviation.

func (TalkHandler) Sum added in v0.13.0

func (n TalkHandler) Sum(field string) *InfluxQLNode

Compute the sum of all values.

func (TalkHandler) Top added in v0.13.0

func (n TalkHandler) Top(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the top `num` points for `field` and sort by any extra tags or fields.

func (TalkHandler) Union added in v0.13.0

func (n TalkHandler) Union(node ...Node) *UnionNode

Perform the union of this node and all other given nodes.

func (TalkHandler) Where added in v0.13.0

func (n TalkHandler) Where(expression *ast.LambdaNode) *WhereNode

Create a new node that filters the data stream by a given expression.

func (TalkHandler) Window added in v0.13.0

func (n TalkHandler) Window() *WindowNode

Create a new node that windows the stream by time.

NOTE: Window can only be applied to stream edges.

type TcpHandler added in v1.0.1

type TcpHandler struct {
	*AlertNode

	// The endpoint address.
	Address string
}

tick:embedded:AlertNode.Tcp

func (TcpHandler) Alert added in v1.0.1

func (n TcpHandler) Alert() *AlertNode

Create an alert node, which can trigger alerts.

func (TcpHandler) Bottom added in v1.0.1

func (n TcpHandler) Bottom(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the bottom `num` points for `field` and sort by any extra tags or fields.

func (TcpHandler) Combine added in v1.0.1

func (n TcpHandler) Combine(expressions ...*ast.LambdaNode) *CombineNode

Combine this node with itself. The data are combined on timestamp.

func (TcpHandler) Count added in v1.0.1

func (n TcpHandler) Count(field string) *InfluxQLNode

Count the number of points.

func (TcpHandler) CumulativeSum added in v1.1.0

func (n TcpHandler) CumulativeSum(field string) *InfluxQLNode

Compute a cumulative sum of each point that is received. A point is emitted for every point collected.

func (TcpHandler) Default added in v1.0.1

func (n TcpHandler) Default() *DefaultNode

Create a node that can set defaults for missing tags or fields.

func (TcpHandler) Delete added in v1.0.1

func (n TcpHandler) Delete() *DeleteNode

Create a node that can delete tags or fields.

func (TcpHandler) Derivative added in v1.0.1

func (n TcpHandler) Derivative(field string) *DerivativeNode

Create a new node that computes the derivative of adjacent points.

func (TcpHandler) Difference added in v1.0.1

func (n TcpHandler) Difference(field string) *InfluxQLNode

Compute the difference between points independent of elapsed time.

func (TcpHandler) Distinct added in v1.0.1

func (n TcpHandler) Distinct(field string) *InfluxQLNode

Produce batch of only the distinct points.

func (TcpHandler) Elapsed added in v1.0.1

func (n TcpHandler) Elapsed(field string, unit time.Duration) *InfluxQLNode

Compute the elapsed time between points

func (TcpHandler) Eval added in v1.0.1

func (n TcpHandler) Eval(expressions ...*ast.LambdaNode) *EvalNode

Create an eval node that will evaluate the given transformation function to each data point. A list of expressions may be provided and will be evaluated in the order they are given. The results are available to later expressions.

func (TcpHandler) First added in v1.0.1

func (n TcpHandler) First(field string) *InfluxQLNode

Select the first point.

func (TcpHandler) Flatten added in v1.0.1

func (n TcpHandler) Flatten() *FlattenNode

Flatten points with similar times into a single point.

func (TcpHandler) GroupBy added in v1.0.1

func (n TcpHandler) GroupBy(tag ...interface{}) *GroupByNode

Group the data by a set of tags.

Can pass literal * to group by all dimensions. Example:

|groupBy(*)

func (TcpHandler) HoltWinters added in v1.0.1

func (n TcpHandler) HoltWinters(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set.

func (TcpHandler) HoltWintersWithFit added in v1.0.1

func (n TcpHandler) HoltWintersWithFit(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set. This method also outputs all the points used to fit the data in addition to the forecasted data.

func (TcpHandler) HttpOut added in v1.0.1

func (n TcpHandler) HttpOut(endpoint string) *HTTPOutNode

Create an HTTP output node that caches the most recent data it has received. The cached data are available at the given endpoint. The endpoint is the relative path from the API endpoint of the running task. For example, if the task endpoint is at `/kapacitor/v1/tasks/<task_id>` and endpoint is `top10`, then the data can be requested from `/kapacitor/v1/tasks/<task_id>/top10`.

func (TcpHandler) HttpPost added in v1.3.0

func (n TcpHandler) HttpPost(url string) *HTTPPostNode

Creates an HTTP Post node that POSTS received data to the provided HTTP endpoint.

func (TcpHandler) InfluxDBOut added in v1.0.1

func (n TcpHandler) InfluxDBOut() *InfluxDBOutNode

Create an influxdb output node that will store the incoming data into InfluxDB.

func (TcpHandler) Join added in v1.0.1

func (n TcpHandler) Join(others ...Node) *JoinNode

Join this node with other nodes. The data are joined on timestamp.

func (TcpHandler) K8sAutoscale added in v1.1.0

func (n TcpHandler) K8sAutoscale() *K8sAutoscaleNode

Create a node that can trigger autoscale events for a kubernetes cluster.

func (TcpHandler) Last added in v1.0.1

func (n TcpHandler) Last(field string) *InfluxQLNode

Select the last point.

func (TcpHandler) Max added in v1.0.1

func (n TcpHandler) Max(field string) *InfluxQLNode

Select the maximum point.

func (TcpHandler) Mean added in v1.0.1

func (n TcpHandler) Mean(field string) *InfluxQLNode

Compute the mean of the data.

func (TcpHandler) Median added in v1.0.1

func (n TcpHandler) Median(field string) *InfluxQLNode

Compute the median of the data. Note, this method is not a selector, if you want the median point use `.percentile(field, 50.0)`.

func (TcpHandler) Min added in v1.0.1

func (n TcpHandler) Min(field string) *InfluxQLNode

Select the minimum point.

func (TcpHandler) Mode added in v1.0.1

func (n TcpHandler) Mode(field string) *InfluxQLNode

Compute the mode of the data.

func (TcpHandler) MovingAverage added in v1.0.1

func (n TcpHandler) MovingAverage(field string, window int64) *InfluxQLNode

Compute a moving average of the last window points. No points are emitted until the window is full.

func (TcpHandler) Percentile added in v1.0.1

func (n TcpHandler) Percentile(field string, percentile float64) *InfluxQLNode

Select a point at the given percentile. This is a selector function, no interpolation between points is performed.

func (TcpHandler) Sample added in v1.0.1

func (n TcpHandler) Sample(rate interface{}) *SampleNode

Create a new node that samples the incoming points or batches.

One point will be emitted every count or duration specified.

func (TcpHandler) Shift added in v1.0.1

func (n TcpHandler) Shift(shift time.Duration) *ShiftNode

Create a new node that shifts the incoming points or batches in time.

func (TcpHandler) Spread added in v1.0.1

func (n TcpHandler) Spread(field string) *InfluxQLNode

Compute the difference between `min` and `max` points.

func (TcpHandler) StateCount added in v1.3.0

func (n TcpHandler) StateCount(expression *ast.LambdaNode) *StateCountNode

Create a node that tracks number of consecutive points in a given state.

func (TcpHandler) StateDuration added in v1.3.0

func (n TcpHandler) StateDuration(expression *ast.LambdaNode) *StateDurationNode

Create a node that tracks duration in a given state.

func (TcpHandler) Stddev added in v1.0.1

func (n TcpHandler) Stddev(field string) *InfluxQLNode

Compute the standard deviation.

func (TcpHandler) Sum added in v1.0.1

func (n TcpHandler) Sum(field string) *InfluxQLNode

Compute the sum of all values.

func (TcpHandler) Top added in v1.0.1

func (n TcpHandler) Top(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the top `num` points for `field` and sort by any extra tags or fields.

func (TcpHandler) Union added in v1.0.1

func (n TcpHandler) Union(node ...Node) *UnionNode

Perform the union of this node and all other given nodes.

func (TcpHandler) Where added in v1.0.1

func (n TcpHandler) Where(expression *ast.LambdaNode) *WhereNode

Create a new node that filters the data stream by a given expression.

func (TcpHandler) Window added in v1.0.1

func (n TcpHandler) Window() *WindowNode

Create a new node that windows the stream by time.

NOTE: Window can only be applied to stream edges.

type TelegramHandler added in v1.0.0

type TelegramHandler struct {
	*AlertNode

	// Telegram user/group ID to post messages to.
	// If empty uses the chati-d from the configuration.
	ChatId string
	// Parse node, defaults to Mardown
	// If empty uses the parse-mode from the configuration.
	ParseMode string
	// Web Page preview
	// If empty uses the disable-web-page-preview from the configuration.
	// tick:ignore
	IsDisableWebPagePreview bool `tick:"DisableWebPagePreview"`
	// Disables Notification
	// If empty uses the disable-notification from the configuration.
	// tick:ignore
	IsDisableNotification bool `tick:"DisableNotification"`
}

tick:embedded:AlertNode.Telegram

func (TelegramHandler) Alert added in v1.0.0

func (n TelegramHandler) Alert() *AlertNode

Create an alert node, which can trigger alerts.

func (TelegramHandler) Bottom added in v1.0.0

func (n TelegramHandler) Bottom(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the bottom `num` points for `field` and sort by any extra tags or fields.

func (TelegramHandler) Combine added in v1.0.0

func (n TelegramHandler) Combine(expressions ...*ast.LambdaNode) *CombineNode

Combine this node with itself. The data are combined on timestamp.

func (TelegramHandler) Count added in v1.0.0

func (n TelegramHandler) Count(field string) *InfluxQLNode

Count the number of points.

func (TelegramHandler) CumulativeSum added in v1.1.0

func (n TelegramHandler) CumulativeSum(field string) *InfluxQLNode

Compute a cumulative sum of each point that is received. A point is emitted for every point collected.

func (TelegramHandler) Default added in v1.0.0

func (n TelegramHandler) Default() *DefaultNode

Create a node that can set defaults for missing tags or fields.

func (TelegramHandler) Delete added in v1.0.0

func (n TelegramHandler) Delete() *DeleteNode

Create a node that can delete tags or fields.

func (TelegramHandler) Derivative added in v1.0.0

func (n TelegramHandler) Derivative(field string) *DerivativeNode

Create a new node that computes the derivative of adjacent points.

func (TelegramHandler) Difference added in v1.0.0

func (n TelegramHandler) Difference(field string) *InfluxQLNode

Compute the difference between points independent of elapsed time.

func (*TelegramHandler) DisableNotification added in v1.0.0

func (tel *TelegramHandler) DisableNotification() *TelegramHandler

Disables the Notification. If empty defaults to the configuration. tick:property

func (*TelegramHandler) DisableWebPagePreview added in v1.0.0

func (tel *TelegramHandler) DisableWebPagePreview() *TelegramHandler

Disables the WebPagePreview. If empty defaults to the configuration. tick:property

func (TelegramHandler) Distinct added in v1.0.0

func (n TelegramHandler) Distinct(field string) *InfluxQLNode

Produce batch of only the distinct points.

func (TelegramHandler) Elapsed added in v1.0.0

func (n TelegramHandler) Elapsed(field string, unit time.Duration) *InfluxQLNode

Compute the elapsed time between points

func (TelegramHandler) Eval added in v1.0.0

func (n TelegramHandler) Eval(expressions ...*ast.LambdaNode) *EvalNode

Create an eval node that will evaluate the given transformation function to each data point. A list of expressions may be provided and will be evaluated in the order they are given. The results are available to later expressions.

func (TelegramHandler) First added in v1.0.0

func (n TelegramHandler) First(field string) *InfluxQLNode

Select the first point.

func (TelegramHandler) Flatten added in v1.0.0

func (n TelegramHandler) Flatten() *FlattenNode

Flatten points with similar times into a single point.

func (TelegramHandler) GroupBy added in v1.0.0

func (n TelegramHandler) GroupBy(tag ...interface{}) *GroupByNode

Group the data by a set of tags.

Can pass literal * to group by all dimensions. Example:

|groupBy(*)

func (TelegramHandler) HoltWinters added in v1.0.0

func (n TelegramHandler) HoltWinters(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set.

func (TelegramHandler) HoltWintersWithFit added in v1.0.0

func (n TelegramHandler) HoltWintersWithFit(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set. This method also outputs all the points used to fit the data in addition to the forecasted data.

func (TelegramHandler) HttpOut added in v1.0.0

func (n TelegramHandler) HttpOut(endpoint string) *HTTPOutNode

Create an HTTP output node that caches the most recent data it has received. The cached data are available at the given endpoint. The endpoint is the relative path from the API endpoint of the running task. For example, if the task endpoint is at `/kapacitor/v1/tasks/<task_id>` and endpoint is `top10`, then the data can be requested from `/kapacitor/v1/tasks/<task_id>/top10`.

func (TelegramHandler) HttpPost added in v1.3.0

func (n TelegramHandler) HttpPost(url string) *HTTPPostNode

Creates an HTTP Post node that POSTS received data to the provided HTTP endpoint.

func (TelegramHandler) InfluxDBOut added in v1.0.0

func (n TelegramHandler) InfluxDBOut() *InfluxDBOutNode

Create an influxdb output node that will store the incoming data into InfluxDB.

func (TelegramHandler) Join added in v1.0.0

func (n TelegramHandler) Join(others ...Node) *JoinNode

Join this node with other nodes. The data are joined on timestamp.

func (TelegramHandler) K8sAutoscale added in v1.1.0

func (n TelegramHandler) K8sAutoscale() *K8sAutoscaleNode

Create a node that can trigger autoscale events for a kubernetes cluster.

func (TelegramHandler) Last added in v1.0.0

func (n TelegramHandler) Last(field string) *InfluxQLNode

Select the last point.

func (TelegramHandler) Max added in v1.0.0

func (n TelegramHandler) Max(field string) *InfluxQLNode

Select the maximum point.

func (TelegramHandler) Mean added in v1.0.0

func (n TelegramHandler) Mean(field string) *InfluxQLNode

Compute the mean of the data.

func (TelegramHandler) Median added in v1.0.0

func (n TelegramHandler) Median(field string) *InfluxQLNode

Compute the median of the data. Note, this method is not a selector, if you want the median point use `.percentile(field, 50.0)`.

func (TelegramHandler) Min added in v1.0.0

func (n TelegramHandler) Min(field string) *InfluxQLNode

Select the minimum point.

func (TelegramHandler) Mode added in v1.0.0

func (n TelegramHandler) Mode(field string) *InfluxQLNode

Compute the mode of the data.

func (TelegramHandler) MovingAverage added in v1.0.0

func (n TelegramHandler) MovingAverage(field string, window int64) *InfluxQLNode

Compute a moving average of the last window points. No points are emitted until the window is full.

func (TelegramHandler) Percentile added in v1.0.0

func (n TelegramHandler) Percentile(field string, percentile float64) *InfluxQLNode

Select a point at the given percentile. This is a selector function, no interpolation between points is performed.

func (TelegramHandler) Sample added in v1.0.0

func (n TelegramHandler) Sample(rate interface{}) *SampleNode

Create a new node that samples the incoming points or batches.

One point will be emitted every count or duration specified.

func (TelegramHandler) Shift added in v1.0.0

func (n TelegramHandler) Shift(shift time.Duration) *ShiftNode

Create a new node that shifts the incoming points or batches in time.

func (TelegramHandler) Spread added in v1.0.0

func (n TelegramHandler) Spread(field string) *InfluxQLNode

Compute the difference between `min` and `max` points.

func (TelegramHandler) StateCount added in v1.3.0

func (n TelegramHandler) StateCount(expression *ast.LambdaNode) *StateCountNode

Create a node that tracks number of consecutive points in a given state.

func (TelegramHandler) StateDuration added in v1.3.0

func (n TelegramHandler) StateDuration(expression *ast.LambdaNode) *StateDurationNode

Create a node that tracks duration in a given state.

func (TelegramHandler) Stddev added in v1.0.0

func (n TelegramHandler) Stddev(field string) *InfluxQLNode

Compute the standard deviation.

func (TelegramHandler) Sum added in v1.0.0

func (n TelegramHandler) Sum(field string) *InfluxQLNode

Compute the sum of all values.

func (TelegramHandler) Top added in v1.0.0

func (n TelegramHandler) Top(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the top `num` points for `field` and sort by any extra tags or fields.

func (TelegramHandler) Union added in v1.0.0

func (n TelegramHandler) Union(node ...Node) *UnionNode

Perform the union of this node and all other given nodes.

func (TelegramHandler) Where added in v1.0.0

func (n TelegramHandler) Where(expression *ast.LambdaNode) *WhereNode

Create a new node that filters the data stream by a given expression.

func (TelegramHandler) Window added in v1.0.0

func (n TelegramHandler) Window() *WindowNode

Create a new node that windows the stream by time.

NOTE: Window can only be applied to stream edges.

type TemplatePipeline added in v1.0.0

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

func CreateTemplatePipeline added in v1.0.0

func CreateTemplatePipeline(
	script string,
	sourceEdge EdgeType,
	scope *stateful.Scope,
	deadman DeadmanService,
) (*TemplatePipeline, error)

Create a template pipeline tick:ignore

func (*TemplatePipeline) Dot added in v1.0.0

func (t *TemplatePipeline) Dot(name string) []byte

Return a graphviz .dot formatted byte array. tick:ignore

func (*TemplatePipeline) Vars added in v1.0.0

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

Return the set of vars defined by the TICKscript with their defaults tick:ignore

type TopBottomCallInfo added in v0.11.0

type TopBottomCallInfo struct {
	FieldsAndTags []string
}

type UDFNode added in v0.10.0

type UDFNode struct {
	UDFName string

	// Options that were set on the node
	// tick:ignore
	Options []*udf.Option
	// contains filtered or unexported fields
}

A UDFNode is a node that can run a User Defined Function (UDF) in a separate process.

A UDF is a custom script or binary that can communicate via Kapacitor's UDF RPC protocol. The path and arguments to the UDF program are specified in Kapacitor's configuration. Using TICKscripts you can invoke and configure your UDF for each task.

See the [README.md](https://github.com/influxdata/kapacitor/tree/master/udf/agent/) for details on how to write your own UDF.

UDFs are configured via Kapacitor's main configuration file.

Example:

[udf]
[udf.functions]
    # Example moving average UDF.
    [udf.functions.movingAverage]
        prog = "/path/to/executable/moving_avg"
        args = []
        timeout = "10s"

UDFs are first class objects in TICKscripts and are referenced via their configuration name.

Example:

// Given you have a UDF that computes a moving average
// The UDF can define what its options are and then can be
// invoked via a TICKscript like so:
stream
    |from()...
    @movingAverage()
        .field('value')
        .size(100)
        .as('mavg')
    |httpOut('movingaverage')

NOTE: The UDF process runs as the same user as the Kapacitor daemon. As a result make the user is properly secured as well as the configuration file.

func NewUDF added in v0.10.0

func NewUDF(
	parent Node,
	name string,
	wants,
	provides udf.EdgeType,
	options map[string]*udf.OptionInfo,
) *UDFNode

func (*UDFNode) Alert added in v0.10.0

func (n *UDFNode) Alert() *AlertNode

Create an alert node, which can trigger alerts.

func (*UDFNode) Bottom added in v0.11.0

func (n *UDFNode) Bottom(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the bottom `num` points for `field` and sort by any extra tags or fields.

func (*UDFNode) CallChainMethod added in v0.12.0

func (u *UDFNode) CallChainMethod(name string, args ...interface{}) (interface{}, error)

tick:ignore

func (*UDFNode) Combine added in v1.0.0

func (n *UDFNode) Combine(expressions ...*ast.LambdaNode) *CombineNode

Combine this node with itself. The data are combined on timestamp.

func (*UDFNode) Count added in v0.11.0

func (n *UDFNode) Count(field string) *InfluxQLNode

Count the number of points.

func (*UDFNode) CumulativeSum added in v1.1.0

func (n *UDFNode) CumulativeSum(field string) *InfluxQLNode

Compute a cumulative sum of each point that is received. A point is emitted for every point collected.

func (*UDFNode) Default added in v0.13.0

func (n *UDFNode) Default() *DefaultNode

Create a node that can set defaults for missing tags or fields.

func (*UDFNode) Delete added in v1.0.0

func (n *UDFNode) Delete() *DeleteNode

Create a node that can delete tags or fields.

func (*UDFNode) Derivative added in v0.10.0

func (n *UDFNode) Derivative(field string) *DerivativeNode

Create a new node that computes the derivative of adjacent points.

func (*UDFNode) Desc added in v0.10.0

func (u *UDFNode) Desc() string

tick:ignore

func (*UDFNode) Difference added in v1.0.0

func (n *UDFNode) Difference(field string) *InfluxQLNode

Compute the difference between points independent of elapsed time.

func (*UDFNode) Distinct added in v0.11.0

func (n *UDFNode) Distinct(field string) *InfluxQLNode

Produce batch of only the distinct points.

func (*UDFNode) Elapsed added in v0.13.0

func (n *UDFNode) Elapsed(field string, unit time.Duration) *InfluxQLNode

Compute the elapsed time between points

func (*UDFNode) Eval added in v0.10.0

func (n *UDFNode) Eval(expressions ...*ast.LambdaNode) *EvalNode

Create an eval node that will evaluate the given transformation function to each data point. A list of expressions may be provided and will be evaluated in the order they are given. The results are available to later expressions.

func (*UDFNode) First added in v0.11.0

func (n *UDFNode) First(field string) *InfluxQLNode

Select the first point.

func (*UDFNode) Flatten added in v1.0.0

func (n *UDFNode) Flatten() *FlattenNode

Flatten points with similar times into a single point.

func (*UDFNode) GroupBy added in v0.10.0

func (n *UDFNode) GroupBy(tag ...interface{}) *GroupByNode

Group the data by a set of tags.

Can pass literal * to group by all dimensions. Example:

|groupBy(*)

func (*UDFNode) HasChainMethod added in v0.12.0

func (u *UDFNode) HasChainMethod(name string) bool

tick:ignore

func (*UDFNode) HasProperty added in v0.10.0

func (u *UDFNode) HasProperty(name string) bool

tick:ignore

func (*UDFNode) HoltWinters added in v1.0.0

func (n *UDFNode) HoltWinters(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set.

func (*UDFNode) HoltWintersWithFit added in v1.0.0

func (n *UDFNode) HoltWintersWithFit(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set. This method also outputs all the points used to fit the data in addition to the forecasted data.

func (*UDFNode) HttpOut added in v0.10.0

func (n *UDFNode) HttpOut(endpoint string) *HTTPOutNode

Create an HTTP output node that caches the most recent data it has received. The cached data are available at the given endpoint. The endpoint is the relative path from the API endpoint of the running task. For example, if the task endpoint is at `/kapacitor/v1/tasks/<task_id>` and endpoint is `top10`, then the data can be requested from `/kapacitor/v1/tasks/<task_id>/top10`.

func (*UDFNode) HttpPost added in v1.3.0

func (n *UDFNode) HttpPost(url string) *HTTPPostNode

Creates an HTTP Post node that POSTS received data to the provided HTTP endpoint.

func (*UDFNode) InfluxDBOut added in v0.10.0

func (n *UDFNode) InfluxDBOut() *InfluxDBOutNode

Create an influxdb output node that will store the incoming data into InfluxDB.

func (*UDFNode) Join added in v0.10.0

func (n *UDFNode) Join(others ...Node) *JoinNode

Join this node with other nodes. The data are joined on timestamp.

func (*UDFNode) K8sAutoscale added in v1.1.0

func (n *UDFNode) K8sAutoscale() *K8sAutoscaleNode

Create a node that can trigger autoscale events for a kubernetes cluster.

func (*UDFNode) Last added in v0.11.0

func (n *UDFNode) Last(field string) *InfluxQLNode

Select the last point.

func (*UDFNode) Log added in v0.11.0

func (n *UDFNode) Log() *LogNode

Create a node that logs all data it receives.

func (*UDFNode) Max added in v0.11.0

func (n *UDFNode) Max(field string) *InfluxQLNode

Select the maximum point.

func (*UDFNode) Mean added in v0.11.0

func (n *UDFNode) Mean(field string) *InfluxQLNode

Compute the mean of the data.

func (*UDFNode) Median added in v0.11.0

func (n *UDFNode) Median(field string) *InfluxQLNode

Compute the median of the data. Note, this method is not a selector, if you want the median point use `.percentile(field, 50.0)`.

func (*UDFNode) Min added in v0.11.0

func (n *UDFNode) Min(field string) *InfluxQLNode

Select the minimum point.

func (*UDFNode) Mode added in v1.0.0

func (n *UDFNode) Mode(field string) *InfluxQLNode

Compute the mode of the data.

func (*UDFNode) MovingAverage added in v1.0.0

func (n *UDFNode) MovingAverage(field string, window int64) *InfluxQLNode

Compute a moving average of the last window points. No points are emitted until the window is full.

func (*UDFNode) Percentile added in v0.11.0

func (n *UDFNode) Percentile(field string, percentile float64) *InfluxQLNode

Select a point at the given percentile. This is a selector function, no interpolation between points is performed.

func (*UDFNode) Property added in v0.10.0

func (u *UDFNode) Property(name string) interface{}

tick:ignore

func (*UDFNode) Sample added in v0.10.0

func (n *UDFNode) Sample(rate interface{}) *SampleNode

Create a new node that samples the incoming points or batches.

One point will be emitted every count or duration specified.

func (*UDFNode) SetProperty added in v0.10.0

func (u *UDFNode) SetProperty(name string, args ...interface{}) (interface{}, error)

tick:ignore

func (*UDFNode) Shift added in v0.11.0

func (n *UDFNode) Shift(shift time.Duration) *ShiftNode

Create a new node that shifts the incoming points or batches in time.

func (*UDFNode) Spread added in v0.11.0

func (n *UDFNode) Spread(field string) *InfluxQLNode

Compute the difference between `min` and `max` points.

func (*UDFNode) StateCount added in v1.3.0

func (n *UDFNode) StateCount(expression *ast.LambdaNode) *StateCountNode

Create a node that tracks number of consecutive points in a given state.

func (*UDFNode) StateDuration added in v1.3.0

func (n *UDFNode) StateDuration(expression *ast.LambdaNode) *StateDurationNode

Create a node that tracks duration in a given state.

func (*UDFNode) Stddev added in v0.11.0

func (n *UDFNode) Stddev(field string) *InfluxQLNode

Compute the standard deviation.

func (*UDFNode) Sum added in v0.11.0

func (n *UDFNode) Sum(field string) *InfluxQLNode

Compute the sum of all values.

func (*UDFNode) Top added in v0.11.0

func (n *UDFNode) Top(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the top `num` points for `field` and sort by any extra tags or fields.

func (*UDFNode) Union added in v0.10.0

func (n *UDFNode) Union(node ...Node) *UnionNode

Perform the union of this node and all other given nodes.

func (*UDFNode) Where added in v0.10.0

func (n *UDFNode) Where(expression *ast.LambdaNode) *WhereNode

Create a new node that filters the data stream by a given expression.

func (*UDFNode) Window added in v0.10.0

func (n *UDFNode) Window() *WindowNode

Create a new node that windows the stream by time.

NOTE: Window can only be applied to stream edges.

type UnionNode

type UnionNode struct {

	// The new name of the stream.
	// If empty the name of the left node
	// (i.e. `leftNode.union(otherNode1, otherNode2)`) is used.
	Rename string
	// contains filtered or unexported fields
}

Takes the union of all of its parents. The union is just a simple pass through. Each data points received from each parent is passed onto children nodes without modification.

Example:

var logins = stream
    |from()
        .measurement('logins')
var logouts = stream
    |from()
        .measurement('logouts')
var frontpage = stream
    |from()
        .measurement('frontpage')
// Union all user actions into a single stream
logins
    |union(logouts, frontpage)
        .rename('user_actions')
    ...

func (*UnionNode) Alert

func (n *UnionNode) Alert() *AlertNode

Create an alert node, which can trigger alerts.

func (*UnionNode) Bottom added in v0.11.0

func (n *UnionNode) Bottom(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the bottom `num` points for `field` and sort by any extra tags or fields.

func (*UnionNode) Combine added in v1.0.0

func (n *UnionNode) Combine(expressions ...*ast.LambdaNode) *CombineNode

Combine this node with itself. The data are combined on timestamp.

func (*UnionNode) Count added in v0.11.0

func (n *UnionNode) Count(field string) *InfluxQLNode

Count the number of points.

func (*UnionNode) CumulativeSum added in v1.1.0

func (n *UnionNode) CumulativeSum(field string) *InfluxQLNode

Compute a cumulative sum of each point that is received. A point is emitted for every point collected.

func (*UnionNode) Default added in v0.13.0

func (n *UnionNode) Default() *DefaultNode

Create a node that can set defaults for missing tags or fields.

func (*UnionNode) Delete added in v1.0.0

func (n *UnionNode) Delete() *DeleteNode

Create a node that can delete tags or fields.

func (*UnionNode) Derivative

func (n *UnionNode) Derivative(field string) *DerivativeNode

Create a new node that computes the derivative of adjacent points.

func (*UnionNode) Difference added in v1.0.0

func (n *UnionNode) Difference(field string) *InfluxQLNode

Compute the difference between points independent of elapsed time.

func (*UnionNode) Distinct added in v0.11.0

func (n *UnionNode) Distinct(field string) *InfluxQLNode

Produce batch of only the distinct points.

func (*UnionNode) Elapsed added in v0.13.0

func (n *UnionNode) Elapsed(field string, unit time.Duration) *InfluxQLNode

Compute the elapsed time between points

func (*UnionNode) Eval

func (n *UnionNode) Eval(expressions ...*ast.LambdaNode) *EvalNode

Create an eval node that will evaluate the given transformation function to each data point. A list of expressions may be provided and will be evaluated in the order they are given. The results are available to later expressions.

func (*UnionNode) First added in v0.11.0

func (n *UnionNode) First(field string) *InfluxQLNode

Select the first point.

func (*UnionNode) Flatten added in v1.0.0

func (n *UnionNode) Flatten() *FlattenNode

Flatten points with similar times into a single point.

func (*UnionNode) GroupBy

func (n *UnionNode) GroupBy(tag ...interface{}) *GroupByNode

Group the data by a set of tags.

Can pass literal * to group by all dimensions. Example:

|groupBy(*)

func (*UnionNode) HoltWinters added in v1.0.0

func (n *UnionNode) HoltWinters(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set.

func (*UnionNode) HoltWintersWithFit added in v1.0.0

func (n *UnionNode) HoltWintersWithFit(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set. This method also outputs all the points used to fit the data in addition to the forecasted data.

func (*UnionNode) HttpOut

func (n *UnionNode) HttpOut(endpoint string) *HTTPOutNode

Create an HTTP output node that caches the most recent data it has received. The cached data are available at the given endpoint. The endpoint is the relative path from the API endpoint of the running task. For example, if the task endpoint is at `/kapacitor/v1/tasks/<task_id>` and endpoint is `top10`, then the data can be requested from `/kapacitor/v1/tasks/<task_id>/top10`.

func (*UnionNode) HttpPost added in v1.3.0

func (n *UnionNode) HttpPost(url string) *HTTPPostNode

Creates an HTTP Post node that POSTS received data to the provided HTTP endpoint.

func (*UnionNode) InfluxDBOut

func (n *UnionNode) InfluxDBOut() *InfluxDBOutNode

Create an influxdb output node that will store the incoming data into InfluxDB.

func (*UnionNode) Join

func (n *UnionNode) Join(others ...Node) *JoinNode

Join this node with other nodes. The data are joined on timestamp.

func (*UnionNode) K8sAutoscale added in v1.1.0

func (n *UnionNode) K8sAutoscale() *K8sAutoscaleNode

Create a node that can trigger autoscale events for a kubernetes cluster.

func (*UnionNode) Last added in v0.11.0

func (n *UnionNode) Last(field string) *InfluxQLNode

Select the last point.

func (*UnionNode) Log added in v0.11.0

func (n *UnionNode) Log() *LogNode

Create a node that logs all data it receives.

func (*UnionNode) Max added in v0.11.0

func (n *UnionNode) Max(field string) *InfluxQLNode

Select the maximum point.

func (*UnionNode) Mean added in v0.11.0

func (n *UnionNode) Mean(field string) *InfluxQLNode

Compute the mean of the data.

func (*UnionNode) Median added in v0.11.0

func (n *UnionNode) Median(field string) *InfluxQLNode

Compute the median of the data. Note, this method is not a selector, if you want the median point use `.percentile(field, 50.0)`.

func (*UnionNode) Min added in v0.11.0

func (n *UnionNode) Min(field string) *InfluxQLNode

Select the minimum point.

func (*UnionNode) Mode added in v1.0.0

func (n *UnionNode) Mode(field string) *InfluxQLNode

Compute the mode of the data.

func (*UnionNode) MovingAverage added in v1.0.0

func (n *UnionNode) MovingAverage(field string, window int64) *InfluxQLNode

Compute a moving average of the last window points. No points are emitted until the window is full.

func (*UnionNode) Percentile added in v0.11.0

func (n *UnionNode) Percentile(field string, percentile float64) *InfluxQLNode

Select a point at the given percentile. This is a selector function, no interpolation between points is performed.

func (*UnionNode) Sample

func (n *UnionNode) Sample(rate interface{}) *SampleNode

Create a new node that samples the incoming points or batches.

One point will be emitted every count or duration specified.

func (*UnionNode) Shift added in v0.11.0

func (n *UnionNode) Shift(shift time.Duration) *ShiftNode

Create a new node that shifts the incoming points or batches in time.

func (*UnionNode) Spread added in v0.11.0

func (n *UnionNode) Spread(field string) *InfluxQLNode

Compute the difference between `min` and `max` points.

func (*UnionNode) StateCount added in v1.3.0

func (n *UnionNode) StateCount(expression *ast.LambdaNode) *StateCountNode

Create a node that tracks number of consecutive points in a given state.

func (*UnionNode) StateDuration added in v1.3.0

func (n *UnionNode) StateDuration(expression *ast.LambdaNode) *StateDurationNode

Create a node that tracks duration in a given state.

func (*UnionNode) Stddev added in v0.11.0

func (n *UnionNode) Stddev(field string) *InfluxQLNode

Compute the standard deviation.

func (*UnionNode) Sum added in v0.11.0

func (n *UnionNode) Sum(field string) *InfluxQLNode

Compute the sum of all values.

func (*UnionNode) Top added in v0.11.0

func (n *UnionNode) Top(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the top `num` points for `field` and sort by any extra tags or fields.

func (*UnionNode) Union

func (n *UnionNode) Union(node ...Node) *UnionNode

Perform the union of this node and all other given nodes.

func (*UnionNode) Where

func (n *UnionNode) Where(expression *ast.LambdaNode) *WhereNode

Create a new node that filters the data stream by a given expression.

func (*UnionNode) Window

func (n *UnionNode) Window() *WindowNode

Create a new node that windows the stream by time.

NOTE: Window can only be applied to stream edges.

type VictorOpsHandler added in v0.2.4

type VictorOpsHandler struct {
	*AlertNode

	// The routing key to use for the alert.
	// Defaults to the value in the configuration if empty.
	RoutingKey string
}

tick:embedded:AlertNode.VictorOps

func (VictorOpsHandler) Alert added in v0.13.0

func (n VictorOpsHandler) Alert() *AlertNode

Create an alert node, which can trigger alerts.

func (VictorOpsHandler) Bottom added in v0.13.0

func (n VictorOpsHandler) Bottom(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the bottom `num` points for `field` and sort by any extra tags or fields.

func (VictorOpsHandler) Combine added in v1.0.0

func (n VictorOpsHandler) Combine(expressions ...*ast.LambdaNode) *CombineNode

Combine this node with itself. The data are combined on timestamp.

func (VictorOpsHandler) Count added in v0.13.0

func (n VictorOpsHandler) Count(field string) *InfluxQLNode

Count the number of points.

func (VictorOpsHandler) CumulativeSum added in v1.1.0

func (n VictorOpsHandler) CumulativeSum(field string) *InfluxQLNode

Compute a cumulative sum of each point that is received. A point is emitted for every point collected.

func (VictorOpsHandler) Default added in v0.13.0

func (n VictorOpsHandler) Default() *DefaultNode

Create a node that can set defaults for missing tags or fields.

func (VictorOpsHandler) Delete added in v1.0.0

func (n VictorOpsHandler) Delete() *DeleteNode

Create a node that can delete tags or fields.

func (VictorOpsHandler) Derivative added in v0.13.0

func (n VictorOpsHandler) Derivative(field string) *DerivativeNode

Create a new node that computes the derivative of adjacent points.

func (VictorOpsHandler) Difference added in v1.0.0

func (n VictorOpsHandler) Difference(field string) *InfluxQLNode

Compute the difference between points independent of elapsed time.

func (VictorOpsHandler) Distinct added in v0.13.0

func (n VictorOpsHandler) Distinct(field string) *InfluxQLNode

Produce batch of only the distinct points.

func (VictorOpsHandler) Elapsed added in v0.13.0

func (n VictorOpsHandler) Elapsed(field string, unit time.Duration) *InfluxQLNode

Compute the elapsed time between points

func (VictorOpsHandler) Eval added in v0.13.0

func (n VictorOpsHandler) Eval(expressions ...*ast.LambdaNode) *EvalNode

Create an eval node that will evaluate the given transformation function to each data point. A list of expressions may be provided and will be evaluated in the order they are given. The results are available to later expressions.

func (VictorOpsHandler) First added in v0.13.0

func (n VictorOpsHandler) First(field string) *InfluxQLNode

Select the first point.

func (VictorOpsHandler) Flatten added in v1.0.0

func (n VictorOpsHandler) Flatten() *FlattenNode

Flatten points with similar times into a single point.

func (VictorOpsHandler) GroupBy added in v0.13.0

func (n VictorOpsHandler) GroupBy(tag ...interface{}) *GroupByNode

Group the data by a set of tags.

Can pass literal * to group by all dimensions. Example:

|groupBy(*)

func (VictorOpsHandler) HoltWinters added in v1.0.0

func (n VictorOpsHandler) HoltWinters(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set.

func (VictorOpsHandler) HoltWintersWithFit added in v1.0.0

func (n VictorOpsHandler) HoltWintersWithFit(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set. This method also outputs all the points used to fit the data in addition to the forecasted data.

func (VictorOpsHandler) HttpOut added in v0.13.0

func (n VictorOpsHandler) HttpOut(endpoint string) *HTTPOutNode

Create an HTTP output node that caches the most recent data it has received. The cached data are available at the given endpoint. The endpoint is the relative path from the API endpoint of the running task. For example, if the task endpoint is at `/kapacitor/v1/tasks/<task_id>` and endpoint is `top10`, then the data can be requested from `/kapacitor/v1/tasks/<task_id>/top10`.

func (VictorOpsHandler) HttpPost added in v1.3.0

func (n VictorOpsHandler) HttpPost(url string) *HTTPPostNode

Creates an HTTP Post node that POSTS received data to the provided HTTP endpoint.

func (VictorOpsHandler) InfluxDBOut added in v0.13.0

func (n VictorOpsHandler) InfluxDBOut() *InfluxDBOutNode

Create an influxdb output node that will store the incoming data into InfluxDB.

func (VictorOpsHandler) Join added in v0.13.0

func (n VictorOpsHandler) Join(others ...Node) *JoinNode

Join this node with other nodes. The data are joined on timestamp.

func (VictorOpsHandler) K8sAutoscale added in v1.1.0

func (n VictorOpsHandler) K8sAutoscale() *K8sAutoscaleNode

Create a node that can trigger autoscale events for a kubernetes cluster.

func (VictorOpsHandler) Last added in v0.13.0

func (n VictorOpsHandler) Last(field string) *InfluxQLNode

Select the last point.

func (VictorOpsHandler) Max added in v0.13.0

func (n VictorOpsHandler) Max(field string) *InfluxQLNode

Select the maximum point.

func (VictorOpsHandler) Mean added in v0.13.0

func (n VictorOpsHandler) Mean(field string) *InfluxQLNode

Compute the mean of the data.

func (VictorOpsHandler) Median added in v0.13.0

func (n VictorOpsHandler) Median(field string) *InfluxQLNode

Compute the median of the data. Note, this method is not a selector, if you want the median point use `.percentile(field, 50.0)`.

func (VictorOpsHandler) Min added in v0.13.0

func (n VictorOpsHandler) Min(field string) *InfluxQLNode

Select the minimum point.

func (VictorOpsHandler) Mode added in v1.0.0

func (n VictorOpsHandler) Mode(field string) *InfluxQLNode

Compute the mode of the data.

func (VictorOpsHandler) MovingAverage added in v1.0.0

func (n VictorOpsHandler) MovingAverage(field string, window int64) *InfluxQLNode

Compute a moving average of the last window points. No points are emitted until the window is full.

func (VictorOpsHandler) Percentile added in v0.13.0

func (n VictorOpsHandler) Percentile(field string, percentile float64) *InfluxQLNode

Select a point at the given percentile. This is a selector function, no interpolation between points is performed.

func (VictorOpsHandler) Sample added in v0.13.0

func (n VictorOpsHandler) Sample(rate interface{}) *SampleNode

Create a new node that samples the incoming points or batches.

One point will be emitted every count or duration specified.

func (VictorOpsHandler) Shift added in v0.13.0

func (n VictorOpsHandler) Shift(shift time.Duration) *ShiftNode

Create a new node that shifts the incoming points or batches in time.

func (VictorOpsHandler) Spread added in v0.13.0

func (n VictorOpsHandler) Spread(field string) *InfluxQLNode

Compute the difference between `min` and `max` points.

func (VictorOpsHandler) StateCount added in v1.3.0

func (n VictorOpsHandler) StateCount(expression *ast.LambdaNode) *StateCountNode

Create a node that tracks number of consecutive points in a given state.

func (VictorOpsHandler) StateDuration added in v1.3.0

func (n VictorOpsHandler) StateDuration(expression *ast.LambdaNode) *StateDurationNode

Create a node that tracks duration in a given state.

func (VictorOpsHandler) Stddev added in v0.13.0

func (n VictorOpsHandler) Stddev(field string) *InfluxQLNode

Compute the standard deviation.

func (VictorOpsHandler) Sum added in v0.13.0

func (n VictorOpsHandler) Sum(field string) *InfluxQLNode

Compute the sum of all values.

func (VictorOpsHandler) Top added in v0.13.0

func (n VictorOpsHandler) Top(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the top `num` points for `field` and sort by any extra tags or fields.

func (VictorOpsHandler) Union added in v0.13.0

func (n VictorOpsHandler) Union(node ...Node) *UnionNode

Perform the union of this node and all other given nodes.

func (VictorOpsHandler) Where added in v0.13.0

func (n VictorOpsHandler) Where(expression *ast.LambdaNode) *WhereNode

Create a new node that filters the data stream by a given expression.

func (VictorOpsHandler) Window added in v0.13.0

func (n VictorOpsHandler) Window() *WindowNode

Create a new node that windows the stream by time.

NOTE: Window can only be applied to stream edges.

type WhereNode

type WhereNode struct {

	// The expression predicate.
	// tick:ignore
	Lambda *ast.LambdaNode
	// contains filtered or unexported fields
}

The WhereNode filters the data stream by a given expression.

Example: var sums = stream

|from()
    .groupBy('service', 'host')
|sum('value')

//Watch particular host for issues. sums

|where(lambda: "host" == 'h001.example.com')
|alert()
    .crit(lambda: TRUE)
    .email().to('user@example.com')

func (*WhereNode) Alert

func (n *WhereNode) Alert() *AlertNode

Create an alert node, which can trigger alerts.

func (*WhereNode) Bottom added in v0.11.0

func (n *WhereNode) Bottom(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the bottom `num` points for `field` and sort by any extra tags or fields.

func (*WhereNode) Combine added in v1.0.0

func (n *WhereNode) Combine(expressions ...*ast.LambdaNode) *CombineNode

Combine this node with itself. The data are combined on timestamp.

func (*WhereNode) Count added in v0.11.0

func (n *WhereNode) Count(field string) *InfluxQLNode

Count the number of points.

func (*WhereNode) CumulativeSum added in v1.1.0

func (n *WhereNode) CumulativeSum(field string) *InfluxQLNode

Compute a cumulative sum of each point that is received. A point is emitted for every point collected.

func (*WhereNode) Default added in v0.13.0

func (n *WhereNode) Default() *DefaultNode

Create a node that can set defaults for missing tags or fields.

func (*WhereNode) Delete added in v1.0.0

func (n *WhereNode) Delete() *DeleteNode

Create a node that can delete tags or fields.

func (*WhereNode) Derivative

func (n *WhereNode) Derivative(field string) *DerivativeNode

Create a new node that computes the derivative of adjacent points.

func (*WhereNode) Difference added in v1.0.0

func (n *WhereNode) Difference(field string) *InfluxQLNode

Compute the difference between points independent of elapsed time.

func (*WhereNode) Distinct added in v0.11.0

func (n *WhereNode) Distinct(field string) *InfluxQLNode

Produce batch of only the distinct points.

func (*WhereNode) Elapsed added in v0.13.0

func (n *WhereNode) Elapsed(field string, unit time.Duration) *InfluxQLNode

Compute the elapsed time between points

func (*WhereNode) Eval

func (n *WhereNode) Eval(expressions ...*ast.LambdaNode) *EvalNode

Create an eval node that will evaluate the given transformation function to each data point. A list of expressions may be provided and will be evaluated in the order they are given. The results are available to later expressions.

func (*WhereNode) First added in v0.11.0

func (n *WhereNode) First(field string) *InfluxQLNode

Select the first point.

func (*WhereNode) Flatten added in v1.0.0

func (n *WhereNode) Flatten() *FlattenNode

Flatten points with similar times into a single point.

func (*WhereNode) GroupBy

func (n *WhereNode) GroupBy(tag ...interface{}) *GroupByNode

Group the data by a set of tags.

Can pass literal * to group by all dimensions. Example:

|groupBy(*)

func (*WhereNode) HoltWinters added in v1.0.0

func (n *WhereNode) HoltWinters(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set.

func (*WhereNode) HoltWintersWithFit added in v1.0.0

func (n *WhereNode) HoltWintersWithFit(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set. This method also outputs all the points used to fit the data in addition to the forecasted data.

func (*WhereNode) HttpOut

func (n *WhereNode) HttpOut(endpoint string) *HTTPOutNode

Create an HTTP output node that caches the most recent data it has received. The cached data are available at the given endpoint. The endpoint is the relative path from the API endpoint of the running task. For example, if the task endpoint is at `/kapacitor/v1/tasks/<task_id>` and endpoint is `top10`, then the data can be requested from `/kapacitor/v1/tasks/<task_id>/top10`.

func (*WhereNode) HttpPost added in v1.3.0

func (n *WhereNode) HttpPost(url string) *HTTPPostNode

Creates an HTTP Post node that POSTS received data to the provided HTTP endpoint.

func (*WhereNode) InfluxDBOut

func (n *WhereNode) InfluxDBOut() *InfluxDBOutNode

Create an influxdb output node that will store the incoming data into InfluxDB.

func (*WhereNode) Join

func (n *WhereNode) Join(others ...Node) *JoinNode

Join this node with other nodes. The data are joined on timestamp.

func (*WhereNode) K8sAutoscale added in v1.1.0

func (n *WhereNode) K8sAutoscale() *K8sAutoscaleNode

Create a node that can trigger autoscale events for a kubernetes cluster.

func (*WhereNode) Last added in v0.11.0

func (n *WhereNode) Last(field string) *InfluxQLNode

Select the last point.

func (*WhereNode) Log added in v0.11.0

func (n *WhereNode) Log() *LogNode

Create a node that logs all data it receives.

func (*WhereNode) Max added in v0.11.0

func (n *WhereNode) Max(field string) *InfluxQLNode

Select the maximum point.

func (*WhereNode) Mean added in v0.11.0

func (n *WhereNode) Mean(field string) *InfluxQLNode

Compute the mean of the data.

func (*WhereNode) Median added in v0.11.0

func (n *WhereNode) Median(field string) *InfluxQLNode

Compute the median of the data. Note, this method is not a selector, if you want the median point use `.percentile(field, 50.0)`.

func (*WhereNode) Min added in v0.11.0

func (n *WhereNode) Min(field string) *InfluxQLNode

Select the minimum point.

func (*WhereNode) Mode added in v1.0.0

func (n *WhereNode) Mode(field string) *InfluxQLNode

Compute the mode of the data.

func (*WhereNode) MovingAverage added in v1.0.0

func (n *WhereNode) MovingAverage(field string, window int64) *InfluxQLNode

Compute a moving average of the last window points. No points are emitted until the window is full.

func (*WhereNode) Percentile added in v0.11.0

func (n *WhereNode) Percentile(field string, percentile float64) *InfluxQLNode

Select a point at the given percentile. This is a selector function, no interpolation between points is performed.

func (*WhereNode) Sample

func (n *WhereNode) Sample(rate interface{}) *SampleNode

Create a new node that samples the incoming points or batches.

One point will be emitted every count or duration specified.

func (*WhereNode) Shift added in v0.11.0

func (n *WhereNode) Shift(shift time.Duration) *ShiftNode

Create a new node that shifts the incoming points or batches in time.

func (*WhereNode) Spread added in v0.11.0

func (n *WhereNode) Spread(field string) *InfluxQLNode

Compute the difference between `min` and `max` points.

func (*WhereNode) StateCount added in v1.3.0

func (n *WhereNode) StateCount(expression *ast.LambdaNode) *StateCountNode

Create a node that tracks number of consecutive points in a given state.

func (*WhereNode) StateDuration added in v1.3.0

func (n *WhereNode) StateDuration(expression *ast.LambdaNode) *StateDurationNode

Create a node that tracks duration in a given state.

func (*WhereNode) Stddev added in v0.11.0

func (n *WhereNode) Stddev(field string) *InfluxQLNode

Compute the standard deviation.

func (*WhereNode) Sum added in v0.11.0

func (n *WhereNode) Sum(field string) *InfluxQLNode

Compute the sum of all values.

func (*WhereNode) Top added in v0.11.0

func (n *WhereNode) Top(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the top `num` points for `field` and sort by any extra tags or fields.

func (*WhereNode) Union

func (n *WhereNode) Union(node ...Node) *UnionNode

Perform the union of this node and all other given nodes.

func (*WhereNode) Where

func (n *WhereNode) Where(expression *ast.LambdaNode) *WhereNode

Create a new node that filters the data stream by a given expression.

func (*WhereNode) Window

func (n *WhereNode) Window() *WindowNode

Create a new node that windows the stream by time.

NOTE: Window can only be applied to stream edges.

type WindowNode

type WindowNode struct {

	// The period, or length in time, of the window.
	Period time.Duration
	// How often the current window is emitted into the pipeline.
	// If equal to zero, then every new point will emit the current window.
	Every time.Duration
	// Whether to align the window edges with the zero time
	// tick:ignore
	AlignFlag bool `tick:"Align"`
	// Whether to wait till the period is full before the first emit.
	// tick:ignore
	FillPeriodFlag bool `tick:"FillPeriod"`

	// PeriodCount is the number of points per window.
	PeriodCount int64
	// EveryCount determines how often the window is emitted based on the count of points.
	// A value of 1 means that every new point will emit the window.
	EveryCount int64
	// contains filtered or unexported fields
}

A `window` node caches data within a moving time range. The `period` property of `window` defines the time range covered by `window`.

The `every` property of `window` defines the frequency at which the window is emitted to the next node in the pipeline.

The `align` property of `window` defines how to align the window edges. (By default, the edges are defined relative to the first data point the `window` node receives.)

Example:

stream
    |window()
        .period(10m)
        .every(5m)
    |httpOut('recent')

his example emits the last `10 minute` period every `5 minutes` to the pipeline's `httpOut` node. Because `every` is less than `period`, each time the window is emitted it contains `5 minutes` of new data and `5 minutes` of the previous period's data.

NOTE: Because no `align` property is defined, the `window` edge is defined relative to the first data point.

func (*WindowNode) Alert

func (n *WindowNode) Alert() *AlertNode

Create an alert node, which can trigger alerts.

func (*WindowNode) Align

func (w *WindowNode) Align() *WindowNode

If the `align` property is not used to modify the `window` node, then the window alignment is assumed to start at the time of the first data point it receives. If `align` property is set, the window time edges will be truncated to the `every` property (For example, if a data point's time is 12:06 and the `every` property is `5m` then the data point's window will range from 12:05 to 12:10). tick:property

func (*WindowNode) Bottom added in v0.11.0

func (n *WindowNode) Bottom(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the bottom `num` points for `field` and sort by any extra tags or fields.

func (*WindowNode) Combine added in v1.0.0

func (n *WindowNode) Combine(expressions ...*ast.LambdaNode) *CombineNode

Combine this node with itself. The data are combined on timestamp.

func (*WindowNode) Count added in v0.11.0

func (n *WindowNode) Count(field string) *InfluxQLNode

Count the number of points.

func (*WindowNode) CumulativeSum added in v1.1.0

func (n *WindowNode) CumulativeSum(field string) *InfluxQLNode

Compute a cumulative sum of each point that is received. A point is emitted for every point collected.

func (*WindowNode) Default added in v0.13.0

func (n *WindowNode) Default() *DefaultNode

Create a node that can set defaults for missing tags or fields.

func (*WindowNode) Delete added in v1.0.0

func (n *WindowNode) Delete() *DeleteNode

Create a node that can delete tags or fields.

func (*WindowNode) Derivative

func (n *WindowNode) Derivative(field string) *DerivativeNode

Create a new node that computes the derivative of adjacent points.

func (*WindowNode) Difference added in v1.0.0

func (n *WindowNode) Difference(field string) *InfluxQLNode

Compute the difference between points independent of elapsed time.

func (*WindowNode) Distinct added in v0.11.0

func (n *WindowNode) Distinct(field string) *InfluxQLNode

Produce batch of only the distinct points.

func (*WindowNode) Elapsed added in v0.13.0

func (n *WindowNode) Elapsed(field string, unit time.Duration) *InfluxQLNode

Compute the elapsed time between points

func (*WindowNode) Eval

func (n *WindowNode) Eval(expressions ...*ast.LambdaNode) *EvalNode

Create an eval node that will evaluate the given transformation function to each data point. A list of expressions may be provided and will be evaluated in the order they are given. The results are available to later expressions.

func (*WindowNode) FillPeriod added in v1.2.0

func (w *WindowNode) FillPeriod() *WindowNode

FillPeriod instructs the WindowNode to wait till the period has elapsed before emitting the first batch. This only applies if the period is greater than the every value. tick:property

func (*WindowNode) First added in v0.11.0

func (n *WindowNode) First(field string) *InfluxQLNode

Select the first point.

func (*WindowNode) Flatten added in v1.0.0

func (n *WindowNode) Flatten() *FlattenNode

Flatten points with similar times into a single point.

func (*WindowNode) GroupBy

func (n *WindowNode) GroupBy(tag ...interface{}) *GroupByNode

Group the data by a set of tags.

Can pass literal * to group by all dimensions. Example:

|groupBy(*)

func (*WindowNode) HoltWinters added in v1.0.0

func (n *WindowNode) HoltWinters(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set.

func (*WindowNode) HoltWintersWithFit added in v1.0.0

func (n *WindowNode) HoltWintersWithFit(field string, h, m int64, interval time.Duration) *InfluxQLNode

Compute the holt-winters (https://docs.influxdata.com/influxdb/latest/query_language/functions/#holt-winters) forecast of a data set. This method also outputs all the points used to fit the data in addition to the forecasted data.

func (*WindowNode) HttpOut

func (n *WindowNode) HttpOut(endpoint string) *HTTPOutNode

Create an HTTP output node that caches the most recent data it has received. The cached data are available at the given endpoint. The endpoint is the relative path from the API endpoint of the running task. For example, if the task endpoint is at `/kapacitor/v1/tasks/<task_id>` and endpoint is `top10`, then the data can be requested from `/kapacitor/v1/tasks/<task_id>/top10`.

func (*WindowNode) HttpPost added in v1.3.0

func (n *WindowNode) HttpPost(url string) *HTTPPostNode

Creates an HTTP Post node that POSTS received data to the provided HTTP endpoint.

func (*WindowNode) InfluxDBOut

func (n *WindowNode) InfluxDBOut() *InfluxDBOutNode

Create an influxdb output node that will store the incoming data into InfluxDB.

func (*WindowNode) Join

func (n *WindowNode) Join(others ...Node) *JoinNode

Join this node with other nodes. The data are joined on timestamp.

func (*WindowNode) K8sAutoscale added in v1.1.0

func (n *WindowNode) K8sAutoscale() *K8sAutoscaleNode

Create a node that can trigger autoscale events for a kubernetes cluster.

func (*WindowNode) Last added in v0.11.0

func (n *WindowNode) Last(field string) *InfluxQLNode

Select the last point.

func (*WindowNode) Log added in v0.11.0

func (n *WindowNode) Log() *LogNode

Create a node that logs all data it receives.

func (*WindowNode) Max added in v0.11.0

func (n *WindowNode) Max(field string) *InfluxQLNode

Select the maximum point.

func (*WindowNode) Mean added in v0.11.0

func (n *WindowNode) Mean(field string) *InfluxQLNode

Compute the mean of the data.

func (*WindowNode) Median added in v0.11.0

func (n *WindowNode) Median(field string) *InfluxQLNode

Compute the median of the data. Note, this method is not a selector, if you want the median point use `.percentile(field, 50.0)`.

func (*WindowNode) Min added in v0.11.0

func (n *WindowNode) Min(field string) *InfluxQLNode

Select the minimum point.

func (*WindowNode) Mode added in v1.0.0

func (n *WindowNode) Mode(field string) *InfluxQLNode

Compute the mode of the data.

func (*WindowNode) MovingAverage added in v1.0.0

func (n *WindowNode) MovingAverage(field string, window int64) *InfluxQLNode

Compute a moving average of the last window points. No points are emitted until the window is full.

func (*WindowNode) Percentile added in v0.11.0

func (n *WindowNode) Percentile(field string, percentile float64) *InfluxQLNode

Select a point at the given percentile. This is a selector function, no interpolation between points is performed.

func (*WindowNode) Sample

func (n *WindowNode) Sample(rate interface{}) *SampleNode

Create a new node that samples the incoming points or batches.

One point will be emitted every count or duration specified.

func (*WindowNode) Shift added in v0.11.0

func (n *WindowNode) Shift(shift time.Duration) *ShiftNode

Create a new node that shifts the incoming points or batches in time.

func (*WindowNode) Spread added in v0.11.0

func (n *WindowNode) Spread(field string) *InfluxQLNode

Compute the difference between `min` and `max` points.

func (*WindowNode) StateCount added in v1.3.0

func (n *WindowNode) StateCount(expression *ast.LambdaNode) *StateCountNode

Create a node that tracks number of consecutive points in a given state.

func (*WindowNode) StateDuration added in v1.3.0

func (n *WindowNode) StateDuration(expression *ast.LambdaNode) *StateDurationNode

Create a node that tracks duration in a given state.

func (*WindowNode) Stddev added in v0.11.0

func (n *WindowNode) Stddev(field string) *InfluxQLNode

Compute the standard deviation.

func (*WindowNode) Sum added in v0.11.0

func (n *WindowNode) Sum(field string) *InfluxQLNode

Compute the sum of all values.

func (*WindowNode) Top added in v0.11.0

func (n *WindowNode) Top(num int64, field string, fieldsAndTags ...string) *InfluxQLNode

Select the top `num` points for `field` and sort by any extra tags or fields.

func (*WindowNode) Union

func (n *WindowNode) Union(node ...Node) *UnionNode

Perform the union of this node and all other given nodes.

func (*WindowNode) Where

func (n *WindowNode) Where(expression *ast.LambdaNode) *WhereNode

Create a new node that filters the data stream by a given expression.

func (*WindowNode) Window

func (n *WindowNode) Window() *WindowNode

Create a new node that windows the stream by time.

NOTE: Window can only be applied to stream edges.

Jump to

Keyboard shortcuts

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