I know grafana-live hasn’t been officially released yet but I’m working with it anyway. My question is about the datasource, which you’ll find here.
I have connected to a websocket server and am returning data (which I can see using console.log) so my question is about getting Grafana to consume that data and display it in a data panel.
The query (see below) method on the GrafanaStreamDS class returns an promise that resolves an observable. That observable’s subscribe method does have my data in it, but how do I get that on screen?
query(options): any {
if (options.targets.length === 0) {
return Promise.resolve({data: []});
}
var target = options.targets[0];
var observable = new DataObservable(target);
return Promise.resolve(observable); // <- How do I access this outside of the plugin
Just so you know the grafana-live code is just a prototype/experiment and on the backend there are a couple of pieces missing. So it won’t work without some development.
The idea is to push data in the form of this StreamMessage struct to this api call (that is commented out and wrong). This code here pushes the data to the websocket hub.
Then in the Graph panel in the Stream field (if everything worked) then it would show a list of streams. You would pick one and it would stream to the Graph panel.
Thanks Guys. Yes our data source supports websockets already and I am receiving data in my datasource plugin via websockets, I just can’t get it to display on a data panel.
I’m now looking at the rxJS Subject in the snap app.