influxdata / influxdata/kapacitor
Writing an UDF in Node.js
- Dominant language
- Go
- Stars
- 2.4k
- Forks
- 479
- Avg merge
- 4d 16h
- Merged PRs (30d)
- 4
Description
Hi,
I searched through the documentations (website & .md files on github), but I didn't find how to create my own UDF in nodejs.
More specifically : what are the kind of messages that should be passed over STDIN/STDOUT for a custom child process UDF to work ?
I can only find examples of python/go UDFs that require some external packages (python `kapacitor.udf.agent` & go `github.com/influxdata/kapacitor/udf/agent`), no "simple, native implementation" that I could use as a base to write my own UDF.
Adding a section to the documentation about the stdin/stdout messages that should be exchanged would really help. Like, is it a line protocol string ? Is it JSON ?
Even better would be a skeleton of UDF that we could use as a code base, like this :
```js
'use strict';
process.stdin.on('data', function (chunk) {
// dumb UDF that just outputs what it takes as input
// a code that performs a moving average like the python/go examples would be awesome
process.stdout.writeln(chunk.toString());
});
```
What do you think ?
Contributor guide
Research direction
Start with the UDF documentation on the website and in the .md files, then compare the existing Python and Go UDF examples. Identify the stdin/stdout message format needed by a child-process UDF and document it with a native Node.js skeleton. Done means the protocol is explained and a newcomer has a usable Node.js starting point.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, node.js, python
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100