pipeline

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2016 License: MIT Imports: 8 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...
	//   .groupBy('service')
	//   .alert()
	//      .id('kapacitor/{{ index .Tags "service" }}')
	//
	// ID: kapacitor/authentication
	//
	// Example:
	//   stream...
	//   .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...
	//   .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 tick.Node
	// Filter expression for the WARNING alert level.
	// An empty value indicates the level is invalid and is skipped.
	Warn tick.Node
	// Filter expression for the CRITICAL alert level.
	// An empty value indicates the level is invalid and is skipped.
	Crit tick.Node

	//tick:ignore
	UseFlapping bool
	//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

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

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

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

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

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

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

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

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

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

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

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

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

	// Send alert to Talk.
	// tick:ignore
	TalkHandlers []*TalkHandler
	// 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/v0.11/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 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.

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

It is assumed that each successive level filters a subset of the previous level. As a result, the filter will only be applied if a data point passed the previous level. In the above example, if value = 15 then the INFO and WARNING expressions would be evaluated, but not the CRITICAL expression. Each expression maintains its own state.

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

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

tick:ignore

func (*AlertNode) Deadman added in v0.10.0

func (n *AlertNode) Deadman(threshold float64, interval time.Duration, expr ...tick.Node) *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)
      .derivative('collected')
          .unit(10s)
          .nonNegative()
      .alert()
          .id('node \'stream0\' in task \'{{ .TaskName }}\'')
          .message('{{ .ID }} is {{ if eq .Level "OK" }}alive{{ else }}dead{{ end }}: {{ index .Fields "collected" | printf "%0.3f" }} points/10s.')
          .crit(lamdba: "collected" <= 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 1s 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 (*AlertNode) Desc

func (n *AlertNode) Desc() string

tick:ignore

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

func (n *AlertNode) ID() ID

tick:ignore

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. tick:property

func (*AlertNode) Name

func (n *AlertNode) Name() string

tick:ignore

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

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

tick:ignore

func (*AlertNode) Post

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

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

func (*AlertNode) Provides

func (n *AlertNode) Provides() EdgeType

tick:ignore

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

func (n *AlertNode) SetName(name string)

tick:ignore

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

func (a *AlertNode) StateChangesOnly() *AlertNode

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

Example:

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

tick:property

func (*AlertNode) Stats added in v0.10.0

func (n *AlertNode) 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 (*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) 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) Wants

func (n *AlertNode) Wants() EdgeType

tick:ignore

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 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:embedded:AlertNode.Alerta

func (AlertaHandler) Children added in v0.10.0

func (n AlertaHandler) Children() []Node

tick:ignore

func (AlertaHandler) Deadman added in v0.10.0

func (n AlertaHandler) Deadman(threshold float64, interval time.Duration, expr ...tick.Node) *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)
      .derivative('collected')
          .unit(10s)
          .nonNegative()
      .alert()
          .id('node \'stream0\' in task \'{{ .TaskName }}\'')
          .message('{{ .ID }} is {{ if eq .Level "OK" }}alive{{ else }}dead{{ end }}: {{ index .Fields "collected" | printf "%0.3f" }} points/10s.')
          .crit(lamdba: "collected" <= 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 1s 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 (AlertaHandler) Desc added in v0.10.0

func (n AlertaHandler) Desc() string

tick:ignore

func (AlertaHandler) ID added in v0.10.0

func (n AlertaHandler) ID() ID

tick:ignore

func (AlertaHandler) Name added in v0.10.0

func (n AlertaHandler) Name() string

tick:ignore

func (AlertaHandler) Parents added in v0.10.0

func (n AlertaHandler) Parents() []Node

tick:ignore

func (AlertaHandler) Provides added in v0.10.0

func (n AlertaHandler) Provides() EdgeType

tick:ignore

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) SetName added in v0.10.0

func (n AlertaHandler) SetName(name string)

tick:ignore

func (AlertaHandler) Stats added in v0.10.0

func (n AlertaHandler) 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 (AlertaHandler) Wants added in v0.10.0

func (n AlertaHandler) Wants() EdgeType

tick:ignore

type BatchNode

type BatchNode 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

	// 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{}

	// 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 BatchNode 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 (*BatchNode) Alert

func (n *BatchNode) Alert() *AlertNode

Create an alert node, which can trigger alerts.

func (*BatchNode) Bottom added in v0.11.0

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

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

func (*BatchNode) Count added in v0.11.0

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

Count the number of points.

func (*BatchNode) Derivative

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

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

func (*BatchNode) Distinct added in v0.11.0

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

Produce batch of only the distinct points.

func (*BatchNode) Eval

func (n *BatchNode) Eval(expressions ...tick.Node) *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 (*BatchNode) First added in v0.11.0

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

Select the first point.

func (*BatchNode) GroupBy

func (b *BatchNode) GroupBy(d ...interface{}) *BatchNode

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. More details: https://influxdb.com/docs/v0.9/query_language/data_exploration.html#the-group-by-clause

Example:

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

tick:property

func (*BatchNode) HttpOut

func (n *BatchNode) 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 (*BatchNode) InfluxDBOut

func (n *BatchNode) InfluxDBOut() *InfluxDBOutNode

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

func (*BatchNode) Join

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

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

func (*BatchNode) Last added in v0.11.0

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

Select the last point.

func (*BatchNode) Log added in v0.11.0

func (n *BatchNode) Log() *LogNode

Create a node that logs all data it receives.

func (*BatchNode) MapReduce

func (n *BatchNode) MapReduce(mr MapReduceInfo) *ReduceNode

> *DEPRECATION WARNING*: As of v0.11 you can use the new InfluxQLNode to perform map reduce functions. This way of performing influxql functions will be removed in the 0.12 release.

Perform a map-reduce operation on the data. The built-in functions under `influxql` provide the selection,aggregation, and transformation functions from the InfluxQL language.

MapReduce may be applied to either a batch or a stream edge. In the case of a batch each batch is passed to the mapper independently. In the case of a stream all incoming data points that have the exact same time are combined into a batch and sent to the mapper.

func (*BatchNode) Max added in v0.11.0

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

Select the maximum point.

func (*BatchNode) Mean added in v0.11.0

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

Compute the mean of the data.

func (*BatchNode) Median added in v0.11.0

func (n *BatchNode) 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 (*BatchNode) Min added in v0.11.0

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

Select the minimum point.

func (*BatchNode) Percentile added in v0.11.0

func (n *BatchNode) 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 (*BatchNode) Sample

func (n *BatchNode) 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 (*BatchNode) Shift added in v0.11.0

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

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

func (*BatchNode) Spread added in v0.11.0

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

Compute the difference between min and max points.

func (*BatchNode) Stddev added in v0.11.0

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

Compute the standard deviation.

func (*BatchNode) Sum added in v0.11.0

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

Compute the sum of all values.

func (*BatchNode) Top added in v0.11.0

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

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

