pipeline

package
v1.0.0-beta4 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2016 License: MIT Imports: 12 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 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 {

	// 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.
	//
	// 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

	//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 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"`

	// 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"`

	// 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 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"`
	// 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.
  • 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.
  • OpsGenie -- Send alert to OpsGenie.
  • VictorOps -- Send alert to VictorOps.
  • PagerDuty -- Send alert to PagerDuty.
  • 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")
        .email().to('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.

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 is combine on timestamp.

func (*AlertNode) Count added in v0.13.0

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

Count the number of points.

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) 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
   .meassage('{{ .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

and results of previous expressions are made 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 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 forecast of a data set.

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 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 "/api/v1/task/<task_name>" and endpoint is "top10", then the data can be requested from "/api/v1/task/<task_name>/top10".

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 is joined on timestamp.

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) 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) 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) 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 abvove usage will only trigger alerts to slack on state changes or at least every 10 minutes.

tick:property

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) Telegram added in v1.0.0

func (a *AlertNode) Telegram() *TelegramHandler

Send the alert to Telegram. 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 is combine on timestamp.

func (AlertaHandler) Count added in v0.13.0

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

Count the number of points.

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) 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

and results of previous expressions are made 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 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 forecast of a data set.

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 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 "/api/v1/task/<task_name>" and endpoint is "top10", then the data can be requested from "/api/v1/task/<task_name>/top10".

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 is joined on timestamp.

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) 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.

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) 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
  • connect_errors -- number of errors connecting to InfluxDB
  • 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, aka 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 normal. 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 is combine on timestamp.

func (*CombineNode) Count added in v1.0.0

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

Count the number of points.

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) 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

and results of previous expressions are made 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 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 forecast of a data set.

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 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 "/api/v1/task/<task_name>" and endpoint is "top10", then the data can be requested from "/api/v1/task/<task_name>/top10".

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 is joined on timestamp.

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) 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) 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 is combine on timestamp.

func (*DefaultNode) Count added in v0.13.0

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

Count the number of points.

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) 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

and results of previous expressions are made 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 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 forecast of a data set.

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 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 "/api/v1/task/<task_name>" and endpoint is "top10", then the data can be requested from "/api/v1/task/<task_name>/top10".

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 is joined on timestamp.

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) 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) 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 is combine on timestamp.

func (*DeleteNode) Count added in v1.0.0

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

Count the number of points.

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) 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

and results of previous expressions are made 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 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 forecast of a data set.

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 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 "/api/v1/task/<task_name>" and endpoint is "top10", then the data can be requested from "/api/v1/task/<task_name>/top10".

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 is joined on timestamp.

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) 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) 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. Deriviative is not a MapReduce 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 is combine on timestamp.

func (*DerivativeNode) Count added in v0.11.0

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

Count the number of points.

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) 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

and results of previous expressions are made 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 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 forecast of a data set.

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 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 "/api/v1/task/<task_name>" and endpoint is "top10", then the data can be requested from "/api/v1/task/<task_name>/top10".

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 is joined on timestamp.

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) 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) 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 is transferred
	NoEdge EdgeType = iota
	// Data is transferred immediately and one point at a time.
	StreamEdge
	// Data is transferred in batches as soon as it is 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 is combine on timestamp.

func (EmailHandler) Count added in v0.13.0

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

Count the number of points.

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) 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

and results of previous expressions are made 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 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 forecast of a data set.

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 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 "/api/v1/task/<task_name>" and endpoint is "top10", then the data can be requested from "/api/v1/task/<task_name>/top10".

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 is joined on timestamp.

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) 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) 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. 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
	QuiteFlag 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 and results of previous expressions are made available to later expressions. 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 and the result of a previous expression will be available in 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 is combine on timestamp.

func (*EvalNode) Count added in v0.11.0

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

Count the number of points.

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) 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

