Grafana making http requests in a plugin

Hey guys, so I’m creating a custom datasource plugin. I’m trying to make http requests to my elasticsearch server. What would be the best practice to do so?
Would axios be the best way to go about it?

Hi @araf

From our docs:

While you can use something like axios or the Fetch API to make requests, we recommend using the getBackendSrv function from the grafana/runtime package.

Are you building a frontend datasource plugin? If so then I think I would check out the BackendSrv Interface in Grafana Core.

Here is a nice tutorial for building a plugin that makes an http request.

But before going down the development path, are you sure that the Elasticsearch Datasource that ships with Grafana cannot fulfill your needs?

2 Likes

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.