func (*BatchNode) Union

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

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

func (*BatchNode) Where

func (n *BatchNode) Where(expression tick.Node) *WhereNode

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

func (*BatchNode) Window

func (n *BatchNode) 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 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
	// 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) Count added in v0.11.0

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

Count the number of points.

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

func (n *DerivativeNode) Eval(expressions ...tick.Node) *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) 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) 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) MapReduce

func (n *DerivativeNode) MapReduce(mr MapReduceInfo) *ReduceNode

> *DEPRECATION WARNING*: As of v0.11 you can use the new InfluxQLNode to perform map reduce functions. This way of performing influxql functions will be removed in the 0.12 release.

Perform a map-reduce operation on the data. The built-in functions under `influxql` provide the selection,aggregation, and transformation functions from the InfluxQL language.

MapReduce may be applied to either a batch or a stream edge. In the case of a batch each batch is passed to the mapper independently. In the case of a stream all incoming data points that have the exact same time are combined into a batch and sent to the mapper.

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 tick.Node) *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 transfered
	NoEdge EdgeType = iota
	// Data is transfered immediately and one point at a time.
	StreamEdge
	// Data is transfered in batches as soon as it is ready.
	BatchEdge
	// Data is transfered as it is received from a map function.
	ReduceEdge
)

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
}

Email AlertHandler tick:embedded:AlertNode.Email

func (EmailHandler) Children added in v0.2.4

func (n EmailHandler) Children() []Node

tick:ignore

func (EmailHandler) Deadman added in v0.10.0

func (n EmailHandler) Deadman(threshold float64, interval time.Duration, expr ...tick.Node) *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)
      .derivative('collected')
          .unit(10s)
          .nonNegative()
      .alert()
          .id('node \'stream0\' in task \'{{ .TaskName }}\'')
          .message('{{ .ID }} is {{ if eq .Level "OK" }}alive{{ else }}dead{{ end }}: {{ index .Fields "collected" | printf "%0.3f" }} points/10s.')
          .crit(lamdba: "collected" <= 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 1s 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 (EmailHandler) Desc added in v0.2.4

func (n EmailHandler) Desc() string

tick:ignore

func (EmailHandler) ID added in v0.2.4

func (n EmailHandler) ID() ID

tick:ignore

func (EmailHandler) Name added in v0.2.4

func (n EmailHandler) Name() string

tick:ignore

func (EmailHandler) Parents added in v0.2.4

func (n EmailHandler) Parents() []Node

tick:ignore

func (EmailHandler) Provides added in v0.2.4

func (n EmailHandler) Provides() EdgeType

tick:ignore

func (EmailHandler) SetName added in v0.2.4

func (n EmailHandler) SetName(name string)

tick:ignore

func (EmailHandler) Stats added in v0.10.0

func (n EmailHandler) 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 (EmailHandler) Wants added in v0.2.4

func (n EmailHandler) Wants() EdgeType

tick:ignore

type EvalNode

type EvalNode struct {

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

	// tick:ignore
	Expressions []tick.Node

	// tick:ignore
	KeepFlag bool
	// List of fields to keep
	// if empty and KeepFlag is true
	// keep all fields.
	// tick:ignore
	KeepList []string
	// 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.

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

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

Count the number of points.

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

func (n *EvalNode) Eval(expressions ...tick.Node) *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) 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) 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) MapReduce

func (n *EvalNode) MapReduce(mr MapReduceInfo) *ReduceNode

> *DEPRECATION WARNING*: As of v0.11 you can use the new InfluxQLNode to perform map reduce functions. This way of performing influxql functions will be removed in the 0.12 release.

Perform a map-reduce operation on the data. The built-in functions under `influxql` provide the selection,aggregation, and transformation functions from the InfluxQL language.

MapReduce may be applied to either a batch or a stream edge. In the case of a batch each batch is passed to the mapper independently. In the case of a stream all incoming data points that have the exact same time are combined into a batch and sent to the mapper.

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) 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) 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 tick.Node) *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) Children added in v0.2.4

func (n ExecHandler) Children() []Node

tick:ignore

func (ExecHandler) Deadman added in v0.10.0

func (n ExecHandler) Deadman(threshold float64, interval time.Duration, expr ...tick.Node) *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)
      .derivative('collected')
          .unit(10s)
          .nonNegative()
      .alert()
          .id('node \'stream0\' in task \'{{ .TaskName }}\'')
          .message('{{ .ID }} is {{ if eq .Level "OK" }}alive{{ else }}dead{{ end }}: {{ index .Fields "collected" | printf "%0.3f" }} points/10s.')
          .crit(lamdba: "collected" <= 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 1s 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 (ExecHandler) Desc added in v0.2.4

func (n ExecHandler) Desc() string

tick:ignore

func (ExecHandler) ID added in v0.2.4

func (n ExecHandler) ID() ID

tick:ignore

func (ExecHandler) Name added in v0.2.4

func (n ExecHandler) Name() string

tick:ignore

func (ExecHandler) Parents added in v0.2.4

func (n ExecHandler) Parents() []Node

tick:ignore

func (ExecHandler) Provides added in v0.2.4

func (n ExecHandler) Provides() EdgeType

tick:ignore

func (ExecHandler) SetName added in v0.2.4

func (n ExecHandler) SetName(name string)

tick:ignore

func (ExecHandler) Stats added in v0.10.0

func (n ExecHandler) 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 (ExecHandler) Wants added in v0.2.4

func (n ExecHandler) Wants() EdgeType

tick:ignore

type FloatBulkPointAggregator added in v0.11.0

type FloatBulkPointAggregator interface {
	influxql.FloatPointAggregator
	influxql.FloatBulkPointAggregator
}

type GroupByNode

type GroupByNode struct {

	//The dimensions by which to group to the data.
	// tick:ignore
	Dimensions []interface{}
	// 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) Count added in v0.11.0

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

Count the number of points.

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

func (n *GroupByNode) Eval(expressions ...tick.Node) *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) 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) 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) MapReduce

func (n *GroupByNode) MapReduce(mr MapReduceInfo) *ReduceNode

> *DEPRECATION WARNING*: As of v0.11 you can use the new InfluxQLNode to perform map reduce functions. This way of performing influxql functions will be removed in the 0.12 release.

Perform a map-reduce operation on the data. The built-in functions under `influxql` provide the selection,aggregation, and transformation functions from the InfluxQL language.

MapReduce may be applied to either a batch or a stream edge. In the case of a batch each batch is passed to the mapper independently. In the case of a stream all incoming data points that have the exact same time are combined into a batch and sent to the mapper.

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 tick.Node) *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 "/task/<task_name>" and endpoint is "top10", then the data can be requested from "/task/<task_name>/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) Count added in v0.11.0

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

Count the number of points.

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

func (n *HTTPOutNode) Eval(expressions ...tick.Node) *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) 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) 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) MapReduce added in v0.11.0

