Graphql grafana datasource

Is there any plan to support graphql as datasource, i mean collecting data from graphql endpoint and showing in pages ? Is there any plugin available which interact with graphql and display data. some kind of app(https://github.com/CatalystCode/ibex-dashboard-apollo-graphql) as grafana plugin?

2 Likes

I needed a GraphQL datasource so recently started work on one. It’s still a work in progress but the basic functionality is there. NB It’s a React plugin using the new grafana libraries so requires >6.5 (now in beta). https://github.com/fifemon/graphql-datasource

1 Like

:+1: Nice. Please publish it on grafana.com (open PR in https://github.com/grafana/grafana-plugin-repository) when you have some stable version.

Will do. In the meantime if anyone wants to try it out, I’ve included the compiled code so you can just clone the repo into your plugin directory.

1 Like

Hello.
I tried to clone your repo and restarted grafana-server.
After, I checked GraphQL plugin included in Grafana > Configuration > Plugins.
And I added Data source. But I got the error messages.
Message’s content is shown below.

Unable to find application file

Grafana has likely been updated. Please try reloading the page.

Reload
세부정보
Invariant Violation: Minified React error #130; visit https://reactjs.org/docs/error-decoder.html?invariant=130&args[]=undefined&args[]= for the full message or use the non-minified dev environment for full errors and additional helpful warnings.

in ConfigEditor
in div
in t
in form
in div
in div
in t
in div
in div
in div
in t
in t
in div
in t
in t
in Connect(t)
in Suspense
in t
in Unknown
in d
in Unknown
in Unknown
in t
in t
in a

What’s happened?
Please check it.

What version of Grafana are you running? You need the current beta https://grafana.com/grafana/download/6.5.0-beta1

Hello, @retzkek. This is super cool! Thanks for sharing. I am wondering if, when researching your project, you came across this:

They are also using React, along with Apollo Client, in order to support full Graphql.

Thanks.
–David

Actually, here is a better link:

Thanks for the links. Yes, I’m somewhat familiar with Apollo client, and initially looked at utilizing it or another GraphQL client library, and while I haven’t ruled them out in the long term, I found them adding a lot of complexity for uncertain gains, since Grafana already has nice support for querying HTTP data sources. I also recall having some issues using the new hook-based Apollo client within a Grafana plugin, but that’s probably just my inexperience with React.

The main value-add I’d be looking for in a client is to ease schema introspection to determine field types when building our DataFrame. That will require more time than I have right how, and a simple _.isNumber() call for each field is working for our purposes, so unless someone is willing to help I don’t see that happening soon.

The main feature that’s missing right now is a rich query editor, for which I’m looking to use the graphiql components.

1 Like

I’m going to look into using Apollo, but it’s going to be slow-burn, as I’m not a Javascript or React dev and it’s kind of for fun. Any idea when your datasource plug-in might be available through the Grafana official plug-ins? I saw that they have a lot of pull requests in queue.

Sounds good, thanks! I’m @retzkek in the Grafana slack, feel free to ping me if you have any questions.

I don’t have an ETA, haven’t submitted a PR yet since I think the rich editor needs to be in v1 (and I was hoping to get some testing feedback). Maybe a couple weeks.

This isn’t going to sound like great progress, but I’ve got the extensions for graphql installed and working on both Neo4j and Grafana and the datasource authenticates. Maybe tomorrow I can make some dashboards.

1 Like

This datasource connector works nicely. I find GraphQL, in general, to be a bit rough to work with, when compared to other query languages, but it does get the job done and is a good option when no other options are available. This is the case with connecting Grafana to Neo4J, as it seems nobody has made a Cypher interface yet. I realize maybe not everyone is using a graph to store time-series data, but for me it’s just another data type I am connected to. So, thanks for making this.