Adding a custom function to InfluxDB

I’m working on adding a function to InfluxDB that will allow me to show my time series with an upper and lower rolling percentile and lines where there might be “anomalies” (values that go outside the the bounds).

First, is there anything like this? If not, I’d be happy to work on submitting my function to the influxdb source if people thought it would be useful.

My next question, though, if there isn’t something like this, I’m currently blocked on how to proceed with my function. What I am doing is, given a single time series, I want to return the upper, lower, original series data, and a column with 1 or 0 for anomaly or not. AFAICT, though, functions can only return a single []FloatPoint where I want to return 4 columns.

Does anyone have any suggestions for how I should proceed? And I know this might be iffy asking this question in visualize, but I wasn’t sure there was another category where it fit better. Or maybe this is a question for a GH issue?

Thanks for any help!