func (n *HTTPOutNode) MapReduce(mr MapReduceInfo) *ReduceNode

> *DEPRECATION WARNING*: As of v0.11 you can use the new InfluxQLNode to perform map reduce functions. This way of performing influxql functions will be removed in the 0.12 release.

Perform a map-reduce operation on the data. The built-in functions under `influxql` provide the selection,aggregation, and transformation functions from the InfluxQL language.

MapReduce may be applied to either a batch or a stream edge. In the case of a batch each batch is passed to the mapper independently. In the case of a stream all incoming data points that have the exact same time are combined into a batch and sent to the mapper.

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 tick.Node) *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) Children added in v0.2.4

func (n HipChatHandler) Children() []Node

tick:ignore

func (HipChatHandler) Deadman added in v0.10.0

func (n HipChatHandler) Deadman(threshold float64, interval time.Duration, expr ...tick.Node) *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)
      .derivative('collected')
          .unit(10s)
          .nonNegative()
      .alert()
          .id('node \'stream0\' in task \'{{ .TaskName }}\'')
          .message('{{ .ID }} is {{ if eq .Level "OK" }}alive{{ else }}dead{{ end }}: {{ index .Fields "collected" | printf "%0.3f" }} points/10s.')
          .crit(lamdba: "collected" <= 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 1s 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 (HipChatHandler) Desc added in v0.2.4

func (n HipChatHandler) Desc() string

tick:ignore

func (HipChatHandler) ID added in v0.2.4

func (n HipChatHandler) ID() ID

tick:ignore

func (HipChatHandler) Name added in v0.2.4

func (n HipChatHandler) Name() string

tick:ignore

func (HipChatHandler) Parents added in v0.2.4

func (n HipChatHandler) Parents() []Node

tick:ignore

func (HipChatHandler) Provides added in v0.2.4

func (n HipChatHandler) Provides() EdgeType

tick:ignore

func (HipChatHandler) SetName added in v0.2.4

func (n HipChatHandler) SetName(name string)

tick:ignore

func (HipChatHandler) Stats added in v0.10.0

func (n HipChatHandler) 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 (HipChatHandler) Wants added in v0.2.4

func (n HipChatHandler) Wants() EdgeType

tick:ignore

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

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 ...tick.Node) *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)
      .derivative('collected')
          .unit(10s)
          .nonNegative()
      .alert()
          .id('node \'stream0\' in task \'{{ .TaskName }}\'')
          .message('{{ .ID }} is {{ if eq .Level "OK" }}alive{{ else }}dead{{ end }}: {{ index .Fields "collected" | printf "%0.3f" }} points/10s.')
          .crit(lamdba: "collected" <= 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 1s 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
	// 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) Count added in v0.11.0

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

Count the number of points.

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

func (n *InfluxQLNode) Eval(expressions ...tick.Node) *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) 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) 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) MapReduce added in v0.11.0

func (n *InfluxQLNode) MapReduce(mr MapReduceInfo) *ReduceNode

> *DEPRECATION WARNING*: As of v0.11 you can use the new InfluxQLNode to perform map reduce functions. This way of performing influxql functions will be removed in the 0.12 release.

Perform a map-reduce operation on the data. The built-in functions under `influxql` provide the selection,aggregation, and transformation functions from the InfluxQL language.

MapReduce may be applied to either a batch or a stream edge. In the case of a batch each batch is passed to the mapper independently. In the case of a stream all incoming data points that have the exact same time are combined into a batch and sent to the mapper.

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 tick.Node) *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

	// The dimensions on which to join
	// tick:ignore
	Dimensions []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.
	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) Count added in v0.11.0

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

Count the number of points.

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

func (n *JoinNode) Eval(expressions ...tick.Node) *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) 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) 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) MapReduce

func (n *JoinNode) MapReduce(mr MapReduceInfo) *ReduceNode

> *DEPRECATION WARNING*: As of v0.11 you can use the new InfluxQLNode to perform map reduce functions. This way of performing influxql functions will be removed in the 0.12 release.

Perform a map-reduce operation on the data. The built-in functions under `influxql` provide the selection,aggregation, and transformation functions from the InfluxQL language.

MapReduce may be applied to either a batch or a stream edge. In the case of a batch each batch is passed to the mapper independently. In the case of a stream all incoming data points that have the exact same time are combined into a batch and sent to the mapper.

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 specfic 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 buidling = 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 tick.Node) *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
}

tick:embedded:AlertNode.Log

func (LogHandler) Children added in v0.2.4

func (n LogHandler) Children() []Node

tick:ignore

func (LogHandler) Deadman added in v0.10.0

func (n LogHandler) Deadman(threshold float64, interval time.Duration, expr ...tick.Node) *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)
      .derivative('collected')
          .unit(10s)
          .nonNegative()
      .alert()
          .id('node \'stream0\' in task \'{{ .TaskName }}\'')
          .message('{{ .ID }} is {{ if eq .Level "OK" }}alive{{ else }}dead{{ end }}: {{ index .Fields "collected" | printf "%0.3f" }} points/10s.')
          .crit(lamdba: "collected" <= 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 1s 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 (LogHandler) Desc added in v0.2.4

func (n LogHandler) Desc() string

tick:ignore

func (LogHandler) ID added in v0.2.4

func (n LogHandler) ID() ID

tick:ignore

func (LogHandler) Name added in v0.2.4

func (n LogHandler) Name() string

tick:ignore

func (LogHandler) Parents added in v0.2.4

func (n LogHandler) Parents() []Node

tick:ignore

func (LogHandler) Provides added in v0.2.4

func (n LogHandler) Provides() EdgeType

tick:ignore

func (LogHandler) SetName added in v0.2.4

func (n LogHandler) SetName(name string)

tick:ignore

func (LogHandler) Stats added in v0.10.0

func (n LogHandler) 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 (LogHandler) Wants added in v0.2.4

func (n LogHandler) Wants() EdgeType

tick:ignore

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

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

Count the number of points.

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

func (n *LogNode) Eval(expressions ...tick.Node) *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) 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) 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) MapReduce added in v0.11.0

func (n *LogNode) MapReduce(mr MapReduceInfo) *ReduceNode

> *DEPRECATION WARNING*: As of v0.11 you can use the new InfluxQLNode to perform map reduce functions. This way of performing influxql functions will be removed in the 0.12 release.

Perform a map-reduce operation on the data. The built-in functions under `influxql` provide the selection,aggregation, and transformation functions from the InfluxQL language.

MapReduce may be applied to either a batch or a stream edge. In the case of a batch each batch is passed to the mapper independently. In the case of a stream all incoming data points that have the exact same time are combined into a batch and sent to the mapper.

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 tick.Node) *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 MapNode

type MapNode struct {

	// The map function
	// tick:ignore
	Map interface{}
	// contains filtered or unexported fields
}

