Flux Custom Functions and Packages

We have built a growing set of custom flux functions and starting to find that it would be great to be able to put all these functions into a custom package so that we could share them across queries and avoid duplication.

Something like:

import “org.funcs”

… use org.funcs.customfunc()

Any idea if we might be able to do that with the current 2.0 version?

Thank you,
Brian

@bknoth Yes! You can submit custom packages to the Flux project. Eventually we will have a Flux package repo that you can publish to and pull from, but we’re not quite there yet. For now, you can contribute your package in the stdlib/contrib directory. Here are some details: https://github.com/influxdata/flux/tree/master/stdlib/contrib.

@scott Thanks for the answer. That sounds like a good solution for general purpose custom functions that someone might want to share publicly. I was thinking more along the lines that we have custom functions that are very specific to the types of data that we work with and are not general purpose. I was hoping there might be a way to create packages inside a deployed InfluxDB that could be seen from within flux, without needing to update the flux source code origin and re-build. Maybe even something like an “include” statement which could bring in shared flux code.

Brian

That would be really cool! Maybe that’s something that could be added on the InfluxDB side.