and results of previous expressions are made 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 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 forecast of a data set.

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 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 "/api/v1/task/<task_name>" and endpoint is "top10", then the data can be requested from "/api/v1/task/<task_name>/top10".

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 is joined on timestamp.

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.

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

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. In addition the new field `value2` is calculated and used in evaluating `inv_value2` but is discarded before the point is sent on to children 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) 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) 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 a named bucket from the field `value`. Then the `value_bucket` result is set as a tag 'value_bucket' on the point, instead of as a field.

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 a named bucket from the field `value`. Then the `value_bucket` result is set as a tag 'value_bucket' on the point, instead of as a field. The field `value` is also preserved on the point because of the `keep` property. 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 is combine on timestamp.

func (ExecHandler) Count added in v0.13.0

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

Count the number of points.

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) 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

and results of previous expressions are made 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 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 forecast of a data set.

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 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 "/api/v1/task/<task_name>" and endpoint is "top10", then the data can be requested from "/api/v1/task/<task_name>/top10".

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 is joined on timestamp.

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) 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) 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 is combine on timestamp.

func (*FlattenNode) Count added in v1.0.0

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

Count the number of points.

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) 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

and results of previous expressions are made 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 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 forecast of a data set.

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 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 "/api/v1/task/<task_name>" and endpoint is "top10", then the data can be requested from "/api/v1/task/<task_name>/top10".

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 is joined on timestamp.

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) 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) 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 is combine on timestamp.

func (*FromNode) Count added in v0.13.0

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

Count the number of points.

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) 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

and results of previous expressions are made 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 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 forecast of a data set.

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 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 "/api/v1/task/<task_name>" and endpoint is "top10", then the data can be requested from "/api/v1/task/<task_name>/top10".

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 is joined on timestamp.

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) 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) 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 is combine on timestamp.

func (*GroupByNode) Count added in v0.11.0

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

Count the number of points.

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) 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

and results of previous expressions are made 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 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 forecast of a data set.

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 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 "/api/v1/task/<task_name>" and endpoint is "top10", then the data can be requested from "/api/v1/task/<task_name>/top10".

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 is joined on timestamp.

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) 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) 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 is combine on timestamp.

func (*HTTPOutNode) Count added in v0.11.0

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

Count the number of points.

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) 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

and results of previous expressions are made 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 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 forecast of a data set.

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 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 "/api/v1/task/<task_name>" and endpoint is "top10", then the data can be requested from "/api/v1/task/<task_name>/top10".

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 is joined on timestamp.

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) 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) 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 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 is combine on timestamp.

func (HipChatHandler) Count added in v0.13.0

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

Count the number of points.

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) 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

and results of previous expressions are made 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 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 forecast of a data set.

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 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 "/api/v1/task/<task_name>" and endpoint is "top10", then the data can be requested from "/api/v1/task/<task_name>/top10".

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 is joined on timestamp.

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) 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) 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"`
	// 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) 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, aka 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 normal. 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 is combine on timestamp.

func (*InfluxQLNode) Count added in v0.11.0

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

Count the number of points.

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) 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

and results of previous expressions are made 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 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 forecast of a data set.

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 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 "/api/v1/task/<task_name>" and endpoint is "top10", then the data can be requested from "/api/v1/task/<task_name>/top10".

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 is joined on timestamp.

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) 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) 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 is combine on timestamp.

func (*JoinNode) Count added in v0.11.0

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

Count the number of points.

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) 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

and results of previous expressions are made 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 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 forecast of a data set.

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 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 "/api/v1/task/<task_name>" and endpoint is "top10", then the data can be requested from "/api/v1/task/<task_name>/top10".

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 is joined on timestamp.

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) On added in v0.11.0

func (j *JoinNode) On(dims ...string) *JoinNode

Join on specific dimensions. For example given two measurements:

1. building_power -- tagged by building, value is the total power consumed by the building. 2. floor_power -- tagged by building and floor, values is the total power consumed by the floor.

You want to calculate the percentage of the total building power consumed by each floor.

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) 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 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 is combine on timestamp.

func (LogHandler) Count added in v0.13.0

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

Count the number of points.

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) 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

and results of previous expressions are made 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 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 forecast of a data set.

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 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 "/api/v1/task/<task_name>" and endpoint is "top10", then the data can be requested from "/api/v1/task/<task_name>/top10".

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 is joined on timestamp.

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) 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) 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 is combine on timestamp.

