graphql-datasource icon indicating copy to clipboard operation
graphql-datasource copied to clipboard

support GraphQL subscriptions

Open SydoxX opened this issue 4 years ago • 7 comments

Closes #57

SydoxX avatar May 28 '21 14:05 SydoxX

I did not find any documentation if Grafana officially supports proxying websockets. For now only the Browser option supports websockets and therefor subscriptions.

SydoxX avatar Jun 04 '21 13:06 SydoxX

This looks really nice, thanks! Subscriptions were on my "nice to have" long-term roadmap, I really appreciate you taking this on. Give me a few days to review all these changes.

Can you recommend a datasource to test this with? Otherwise I'll just implement subscriptions in the test datasource (which should support it regardless for demonstration).

retzkek avatar Jun 04 '21 22:06 retzkek

Unfortunately I tested it locally on an internal Hasura server.

SydoxX avatar Jun 05 '21 11:06 SydoxX

@SydoxX I'm really sorry it took so long for me to look at this. I finally added subscriptions to the test datasource, and have a couple immediate comments:

  1. I don't think it's a safe assumption that the subscription websockets endpoint is the same as the query endpoint. It's probably best to add a new configuration option, which could default to the same endpoint.
  2. Grafana does appear to proxy websockets, at least when looking at "live" Loki logs in Explore.

retzkek avatar Aug 26 '21 05:08 retzkek

@SydoxX I'm really sorry it took so long for me to look at this. I finally added subscriptions to the test datasource, and have a couple immediate comments:

1. I don't think it's a safe assumption that the subscription websockets endpoint is the same as the query endpoint. It's probably best to add a new configuration option, which could default to the same endpoint.

2. Grafana does appear to proxy websockets, at least when looking at "live" Loki logs in Explore.
  1. Indeed, I'll add another config option.
  2. Thanks for the heads-up, I'll see if I can get proxied websockets working.

SydoxX avatar Aug 26 '21 13:08 SydoxX

Added text field to enter websocket url and also added some info boxes about GraphQL subscriptions.

SydoxX avatar Sep 16 '21 13:09 SydoxX

I updated grafana in the package.json to version 8.1.4 but unfortunately this results in an endless loop while executing npm install. But I suspect this is a problem on my side.

SydoxX avatar Sep 16 '21 14:09 SydoxX