> *DEPRECATION WARNING*: As of v0.11 you can use the new InfluxQLNode to perform map reduce functions. This way of performing influxql functions will be removed in the 0.12 release.

Performs a map operation on the data stream. In the map-reduce framework it is assumed that several different partitions of the data can be 'mapped' in parallel while only one 'reduce' operation will process all of the data stream.

Example:

stream
    .window()
        .period(10s)
        .every(10s)
    // Sum the values for each 10s window of data.
    .sum('value')
    ...

func (*MapNode) Alert

func (n *MapNode) Alert() *AlertNode

Create an alert node, which can trigger alerts.

func (*MapNode) Bottom added in v0.11.0

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

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

func (*MapNode) Count added in v0.11.0

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

Count the number of points.

func (*MapNode) Derivative

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

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

func (*MapNode) Distinct added in v0.11.0

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

Produce batch of only the distinct points.

func (*MapNode) Eval

func (n *MapNode) Eval(expressions ...tick.Node) *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 (*MapNode) First added in v0.11.0

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

Select the first point.

func (*MapNode) GroupBy

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

Group the data by a set of tags.

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

.groupBy(*)

func (*MapNode) HttpOut

func (n *MapNode) 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 (*MapNode) InfluxDBOut

func (n *MapNode) InfluxDBOut() *InfluxDBOutNode

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

func (*MapNode) Join

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

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

func (*MapNode) Last added in v0.11.0

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

Select the last point.

func (*MapNode) Log added in v0.11.0

func (n *MapNode) Log() *LogNode

Create a node that logs all data it receives.

func (*MapNode) MapReduce

func (n *MapNode) MapReduce(mr MapReduceInfo) *ReduceNode

> *DEPRECATION WARNING*: As of v0.11 you can use the new InfluxQLNode to perform map reduce functions. This way of performing influxql functions will be removed in the 0.12 release.

Perform a map-reduce operation on the data. The built-in functions under `influxql` provide the selection,aggregation, and transformation functions from the InfluxQL language.

MapReduce may be applied to either a batch or a stream edge. In the case of a batch each batch is passed to the mapper independently. In the case of a stream all incoming data points that have the exact same time are combined into a batch and sent to the mapper.

func (*MapNode) Max added in v0.11.0

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

Select the maximum point.

func (*MapNode) Mean added in v0.11.0

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

Compute the mean of the data.

func (*MapNode) Median added in v0.11.0

func (n *MapNode) 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 (*MapNode) Min added in v0.11.0

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

Select the minimum point.

func (*MapNode) Percentile added in v0.11.0

func (n *MapNode) 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 (*MapNode) Sample

func (n *MapNode) 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 (*MapNode) Shift added in v0.11.0

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

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

func (*MapNode) Spread added in v0.11.0

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

Compute the difference between min and max points.

func (*MapNode) Stddev added in v0.11.0

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

Compute the standard deviation.

func (*MapNode) Sum added in v0.11.0

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

Compute the sum of all values.

func (*MapNode) Top added in v0.11.0

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

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

func (*MapNode) Union

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

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

func (*MapNode) Where

func (n *MapNode) Where(expression tick.Node) *WhereNode

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

func (*MapNode) Window

func (n *MapNode) Window() *WindowNode

Create a new node that windows the stream by time.

NOTE: Window can only be applied to stream edges.

type MapReduceInfo

type MapReduceInfo struct {
	Map    interface{}
	Reduce interface{}
	Edge   EdgeType
}

tick:ignore

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

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

Count the number of points.

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

func (n *NoOpNode) Eval(expressions ...tick.Node) *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) 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) 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) MapReduce added in v0.11.0

func (n *NoOpNode) MapReduce(mr MapReduceInfo) *ReduceNode

> *DEPRECATION WARNING*: As of v0.11 you can use the new InfluxQLNode to perform map reduce functions. This way of performing influxql functions will be removed in the 0.12 release.

Perform a map-reduce operation on the data. The built-in functions under `influxql` provide the selection,aggregation, and transformation functions from the InfluxQL language.

MapReduce may be applied to either a batch or a stream edge. In the case of a batch each batch is passed to the mapper independently. In the case of a stream all incoming data points that have the exact same time are combined into a batch and sent to the mapper.

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 tick.Node) *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

	// OpsGenie Recipients.
	// tick:ignore
	RecipientsList []string
}

tick:embedded:AlertNode.OpsGenie

func (OpsGenieHandler) Children added in v0.2.4

func (n OpsGenieHandler) Children() []Node

tick:ignore

func (OpsGenieHandler) Deadman added in v0.10.0

func (n OpsGenieHandler) Deadman(threshold float64, interval time.Duration, expr ...tick.Node) *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)
      .derivative('collected')
          .unit(10s)
          .nonNegative()
      .alert()
          .id('node \'stream0\' in task \'{{ .TaskName }}\'')
          .message('{{ .ID }} is {{ if eq .Level "OK" }}alive{{ else }}dead{{ end }}: {{ index .Fields "collected" | printf "%0.3f" }} points/10s.')
          .crit(lamdba: "collected" <= 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 1s 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 (OpsGenieHandler) Desc added in v0.2.4

func (n OpsGenieHandler) Desc() string

tick:ignore

func (OpsGenieHandler) ID added in v0.2.4

func (n OpsGenieHandler) ID() ID

tick:ignore

func (OpsGenieHandler) Name added in v0.2.4

func (n OpsGenieHandler) Name() string

tick:ignore

func (OpsGenieHandler) Parents added in v0.2.4

func (n OpsGenieHandler) Parents() []Node

tick:ignore

func (OpsGenieHandler) Provides added in v0.2.4

func (n OpsGenieHandler) Provides() EdgeType

tick:ignore

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) SetName added in v0.2.4

func (n OpsGenieHandler) SetName(name string)

tick:ignore

func (OpsGenieHandler) Stats added in v0.10.0

func (n OpsGenieHandler) 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 (*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) Wants added in v0.2.4

func (n OpsGenieHandler) Wants() EdgeType

tick:ignore

type PagerDutyHandler added in v0.2.4

type PagerDutyHandler struct {
	*AlertNode
}

tick:embedded:AlertNode.PagerDuty

func (PagerDutyHandler) Children added in v0.2.4

func (n PagerDutyHandler) Children() []Node

tick:ignore

func (PagerDutyHandler) Deadman added in v0.10.0

