Open rossmcdonald opened 7 years ago
This would be very useful for a use case that we are seeing: https://community.influxdata.com/t/kapacitor-template-task-vs-a-single-task-with-branches/1335/2
I can foresee more similar cases on the horizon as we expand our Kapacitor use.
This would be super useful for the IoT Gateway device use case. A small gateway device doing local data collection that could simply have a kapacitor script to Downsample all data from a given measurement and forward that upstream would be brilliant. As it is, I'm writing a kapacitor script for each field to do this, so I'll have about 30 TICK scripts.
Add ability to support bulk operations on field values without actually specifying the field key. This will be very helpful when using Kapacitor as a downsampling engine (similar to the use-case discussed in the documentation here). From my perspective, supporting this effectively requires:
|mean(*)
)$fieldkey
below) within the stream for naming.More concrete examples:
Numeric Data
Aggregating numeric data is fairly straightforward. For example, I would like to be able to apply mathematical operations to anonymous fields based on their type. This would be similar to running the query in InfluxQL:
Where InfluxQL automatically applies the operations to all numeric fields (even if string or boolean fields are present). In TICKscript, I could see this looking similar to:
Where the InfluxQL functions accept a wildcard operator
*
. When the wildcard is used, type errors would be ignored (for example, attempting to usesum()
on string types), or a property method would need to be set to enable ignoring type errors. Once a wildcard is referenced, you can then reference the field key with the$fieldkey
operator.Non-numeric Data
This enhancement could also leverage the type checks proposed in https://github.com/influxdata/kapacitor/issues/1201, which would allow the user to specify different actions to take based on the type of the field. One fairly common request I hear is how to effectively downsample string data. For example, based on the input data:
Taking the aggregate of this data will look like:
Doing this in TICKscript currently requires that you know the field keys ahead of time (which is not always possible). Being able to generalize this algorithm into something like:
Would be amazingly helpful.