func (*LogNode) Count added in v0.11.0

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

Count the number of points.

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) 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

and results of previous expressions are made 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 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 forecast of a data set.

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 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 "/api/v1/task/<task_name>" and endpoint is "top10", then the data can be requested from "/api/v1/task/<task_name>/top10".

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 is joined on timestamp.

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) 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) 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 is combine on timestamp.

func (*NoOpNode) Count added in v0.11.0

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

Count the number of points.

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) 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

and results of previous expressions are made 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 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 forecast of a data set.

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 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 "/api/v1/task/<task_name>" and endpoint is "top10", then the data can be requested from "/api/v1/task/<task_name>/top10".

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 is joined on timestamp.

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) 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) 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 is combine on timestamp.

func (OpsGenieHandler) Count added in v0.13.0

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

Count the number of points.

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) 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

and results of previous expressions are made 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 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 forecast of a data set.

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 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 "/api/v1/task/<task_name>" and endpoint is "top10", then the data can be requested from "/api/v1/task/<task_name>/top10".

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 is joined on timestamp.

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) 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) 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 is combine on timestamp.

func (PagerDutyHandler) Count added in v0.13.0

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

Count the number of points.

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) 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

and results of previous expressions are made 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 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 forecast of a data set.

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 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 "/api/v1/task/<task_name>" and endpoint is "top10", then the data can be requested from "/api/v1/task/<task_name>/top10".

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 is joined on timestamp.

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) 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) 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.Email

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 is combine on timestamp.

func (PostHandler) Count added in v0.13.0

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

Count the number of points.

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) 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

and results of previous expressions are made 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 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 forecast of a data set.

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 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 "/api/v1/task/<task_name>" and endpoint is "top10", then the data can be requested from "/api/v1/task/<task_name>/top10".

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 is joined on timestamp.

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) 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) 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 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

	// 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) 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 is combine on timestamp.

func (*QueryNode) Count added in v0.13.0

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

Count the number of points.

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) 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

and results of previous expressions are made 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.

Example:

batch
    |query(...)
        .groupBy(time(10s), 'tag1', 'tag2'))
        .align()

A group by time offset is also possible

Example:

batch
    |query(...)
        .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.

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 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 forecast of a data set.

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 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 "/api/v1/task/<task_name>" and endpoint is "top10", then the data can be requested from "/api/v1/task/<task_name>/top10".

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 is joined on timestamp.

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) 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) 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 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 is combine on timestamp.

func (*SampleNode) Count

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

Count the number of points.

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) 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

and results of previous expressions are made 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 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 forecast of a data set.

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 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 "/api/v1/task/<task_name>" and endpoint is "top10", then the data can be requested from "/api/v1/task/<task_name>/top10".

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 is joined on timestamp.

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) 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) 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
}

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 is combine on timestamp.

func (SensuHandler) Count added in v0.13.0

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

Count the number of points.

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) 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

and results of previous expressions are made 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 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 forecast of a data set.

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 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 "/api/v1/task/<task_name>" and endpoint is "top10", then the data can be requested from "/api/v1/task/<task_name>/top10".

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 is joined on timestamp.

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) 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) 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 is combine on timestamp.

func (*ShiftNode) Count added in v0.11.0

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

Count the number of points.

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) 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

and results of previous expressions are made 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 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 forecast of a data set.

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 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 "/api/v1/task/<task_name>" and endpoint is "top10", then the data can be requested from "/api/v1/task/<task_name>/top10".

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 is joined on timestamp.

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) 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) 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
}

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 is combine on timestamp.

func (SlackHandler) Count added in v0.13.0

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

Count the number of points.

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) 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

and results of previous expressions are made 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 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 forecast of a data set.

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 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 "/api/v1/task/<task_name>" and endpoint is "top10", then the data can be requested from "/api/v1/task/<task_name>/top10".

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 is joined on timestamp.

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) 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) 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 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 is combine on timestamp.

func (*StatsNode) Count added in v0.11.0

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

