Plugins 〉YDB
YDB
YDB data source for Grafana
Version compatibility
Plugin requires v9.2
and higher of Grafana.
The YDB data source plugin allows you to query and visualize YDB data from within Grafana.
Installation
For detailed instructions on how to install the plugin on Grafana Cloud or locally, please checkout the Plugin installation docs.
Configuration
YDB user for the data source
Set up an YDB user account with readonly permission (more about permissions) and access to databases and tables you want to query. Please note that Grafana does not validate that queries are safe. Queries can contain any SQL statement including modification instructions.
Data transfer protocol support
The plugin supports GRPCS
and GRPC
transport protocols. Please note that you need to provide TLS/SSL certificate when using grpcs
.
Manual configuration
Once the plugin is installed on your Grafana instance, follow these instructions to add a new YDB data source, and enter configuration options.
With a configuration file
It is possible to configure data sources using configuration files with Grafana’s provisioning system. To read about how it works, including all the settings that you can set for this data source, refer to Provisioning Grafana data sources.
Plugin supports different authentication types authentication types.
Here is an example for this data source using user/password:
apiVersion: 1
datasources:
- name: YDB
type: ydbtech-ydb-datasource
jsonData:
authKind: "UserPassword",
endpoint: 'grpcs://endpoint',
dbLocation: 'location',
user: 'username',
secureJsonData:
password: 'userpassword',
certificate: 'certificate',
Here are fields that are supported in connection configuration:
jsonData:
authKind: "Anonymous" | "ServiceAccountKey" | "AccessToken" | "UserPassword" | "MetaData";
endpoint: string;
dbLocation: string;
user?: string;
secureJsonData:
serviceAccAuthAccessKey?: string;
accessToken?: string;
password?: string;
certificate?: string;
Building queries
YQL dialect is used to query YDB. Queries can contain macros which simplify syntax and allow for dynamic parts. The query editor allows you to get data in different representation: time series, table or logs.
Time series
Time series visualization options are selectable after adding to your query one field with Date
, Datetime
or Timestamp
type and at least one field with number
type. You can select time series visualizations using the visualization options. Grafana interprets timestamp rows without explicit time zone as UTC. Any other column is treated as a value column.
Multi-line time series
To create multi-line time series, the query must return at least 3 fields in the following order:
- field 1: time field
- field 2: value to group by
- field 3+: the metric values
For example:
SELECT `timestamp`, `requestTime`, AVG(`responseStatus`) AS `avgRespStatus`
FROM `/database/endpoint/my-logs`
GROUP BY `requestTime`, `timestamp`
ORDER BY `timestamp`
Tables
Table visualizations will always be available for any valid YDB query.
Visualizing logs with the Logs Panel
To use the Logs panel your query must return a time and string values. You can select logs visualizations using the visualization options.
By default only the first text field will be represented as log line, but this can be customized using query builder.
Macros
To simplify syntax and to allow for dynamic parts, like date range filters, the query can contain macros.
Here is an example of a query with a macro that will use Grafana's time filter:
SELECT `timeCol`
FROM `/database/endpoint/my-logs`
WHERE $__timeFilter(`timeCol`)
Macro | Description | Output example |
---|---|---|
$__timeFilter(columnName) | Replaced by a conditional that filters the data (using the provided column) based on the time range of the panel in microseconds | foo >= CAST(1636717526371000 AS TIMESTAMP) AND foo <= CAST(1668253526371000 AS TIMESTAMP)' ) |
$__fromTimestamp | Replaced by the starting time of the range of the panel casted to Timestamp | CAST(1636717526371000 AS TIMESTAMP) |
$__toTimestamp | Replaced by the ending time of the range of the panel casted to Timestamp | CAST(1636717526371000 AS TIMESTAMP) |
$__varFallback(condition, $templateVar) | Replaced by the first parameter when the template variable in the second parameter is not provided. | condition or templateVarValue |
Templates and variables
To add a new YDB query variable, refer to Add a query variable. After creating a variable, you can use it in your YDB queries by using Variable syntax. For more information about variables, refer to Templates and variables.
Learn more
- Add Annotations.
- Configure and use Templates and variables.
- Add Transformations.
- Set up alerting; refer to Alerts overview.
Grafana Cloud Free
- Free tier: Limited to 3 users
- Paid plans: $55 / user / month above included usage
- Access to all Enterprise Plugins
- Fully managed service (not available to self-manage)
Self-hosted Grafana Enterprise
- Access to all Enterprise plugins
- All Grafana Enterprise features
- Self-manage on your own infrastructure
Grafana Cloud Free
- Free tier: Limited to 3 users
- Paid plans: $55 / user / month above included usage
- Access to all Enterprise Plugins
- Fully managed service (not available to self-manage)
Self-hosted Grafana Enterprise
- Access to all Enterprise plugins
- All Grafana Enterprise features
- Self-manage on your own infrastructure
Grafana Cloud Free
.h4 . .mb-0 }
- Free tier: Limited to 3 users
- Paid plans: $55 / user / month above included usage
- Access to all Enterprise Plugins
- Fully managed service (not available to self-manage)
Self-hosted Grafana Enterprise
- Access to all Enterprise plugins
- All Grafana Enterprise features
- Self-manage on your own infrastructure
Grafana Cloud Free
- Free tier: Limited to 3 users
- Paid plans: $55 / user / month above included usage
- Access to all Enterprise Plugins
- Fully managed service (not available to self-manage)
Self-hosted Grafana Enterprise
- Access to all Enterprise plugins
- All Grafana Enterprise features
- Self-manage on your own infrastructure
Grafana Cloud Free
- Free tier: Limited to 3 users
- Paid plans: $55 / user / month above included usage
- Access to all Enterprise Plugins
- Fully managed service (not available to self-manage)
Self-hosted Grafana Enterprise
- Access to all Enterprise plugins
- All Grafana Enterprise features
- Self-manage on your own infrastructure
Installing YDB on Grafana Cloud:
Installing plugins on a Grafana Cloud instance is a one-click install; same with updates. Cool, right?
Note that it could take up to 1 minute to see the plugin show up in your Grafana.
Installing plugins on a Grafana Cloud instance is a one-click install; same with updates. Cool, right?
Note that it could take up to 1 minute to see the plugin show up in your Grafana.
Installing plugins on a Grafana Cloud instance is a one-click install; same with updates. Cool, right?
Note that it could take up to 1 minute to see the plugin show up in your Grafana.
Installing plugins on a Grafana Cloud instance is a one-click install; same with updates. Cool, right?
Note that it could take up to 1 minute to see the plugin show up in your Grafana.
Installing plugins on a Grafana Cloud instance is a one-click install; same with updates. Cool, right?
Note that it could take up to 1 minute to see the plugin show up in your Grafana.
Installing plugins on a Grafana Cloud instance is a one-click install; same with updates. Cool, right?
Note that it could take up to 1 minute to see the plugin show up in your Grafana.
Installing plugins on a Grafana Cloud instance is a one-click install; same with updates. Cool, right?
Note that it could take up to 1 minute to see the plugin show up in your Grafana.
For more information, visit the docs on plugin installation.
Installing on a local Grafana:
For local instances, plugins are installed and updated via a simple CLI command. Plugins are not updated automatically, however you will be notified when updates are available right within your Grafana.
1. Install the Data Source
Use the grafana-cli tool to install YDB from the commandline:
grafana-cli plugins install
The plugin will be installed into your grafana plugins directory; the default is /var/lib/grafana/plugins. More information on the cli tool.
Alternatively, you can manually download the .zip file for your architecture below and unpack it into your grafana plugins directory.
Alternatively, you can manually download the .zip file and unpack it into your grafana plugins directory.
2. Configure the Data Source
Accessed from the Grafana main menu, newly installed data sources can be added immediately within the Data Sources section.
Next, click the Add data source button in the upper right. The data source will be available for selection in the Type select box.
To see a list of installed data sources, click the Plugins item in the main menu. Both core data sources and installed data sources will appear.
Changelog
0.4.3
- Default auth type should be identical for frontend and backend
- Bug with filters when variable is multi-value
0.4.2
- Update
github.com/grafana/grafana-plugin-sdk-go
0.4.1
- Support number
limit
to achieve backwards compatibility
0.4.0
- Add ORDER BY to Query Builder
- Different Improvements and bug fixes
- Minimum required Grafana version increased to v9.2