Grafana-live and datasource.query

Hello again,

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.

I’m also not sure if this code in the data source works.

I hope you haven’t wasted too much time looking at this as this is not usable in its current state.

1 Like

Does your data source support websockets already?

Then maybe you can use the feature that data sources can return Rxjs Subject and return data that way.

The only other data source that does this (beside the unfinished grafana-live) is the snapp datasource, https://github.com/raintank/snap-app/blob/master/src/datasource/datasource.js

1 Like

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.

do you guys have any estimated date for the grafana-live rollout?

no date right now, maybe Q1-Q2 next year

Hi, any updates on the subject of grafana-live?