func (n PagerDutyHandler) Deadman(threshold float64, interval time.Duration, expr ...tick.Node) *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)
      .derivative('collected')
          .unit(10s)
          .nonNegative()
      .alert()
          .id('node \'stream0\' in task \'{{ .TaskName }}\'')
          .message('{{ .ID }} is {{ if eq .Level "OK" }}alive{{ else }}dead{{ end }}: {{ index .Fields "collected" | printf "%0.3f" }} points/10s.')
          .crit(lamdba: "collected" <= 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 1s 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 (PagerDutyHandler) Desc added in v0.2.4

func (n PagerDutyHandler) Desc() string

tick:ignore

func (PagerDutyHandler) ID added in v0.2.4

func (n PagerDutyHandler) ID() ID

tick:ignore

func (PagerDutyHandler) Name added in v0.2.4

func (n PagerDutyHandler) Name() string

tick:ignore

func (PagerDutyHandler) Parents added in v0.2.4

func (n PagerDutyHandler) Parents() []Node

tick:ignore

func (PagerDutyHandler) Provides added in v0.2.4

func (n PagerDutyHandler) Provides() EdgeType

tick:ignore

func (PagerDutyHandler) SetName added in v0.2.4

func (n PagerDutyHandler) SetName(name string)

tick:ignore

func (PagerDutyHandler) Stats added in v0.10.0

func (n PagerDutyHandler) 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 (PagerDutyHandler) Wants added in v0.2.4

func (n PagerDutyHandler) Wants() EdgeType

tick:ignore

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 *tick.Scope, deadman DeadmanService) (*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) 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) Children added in v0.2.4

func (n PostHandler) Children() []Node

tick:ignore

func (PostHandler) Deadman added in v0.10.0

func (n PostHandler) Deadman(threshold float64, interval time.Duration, expr ...tick.Node) *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)
      .derivative('collected')
          .unit(10s)
          .nonNegative()
      .alert()
          .id('node \'stream0\' in task \'{{ .TaskName }}\'')
          .message('{{ .ID }} is {{ if eq .Level "OK" }}alive{{ else }}dead{{ end }}: {{ index .Fields "collected" | printf "%0.3f" }} points/10s.')
          .crit(lamdba: "collected" <= 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 1s 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 (PostHandler) Desc added in v0.2.4

func (n PostHandler) Desc() string

tick:ignore

func (PostHandler) ID added in v0.2.4

func (n PostHandler) ID() ID

tick:ignore

func (PostHandler) Name added in v0.2.4

func (n PostHandler) Name() string

tick:ignore

func (PostHandler) Parents added in v0.2.4

func (n PostHandler) Parents() []Node

tick:ignore

func (PostHandler) Provides added in v0.2.4

func (n PostHandler) Provides() EdgeType

tick:ignore

func (PostHandler) SetName added in v0.2.4

func (n PostHandler) SetName(name string)

tick:ignore

func (PostHandler) Stats added in v0.10.0

func (n PostHandler) 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 (PostHandler) Wants added in v0.2.4

func (n PostHandler) Wants() EdgeType

tick:ignore

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)

	CreateIntegerFloatReducer     func() (influxql.IntegerPointAggregator, influxql.FloatPointEmitter)
	CreateIntegerBulkFloatReducer func() (IntegerBulkPointAggregator, influxql.FloatPointEmitter)

	CreateIntegerReducer     func() (influxql.IntegerPointAggregator, influxql.IntegerPointEmitter)
	CreateIntegerBulkReducer func() (IntegerBulkPointAggregator, influxql.IntegerPointEmitter)

	TopBottomCallInfo *TopBottomCallInfo
}

type ReduceNode

type ReduceNode struct {

	//The reduce function
	// tick:ignore
	Reduce interface{}

	// Whether to use the max time or the
	// time of the selected point
	// tick:ignore
	PointTimes bool

	// The name of the field, defaults to the name of
	// MR function used (i.e. influxql.mean -> 'mean')
	As string
	// contains filtered or unexported fields
}

> *DEPRECATION WARNING*: As of v0.11 you can use the new InfluxQLNode to perform map reduce functions. This way of performing influxql functions will be removed in the 0.12 release.

Performs a reduce operation on the data stream. In the map-reduce framework it is assumed that several different partitions of the data can be 'mapped' in parallel while only one 'reduce' operation will process all of the data stream.

Example:

stream
    .window()
        .period(10s)
        .every(10s)
    // Sum the values for each 10s window of data.
    .sum('value')
    ...

func (*ReduceNode) Alert

func (n *ReduceNode) Alert() *AlertNode

Create an alert node, which can trigger alerts.

func (*ReduceNode) Bottom added in v0.11.0

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

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

func (*ReduceNode) Count added in v0.11.0

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

Count the number of points.

func (*ReduceNode) Derivative

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

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

func (*ReduceNode) Distinct added in v0.11.0

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

Produce batch of only the distinct points.

func (*ReduceNode) Eval

func (n *ReduceNode) Eval(expressions ...tick.Node) *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 (*ReduceNode) First added in v0.11.0

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

Select the first point.

func (*ReduceNode) GroupBy

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

Group the data by a set of tags.

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

.groupBy(*)

func (*ReduceNode) HttpOut

func (n *ReduceNode) 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 (*ReduceNode) InfluxDBOut

func (n *ReduceNode) InfluxDBOut() *InfluxDBOutNode

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

func (*ReduceNode) Join

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

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

func (*ReduceNode) Last added in v0.11.0

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

Select the last point.

func (*ReduceNode) Log added in v0.11.0

func (n *ReduceNode) Log() *LogNode

Create a node that logs all data it receives.

func (*ReduceNode) MapReduce

func (n *ReduceNode) MapReduce(mr MapReduceInfo) *ReduceNode

> *DEPRECATION WARNING*: As of v0.11 you can use the new InfluxQLNode to perform map reduce functions. This way of performing influxql functions will be removed in the 0.12 release.

Perform a map-reduce operation on the data. The built-in functions under `influxql` provide the selection,aggregation, and transformation functions from the InfluxQL language.

MapReduce may be applied to either a batch or a stream edge. In the case of a batch each batch is passed to the mapper independently. In the case of a stream all incoming data points that have the exact same time are combined into a batch and sent to the mapper.

func (*ReduceNode) Max added in v0.11.0

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

Select the maximum point.

func (*ReduceNode) Mean added in v0.11.0

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

Compute the mean of the data.

func (*ReduceNode) Median added in v0.11.0

func (n *ReduceNode) 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 (*ReduceNode) Min added in v0.11.0

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

Select the minimum point.

func (*ReduceNode) Percentile added in v0.11.0

func (n *ReduceNode) 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 (*ReduceNode) Sample

func (n *ReduceNode) 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 (*ReduceNode) Shift added in v0.11.0

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

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

func (*ReduceNode) Spread added in v0.11.0

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

Compute the difference between min and max points.

func (*ReduceNode) Stddev added in v0.11.0

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

Compute the standard deviation.

func (*ReduceNode) Sum added in v0.11.0

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

Compute the sum of all values.

func (*ReduceNode) Top added in v0.11.0

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

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

func (*ReduceNode) Union

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

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

func (*ReduceNode) UsePointTimes

func (r *ReduceNode) UsePointTimes() *ReduceNode

Use the time of the selected point instead of the time of the batch.

Only applies to selector MR functions like first, last, top, bottom, etc. Aggregation functions always use the batch time. tick:property

