I've been investigating how we might implement streaming for this datasource plugin, and it's become a bit larger/more confusing than I expected so sharing a not-quite-working WIP for now. (feel free to ignore git commits, I tried a few different methods to getting here and most of them are not useful)
Here's a flow chart of how I'm thinking this could work:
In it's current state I have more than a few bugs that I'm trying to track down (for example when I switch to streaming, I get the wrong data back sometimes?) So if you see where I've gone wrong, feedback is very appreciated!
I also wonder at a higher level, if any of this is necessary, it looks like we have attempted to implement streaming on the frontend in a way? and I while I do think that communication over websockets is generally faster than making http requests repeatedly, but I wonder if the problems users with large amounts of data are seeing will be solved by this? Interested if others have thoughts with the overall approach.
I've been investigating how we might implement streaming for this datasource plugin, and it's become a bit larger/more confusing than I expected so sharing a not-quite-working WIP for now. (feel free to ignore git commits, I tried a few different methods to getting here and most of them are not useful)
Here's a flow chart of how I'm thinking this could work:![image](https://github.com/grafana/iot-sitewise-datasource/assets/6620164/f316db62-2574-48f7-abdb-6c5cdbb58162)
I still need to learn more about the relationship between Grafana Live and streaming, I mostly based this work off of what I've seen us do with twinmaker, but I also took a look at https://github.com/grafana/grafana-plugin-examples/tree/main/examples/datasource-streaming-backend-websocket
In it's current state I have more than a few bugs that I'm trying to track down (for example when I switch to streaming, I get the wrong data back sometimes?) So if you see where I've gone wrong, feedback is very appreciated!
I also wonder at a higher level, if any of this is necessary, it looks like we have attempted to implement streaming on the frontend in a way? and I while I do think that communication over websockets is generally faster than making http requests repeatedly, but I wonder if the problems users with large amounts of data are seeing will be solved by this? Interested if others have thoughts with the overall approach.