Count the number of points.

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) 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

and results of previous expressions are made 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 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 forecast of a data set.

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 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 "/api/v1/task/<task_name>" and endpoint is "top10", then the data can be requested from "/api/v1/task/<task_name>/top10".

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 is joined on timestamp.

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) 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) 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, aka 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 normal. 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 is combine on timestamp.

func (TalkHandler) Count added in v0.13.0

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

Count the number of points.

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) 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

and results of previous expressions are made 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 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 forecast of a data set.

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 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 "/api/v1/task/<task_name>" and endpoint is "top10", then the data can be requested from "/api/v1/task/<task_name>/top10".

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 is joined on timestamp.

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) 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) 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 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 is combine on timestamp.

func (TelegramHandler) Count added in v1.0.0

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

Count the number of points.

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) 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

and results of previous expressions are made 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 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 forecast of a data set.

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 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 "/api/v1/task/<task_name>" and endpoint is "top10", then the data can be requested from "/api/v1/task/<task_name>/top10".

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 is joined on timestamp.

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) 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) 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 is combine on timestamp.

func (*UDFNode) Count added in v0.11.0

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

Count the number of points.

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) 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

and results of previous expressions are made 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 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 forecast of a data set.

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 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 "/api/v1/task/<task_name>" and endpoint is "top10", then the data can be requested from "/api/v1/task/<task_name>/top10".

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 is joined on timestamp.

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) 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) 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 is combine on timestamp.

func (*UnionNode) Count added in v0.11.0

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

Count the number of points.

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) 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

and results of previous expressions are made 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 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 forecast of a data set.

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 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 "/api/v1/task/<task_name>" and endpoint is "top10", then the data can be requested from "/api/v1/task/<task_name>/top10".

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 is joined on timestamp.

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) 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) 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 is combine on timestamp.

func (VictorOpsHandler) Count added in v0.13.0

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

Count the number of points.

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) 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

and results of previous expressions are made 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 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 forecast of a data set.

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 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 "/api/v1/task/<task_name>" and endpoint is "top10", then the data can be requested from "/api/v1/task/<task_name>/top10".

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 is joined on timestamp.

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) 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) 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 is combine on timestamp.

func (*WhereNode) Count added in v0.11.0

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

Count the number of points.

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) 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

and results of previous expressions are made 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 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 forecast of a data set.

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 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 "/api/v1/task/<task_name>" and endpoint is "top10", then the data can be requested from "/api/v1/task/<task_name>/top10".

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 is joined on timestamp.

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) 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) 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 (w *WhereNode) Where(lambda *ast.LambdaNode) *WhereNode

And another expression onto the existing 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.
	Every time.Duration
	// Wether to align the window edges with the zero time
	// tick:ignore
	AlignFlag bool `tick:"Align"`
	// contains filtered or unexported fields
}

Windows data over time. A window has a length defined by `period` and a frequency at which it emits the window to the pipeline.

Example:

stream
    |window()
        .period(10m)
        .every(5m)
    |httpOut('recent')

The above windowing example emits a window to the pipeline every `5 minutes` and the window contains the last `10 minutes` worth of data. As a result each time the window is emitted it contains half new data and half old data.

NOTE: Time for a window (or any node) is implemented by inspecting the times on the incoming data points. As a result if the incoming data stream stops then no more windows will be emitted because time is no longer increasing for the window node.

func (*WindowNode) Alert

func (n *WindowNode) Alert() *AlertNode

Create an alert node, which can trigger alerts.

func (*WindowNode) Align

func (w *WindowNode) Align() *WindowNode

Wether to align the window edges with the zero time. If not aligned the window starts and ends relative to the first data point it receives. 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 is combine on timestamp.

func (*WindowNode) Count added in v0.11.0

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

Count the number of points.

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) 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

and results of previous expressions are made available to later expressions.

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 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 forecast of a data set.

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 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 "/api/v1/task/<task_name>" and endpoint is "top10", then the data can be requested from "/api/v1/task/<task_name>/top10".

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 is joined on timestamp.

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) 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) 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