I’m developping a datasource plugin for Grafana that works nicely but if I try to use the Query Inspector , I only get the following message "Loading query inspector… " .
So how to make my plugin compliant with this feature? Is there any specific function to add to my datasource.ts file other than async query ...?
But I think your example is related to the query explorer and not the query inspector which is in the query tab when a panel is edited (see image below).
The query inspector is triggered only if an event (dsRequestResponse or dsRequestError) is emitted after the query is done by the backend server (see code documentation)
For example :
import { getBackendSrv } from '@grafana/runtime';
//later in your code
getBackendSrv().datasourceRequest({
url:'https://api.github.com/repos/grafana/grafana/stats/commit_activity',
method:'GET'
}).then((data: any) => console.log('DATA',data));
In my datasource, I’m doing fetch() call from the browser so no event is emitted and then no data are displayed in the query inspector. But here is a workaround to emit the event :
import { SystemJS } from '@grafana/runtime'
//later in your code
SystemJS.load('app/core/app_events').then((appEvents:any) => {
appEvents.emit('ds-request-response', data) // where data is the data to display
})