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.

    1. Create a file in the src directory of your plugin, with the following content:

    2. Add a to ExploreQueryEditor.

      1. 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:

    1. fields: [...],
    2. meta: {
    3. preferredVisualisationType: 'logs',
    4. });

    For possible options, refer to .