func (*ReduceNode) Where

func (n *ReduceNode) Where(expression tick.Node) *WhereNode

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

func (*ReduceNode) Window

func (n *ReduceNode) Window() *WindowNode

Create a new node that windows the stream by time.

NOTE: Window can only be applied to stream edges.

type SampleNode

type SampleNode struct {

	// Keep every Count point or batch
	// tick:ignore
	Count 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 StreamNode.Truncate, BatchNode.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) Count

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

Count the number of points.

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

func (n *SampleNode) Eval(expressions ...tick.Node) *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) 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) 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) MapReduce

func (n *SampleNode) MapReduce(mr MapReduceInfo) *ReduceNode

> *DEPRECATION WARNING*: As of v0.11 you can use the new InfluxQLNode to perform map reduce functions. This way of performing influxql functions will be removed in the 0.12 release.

Perform a map-reduce operation on the data. The built-in functions under `influxql` provide the selection,aggregation, and transformation functions from the InfluxQL language.

MapReduce may be applied to either a batch or a stream edge. In the case of a batch each batch is passed to the mapper independently. In the case of a stream all incoming data points that have the exact same time are combined into a batch and sent to the mapper.

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 tick.Node) *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) Children added in v0.10.0

func (n SensuHandler) Children() []Node

tick:ignore

func (SensuHandler) Deadman added in v0.10.0

func (n SensuHandler) Deadman(threshold float64, interval time.Duration, expr ...tick.Node) *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)
      .derivative('collected')
          .unit(10s)
          .nonNegative()
      .alert()
          .id('node \'stream0\' in task \'{{ .TaskName }}\'')
          .message('{{ .ID }} is {{ if eq .Level "OK" }}alive{{ else }}dead{{ end }}: {{ index .Fields "collected" | printf "%0.3f" }} points/10s.')
          .crit(lamdba: "collected" <= 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 1s 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 (SensuHandler) Desc added in v0.10.0

func (n SensuHandler) Desc() string

tick:ignore

func (SensuHandler) ID added in v0.10.0

func (n SensuHandler) ID() ID

tick:ignore

func (SensuHandler) Name added in v0.10.0

func (n SensuHandler) Name() string

tick:ignore

func (SensuHandler) Parents added in v0.10.0

func (n SensuHandler) Parents() []Node

tick:ignore

func (SensuHandler) Provides added in v0.10.0

func (n SensuHandler) Provides() EdgeType

tick:ignore

func (SensuHandler) SetName added in v0.10.0

func (n SensuHandler) SetName(name string)

tick:ignore

func (SensuHandler) Stats added in v0.10.0

func (n SensuHandler) 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 (SensuHandler) Wants added in v0.10.0

func (n SensuHandler) Wants() EdgeType

tick:ignore

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

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

Count the number of points.

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

func (n *ShiftNode) Eval(expressions ...tick.Node) *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) 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) 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) MapReduce added in v0.11.0

func (n *ShiftNode) MapReduce(mr MapReduceInfo) *ReduceNode

> *DEPRECATION WARNING*: As of v0.11 you can use the new InfluxQLNode to perform map reduce functions. This way of performing influxql functions will be removed in the 0.12 release.

Perform a map-reduce operation on the data. The built-in functions under `influxql` provide the selection,aggregation, and transformation functions from the InfluxQL language.

MapReduce may be applied to either a batch or a stream edge. In the case of a batch each batch is passed to the mapper independently. In the case of a stream all incoming data points that have the exact same time are combined into a batch and sent to the mapper.

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 tick.Node) *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) Children added in v0.2.4

func (n SlackHandler) Children() []Node

tick:ignore

func (SlackHandler) Deadman added in v0.10.0

func (n SlackHandler) Deadman(threshold float64, interval time.Duration, expr ...tick.Node) *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)
      .derivative('collected')
          .unit(10s)
          .nonNegative()
      .alert()
          .id('node \'stream0\' in task \'{{ .TaskName }}\'')
          .message('{{ .ID }} is {{ if eq .Level "OK" }}alive{{ else }}dead{{ end }}: {{ index .Fields "collected" | printf "%0.3f" }} points/10s.')
          .crit(lamdba: "collected" <= 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 1s 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 (SlackHandler) Desc added in v0.2.4

func (n SlackHandler) Desc() string

tick:ignore

func (SlackHandler) ID added in v0.2.4

func (n SlackHandler) ID() ID

tick:ignore

func (SlackHandler) Name added in v0.2.4

func (n SlackHandler) Name() string

tick:ignore

func (SlackHandler) Parents added in v0.2.4

func (n SlackHandler) Parents() []Node

tick:ignore

func (SlackHandler) Provides added in v0.2.4

func (n SlackHandler) Provides() EdgeType

tick:ignore

func (SlackHandler) SetName added in v0.2.4

func (n SlackHandler) SetName(name string)

tick:ignore

func (SlackHandler) Stats added in v0.10.0

func (n SlackHandler) 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 (SlackHandler) Wants added in v0.2.4

func (n SlackHandler) Wants() EdgeType

tick:ignore

type SourceBatchNode

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

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

Example:

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

func (*SourceBatchNode) Children

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

tick:ignore

func (*SourceBatchNode) Deadman added in v0.10.0

func (n *SourceBatchNode) Deadman(threshold float64, interval time.Duration, expr ...tick.Node) *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)
      .derivative('collected')
          .unit(10s)
          .nonNegative()
      .alert()
          .id('node \'stream0\' in task \'{{ .TaskName }}\'')
          .message('{{ .ID }} is {{ if eq .Level "OK" }}alive{{ else }}dead{{ end }}: {{ index .Fields "collected" | printf "%0.3f" }} points/10s.')
          .crit(lamdba: "collected" <= 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 1s 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 (*SourceBatchNode) Desc

func (n *SourceBatchNode) Desc() string

tick:ignore

func (*SourceBatchNode) ID

func (n *SourceBatchNode) ID() ID

tick:ignore

func (*SourceBatchNode) Name

func (n *SourceBatchNode) Name() string

tick:ignore

func (*SourceBatchNode) Parents

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

tick:ignore

func (*SourceBatchNode) Provides

func (n *SourceBatchNode) Provides() EdgeType

tick:ignore

func (*SourceBatchNode) Query

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

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 (*SourceBatchNode) SetName

func (n *SourceBatchNode) SetName(name string)

tick:ignore

func (*SourceBatchNode) Stats added in v0.10.0

func (n *SourceBatchNode) 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 (*SourceBatchNode) Wants

func (n *SourceBatchNode) Wants() EdgeType

tick:ignore

type SourceStreamNode added in v0.11.0

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

A SourceStreamNode 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 SourceStreamNode. SourceStreamNode.From is the method/property of this node.

func (*SourceStreamNode) Children added in v0.11.0

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

tick:ignore

func (*SourceStreamNode) Deadman added in v0.11.0

func (n *SourceStreamNode) Deadman(threshold float64, interval time.Duration, expr ...tick.Node) *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)
      .derivative('collected')
          .unit(10s)
          .nonNegative()
      .alert()
          .id('node \'stream0\' in task \'{{ .TaskName }}\'')
          .message('{{ .ID }} is {{ if eq .Level "OK" }}alive{{ else }}dead{{ end }}: {{ index .Fields "collected" | printf "%0.3f" }} points/10s.')
          .crit(lamdba: "collected" <= 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 1s 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 (*SourceStreamNode) Desc added in v0.11.0

func (n *SourceStreamNode) Desc() string

tick:ignore

func (*SourceStreamNode) From added in v0.11.0

func (s *SourceStreamNode) From() *StreamNode

Creates a new StreamNode 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 (*SourceStreamNode) ID added in v0.11.0

func (n *SourceStreamNode) ID() ID

tick:ignore

func (*SourceStreamNode) Name added in v0.11.0

func (n *SourceStreamNode) Name() string

tick:ignore

func (*SourceStreamNode) Parents added in v0.11.0

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

tick:ignore

func (*SourceStreamNode) Provides added in v0.11.0

func (n *SourceStreamNode) Provides() EdgeType

tick:ignore

func (*SourceStreamNode) SetName added in v0.11.0

func (n *SourceStreamNode) SetName(name string)

tick:ignore

func (*SourceStreamNode) Stats added in v0.11.0

func (n *SourceStreamNode) 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 (*SourceStreamNode) Wants added in v0.11.0

func (n *SourceStreamNode) Wants() EdgeType

tick:ignore

type StatsNode added in v0.10.0

type StatsNode struct {

	// tick:ignore
	SourceNode Node
	// tick:ignore
	Interval time.Duration
	// 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) 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) Count added in v0.11.0

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

Count the number of points.

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) Eval added in v0.10.0

func (n *StatsNode) Eval(expressions ...tick.Node) *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) 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) 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) MapReduce added in v0.10.0

