Documentation

tickscript.join() function

The tickscript.join() function is a user-contributed function maintained by the package author and can be updated or removed at any time.

The tickscript.join() function merges two input streams into a single output stream based on specified columns with equal values and appends a new measurement name.

This function is comparable to the Kapacitor JoinNode.

import "contrib/bonitoo-io/tickscript"

tickscript.join(
  tables: {t1: example1, t2: example2}
  on: ["_time"],
  measurement: "example-measurement"
)

Parameters

tables

(Required) Map of two streams to join.

Data type: Record

on

List of columns to join on. Default is ["_time"].

Data type: Array of Strings

measurement

(Required) Measurement name to use in results.

Data type: Array of Strings

Examples

Join two streams of data

Input data

metrics
_timehost_value
2021-01-01T00:00:00Zhost11.2
2021-01-01T01:00:00Zhost10.8
2021-01-01T02:00:00Zhost13.2
_timehost_value
2021-01-01T00:00:00Zhost28.4
2021-01-01T01:00:00Zhost27.3
2021-01-01T02:00:00Zhost27.9
states
_timehost_value
2021-01-01T00:00:00Zhost1dead
2021-01-01T01:00:00Zhost1dead
2021-01-01T02:00:00Zhost1alive
_timehost_value
2021-01-01T00:00:00Zhost2alive
2021-01-01T01:00:00Zhost2alive
2021-01-01T02:00:00Zhost2alive

Query

import "contrib/bonitoo-io/tickscript"

metrics = //...
states = //...

tickscript.join(
  tables: {metric: metrics, state: states},
  on: ["_time", "host"],
  measurement: "example-m"
)

Output data

_measurementhost_time_value_metric_value_state
example-mhost12021-01-01T00:00:00Z1.2dead
example-mhost12021-01-01T01:00:00Z0.8dead
example-mhost12021-01-01T02:00:00Z3.2alive
_measurementhost_time_value_metric_value_state
example-mhost22021-01-01T00:00:00Z8.4alive
example-mhost22021-01-01T01:00:00Z7.3alive
example-mhost22021-01-01T02:00:00Z7.9alive

Package author and maintainer

Github: @bonitoo-io, @alespour
InfluxDB Slack: @Ales Pour


Set your InfluxDB URL

Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.