Files in this directory represent DynamicWindowUDF usage in bundle with the Kapacitor SideloadNode
@dynamicWindowUDF()
.periodField('period')
.periodTimeUnit('m')
.defaultPeriod(default_period)
.staticEvery(30s)
.fillPeriod()
.emitTimeout(10s)
// alternative configuration
@dynamicWindowUDF()
.staticPeriod(60s)
.everyField('every')
.everyTimeUnit('m')
.defaultEvery(default_every)
.emitTimeout(10s)
periodField
–-period
field nameperiodTimeUnit
–-period
values time unit to interpret them correctly: ns – nanoseconds, u/mcs/us – microseconds, ms – milliseconds, s – seconds, m – minutes, h – hours, d – days, w – weeksdefaultPeriod
–-period
default valuestaticPeriod
-- setsperiod
constant value, cannot be changed with incoming points (Kapacitor WindowNode'speriod
property analogue); conflicts with three previous propertieseveryField
–-every
field nameeveryTimeUnit
–-every
values time unit, similarly toperiodTimeUnit
defaultEvery
-–every
default valuestaticEvery
-- setsevery
constant value, cannot be changed with incoming points (Kapacitor WindowNode'severy
property analogue); conflicts with three previous propertiesemitTimeout
-– UDF accumulates several points before processing.emitTimeout
property defines timeout between two sequential processing momentsfillPeriod
–- optional property. Defines if UDF should wait until the first window is fully filled (Kapacitor WindowNode'sfillPeriod
property analogue)
Just run the following in the current directory:
$ docker-compose up
Now you can use kapacitor
commands right from your host system. For example,
you can run dynamic_window.tick and watch the results:
$ kapacitor define dynamic_window_task -tick dynamic_window.tick
$ kapacitor enable dynamic_window_task
$ kapacitor watch dynamic_window_task
After that you will able to see points coming from UDF.
To remove intermediate build container, call:
$ docker image prune --filter "label=stage=builder" --filter "label=project=dynamic_window_udf_example" --force
This example uses number of Docker containers:
- kapacitor-udf -- container with UDF. Uses Docker image built from Dockerfile.
- collectd -- metrics producer. Sends them to InfluxDB. In theory, can be replaced.
- indluxdb -- InfluxDB container. Parses Graphite data format coming from collectd. Provides metrics for Kapacitor.
- kapacitor -- Kapacitor container. Subscribes to InfluxDB to receive metrics, processes them with TICK scripts, communicates with UDF.