func (n *StatsNode) MapReduce(mr MapReduceInfo) *ReduceNode

> *DEPRECATION WARNING*: As of v0.11 you can use the new InfluxQLNode to perform map reduce functions. This way of performing influxql functions will be removed in the 0.12 release.

Perform a map-reduce operation on the data. The built-in functions under `influxql` provide the selection,aggregation, and transformation functions from the InfluxQL language.

MapReduce may be applied to either a batch or a stream edge. In the case of a batch each batch is passed to the mapper independently. In the case of a stream all incoming data points that have the exact same time are combined into a batch and sent to the mapper.

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 tick.Node) *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 {

	// An expression to filter the data stream.
	// tick:ignore
	Expression tick.Node

	// The dimensions by which to group to the data.
	// tick:ignore
	Dimensions []interface{}

	// 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 specfic boundaries
	// Example:
	//    stream
	//       .from().measurement('mydata')
	//           .truncate(1s)
	//
	// All incoming data will be truncated to 1 second resolution.
	Truncate time.Duration
	// contains filtered or unexported fields
}

A StreamNode selects a subset of the data flowing through a SourceStreamNode. 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 (*StreamNode) Alert

func (n *StreamNode) Alert() *AlertNode

Create an alert node, which can trigger alerts.

func (*StreamNode) Bottom added in v0.11.0

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

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

func (*StreamNode) Count added in v0.11.0

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

Count the number of points.

func (*StreamNode) Derivative

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

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

func (*StreamNode) Distinct added in v0.11.0

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

Produce batch of only the distinct points.

func (*StreamNode) Eval

func (n *StreamNode) Eval(expressions ...tick.Node) *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 (*StreamNode) First added in v0.11.0

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

Select the first point.

func (*StreamNode) From

func (s *StreamNode) From() *StreamNode

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 (*StreamNode) GroupBy

func (s *StreamNode) GroupBy(tag ...interface{}) *StreamNode

Group the data by a set of tags.

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

.groupBy(*)

func (*StreamNode) HttpOut

func (n *StreamNode) 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 (*StreamNode) InfluxDBOut

func (n *StreamNode) InfluxDBOut() *InfluxDBOutNode

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

func (*StreamNode) Join

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

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

func (*StreamNode) Last added in v0.11.0

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

Select the last point.

func (*StreamNode) Log added in v0.11.0

func (n *StreamNode) Log() *LogNode

Create a node that logs all data it receives.

func (*StreamNode) MapReduce

func (n *StreamNode) MapReduce(mr MapReduceInfo) *ReduceNode

> *DEPRECATION WARNING*: As of v0.11 you can use the new InfluxQLNode to perform map reduce functions. This way of performing influxql functions will be removed in the 0.12 release.

Perform a map-reduce operation on the data. The built-in functions under `influxql` provide the selection,aggregation, and transformation functions from the InfluxQL language.

MapReduce may be applied to either a batch or a stream edge. In the case of a batch each batch is passed to the mapper independently. In the case of a stream all incoming data points that have the exact same time are combined into a batch and sent to the mapper.

func (*StreamNode) Max added in v0.11.0

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

Select the maximum point.

func (*StreamNode) Mean added in v0.11.0

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

Compute the mean of the data.

func (*StreamNode) Median added in v0.11.0

func (n *StreamNode) 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 (*StreamNode) Min added in v0.11.0

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

Select the minimum point.

func (*StreamNode) Percentile added in v0.11.0

func (n *StreamNode) 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 (*StreamNode) Sample

func (n *StreamNode) 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 (*StreamNode) Shift added in v0.11.0

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

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

func (*StreamNode) Spread added in v0.11.0

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

Compute the difference between min and max points.

func (*StreamNode) Stddev added in v0.11.0

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

Compute the standard deviation.

func (*StreamNode) Sum added in v0.11.0

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

Compute the sum of all values.

func (*StreamNode) Top added in v0.11.0

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

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

func (*StreamNode) Union

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

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

func (*StreamNode) Where

func (s *StreamNode) Where(expression tick.Node) *StreamNode

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/v0.11/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 (*StreamNode) Window

func (n *StreamNode) Window() *WindowNode

Create a new node that windows the stream by time.

NOTE: Window can only be applied to stream edges.

type TalkHandler added in v0.10.1

type TalkHandler struct {
	*AlertNode
}

tick:embedded:AlertNode.Talk

func (TalkHandler) Children added in v0.10.1

func (n TalkHandler) Children() []Node

tick:ignore

func (TalkHandler) Deadman added in v0.10.1

