Add support for Explore queries
This guide assumes that you’re already familiar with how to Build a data source plugin.
With Explore, users can make ad-hoc queries without the use of a dashboard. This is useful when users want to troubleshoot or to learn more about the data.
Your data source already supports Explore by default, and will use the existing query editor for the data source. If you want to offer extended Explore functionality for your data source however, you can define a Explore-specific query editor.
Create a file in the
src
directory of your plugin, with the following content:Add a to
ExploreQueryEditor
.import { QueryField } from '@grafana/ui';
Selecting preferred visualisation
If this does not work for you or you want to show some data in a specific visualization, add a hint to your returned data frame using the preferredVisualisationType
meta attribute.
You can construct a data frame with specific metadata:
fields: [...],
meta: {
preferredVisualisationType: 'logs',
});
For possible options, refer to .