func (n TalkHandler) Deadman(threshold float64, interval time.Duration, expr ...tick.Node) *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)
      .derivative('collected')
          .unit(10s)
          .nonNegative()
      .alert()
          .id('node \'stream0\' in task \'{{ .TaskName }}\'')
          .message('{{ .ID }} is {{ if eq .Level "OK" }}alive{{ else }}dead{{ end }}: {{ index .Fields "collected" | printf "%0.3f" }} points/10s.')
          .crit(lamdba: "collected" <= 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 1s 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 (TalkHandler) Desc added in v0.10.1

func (n TalkHandler) Desc() string

tick:ignore

func (TalkHandler) ID added in v0.10.1

func (n TalkHandler) ID() ID

tick:ignore

func (TalkHandler) Name added in v0.10.1

func (n TalkHandler) Name() string

tick:ignore

func (TalkHandler) Parents added in v0.10.1

func (n TalkHandler) Parents() []Node

tick:ignore

func (TalkHandler) Provides added in v0.10.1

func (n TalkHandler) Provides() EdgeType

tick:ignore

func (TalkHandler) SetName added in v0.10.1

func (n TalkHandler) SetName(name string)

tick:ignore

func (TalkHandler) Stats added in v0.10.1

func (n TalkHandler) 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 (TalkHandler) Wants added in v0.10.1

func (n TalkHandler) Wants() EdgeType

tick:ignore

type TopBottomCallInfo added in v0.11.0

type TopBottomCallInfo struct {
	FieldsAndTags []string
}

type UDFNode added in v0.10.0

type UDFNode struct {

	//tick:ignore
	Commander command.Commander
	// tick:ignore
	Timeout time.Duration

	// 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,
	commander command.Commander,
	timeout time.Duration,
	wants,
	provides 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) CallMethod added in v0.10.0

func (u *UDFNode) CallMethod(name string, args ...interface{}) (interface{}, error)

tick:ignore

func (*UDFNode) Count added in v0.11.0

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

Count the number of points.

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) Eval added in v0.10.0

func (n *UDFNode) Eval(expressions ...tick.Node) *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) 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) HasMethod added in v0.10.0

func (u *UDFNode) HasMethod(name string) bool

tick:ignore

func (*UDFNode) HasProperty added in v0.10.0

func (u *UDFNode) HasProperty(name string) bool

tick:ignore

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) MapReduce added in v0.10.0

func (n *UDFNode) MapReduce(mr MapReduceInfo) *ReduceNode

> *DEPRECATION WARNING*: As of v0.11 you can use the new InfluxQLNode to perform map reduce functions. This way of performing influxql functions will be removed in the 0.12 release.

Perform a map-reduce operation on the data. The built-in functions under `influxql` provide the selection,aggregation, and transformation functions from the InfluxQL language.

MapReduce may be applied to either a batch or a stream edge. In the case of a batch each batch is passed to the mapper independently. In the case of a stream all incoming data points that have the exact same time are combined into a batch and sent to the mapper.

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, value 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 tick.Node) *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) Count added in v0.11.0

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

Count the number of points.

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

func (n *UnionNode) Eval(expressions ...tick.Node) *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) 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) 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) MapReduce

func (n *UnionNode) MapReduce(mr MapReduceInfo) *ReduceNode

> *DEPRECATION WARNING*: As of v0.11 you can use the new InfluxQLNode to perform map reduce functions. This way of performing influxql functions will be removed in the 0.12 release.

Perform a map-reduce operation on the data. The built-in functions under `influxql` provide the selection,aggregation, and transformation functions from the InfluxQL language.

MapReduce may be applied to either a batch or a stream edge. In the case of a batch each batch is passed to the mapper independently. In the case of a stream all incoming data points that have the exact same time are combined into a batch and sent to the mapper.

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 tick.Node) *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) Children added in v0.2.4

func (n VictorOpsHandler) Children() []Node

tick:ignore

func (VictorOpsHandler) Deadman added in v0.10.0

func (n VictorOpsHandler) Deadman(threshold float64, interval time.Duration, expr ...tick.Node) *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)
      .derivative('collected')
          .unit(10s)
          .nonNegative()
      .alert()
          .id('node \'stream0\' in task \'{{ .TaskName }}\'')
          .message('{{ .ID }} is {{ if eq .Level "OK" }}alive{{ else }}dead{{ end }}: {{ index .Fields "collected" | printf "%0.3f" }} points/10s.')
          .crit(lamdba: "collected" <= 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 1s 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 (VictorOpsHandler) Desc added in v0.2.4

func (n VictorOpsHandler) Desc() string

tick:ignore

func (VictorOpsHandler) ID added in v0.2.4

func (n VictorOpsHandler) ID() ID

tick:ignore

func (VictorOpsHandler) Name added in v0.2.4

func (n VictorOpsHandler) Name() string

tick:ignore

func (VictorOpsHandler) Parents added in v0.2.4

func (n VictorOpsHandler) Parents() []Node

tick:ignore

func (VictorOpsHandler) Provides added in v0.2.4

func (n VictorOpsHandler) Provides() EdgeType

tick:ignore

func (VictorOpsHandler) SetName added in v0.2.4

func (n VictorOpsHandler) SetName(name string)

tick:ignore

func (VictorOpsHandler) Stats added in v0.10.0

func (n VictorOpsHandler) 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 (VictorOpsHandler) Wants added in v0.2.4

func (n VictorOpsHandler) Wants() EdgeType

tick:ignore

type WhereNode

type WhereNode struct {

	// The expression predicate.
	// tick:ignore
	Expression tick.Node
	// contains filtered or unexported fields
}

The WhereNode filters the data stream by a given expression.

Example: var sums = stream

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

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

Count the number of points.

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

func (n *WhereNode) Eval(expressions ...tick.Node) *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) 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) 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) MapReduce

func (n *WhereNode) MapReduce(mr MapReduceInfo) *ReduceNode

> *DEPRECATION WARNING*: As of v0.11 you can use the new InfluxQLNode to perform map reduce functions. This way of performing influxql functions will be removed in the 0.12 release.

Perform a map-reduce operation on the data. The built-in functions under `influxql` provide the selection,aggregation, and transformation functions from the InfluxQL language.

MapReduce may be applied to either a batch or a stream edge. In the case of a batch each batch is passed to the mapper independently. In the case of a stream all incoming data points that have the exact same time are combined into a batch and sent to the mapper.

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(expression tick.Node) *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
	// 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) Count added in v0.11.0

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

Count the number of points.

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

func (n *WindowNode) Eval(expressions ...tick.Node) *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) 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) 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) MapReduce

func (n *WindowNode) MapReduce(mr MapReduceInfo) *ReduceNode

> *DEPRECATION WARNING*: As of v0.11 you can use the new InfluxQLNode to perform map reduce functions. This way of performing influxql functions will be removed in the 0.12 release.

Perform a map-reduce operation on the data. The built-in functions under `influxql` provide the selection,aggregation, and transformation functions from the InfluxQL language.

MapReduce may be applied to either a batch or a stream edge. In the case of a batch each batch is passed to the mapper independently. In the case of a stream all incoming data points that have the exact same time are combined into a batch and sent to the mapper.

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 tick.Node) *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