Skip to content

QueryHub

QueryHub is the built-in external data query capability of Guance. After you configure a connection, you can read data from databases, metrics services, or document stores in query entry points that support external data sources, and then use it for analysis and chart visualization without first collecting this data into the workspace.

QueryHub provides two query modes: Native Query and DQL Like. Both are entered manually in the input box, subject to the query modes actually enabled for the selected instance.

In Native Query, enter SQL statements for MySQL and PostgreSQL, and complete query JSON for Prometheus, Elasticsearch, and MongoDB; for DQL Like, enter a complete QueryHub expression. DQL Like is QueryHub's query syntax and differs from the ordinary DQL used to query logs and metrics in a workspace.

Select a Data Source Type

Type Query Target Configuration and Query Guide
MySQL Tables in a database MySQL
PostgreSQL Tables in a specified schema PostgreSQL
Prometheus Metrics and sample labels Prometheus
Elasticsearch Indexes and documents within the configured scope Elasticsearch
MongoDB Configured databases, collections, and documents MongoDB

Query access scope is determined jointly by the connection configuration of the selected data source, the read permissions of the account, and workspace permissions.

Add a Connection

1. Select the Access Method and Data Source Type

Switch to the target workspace, go to Integrations > External Data Sources, click Add Data Source, and select QueryHub as the access method and the data source type.

2. Fill in the Connection Properties

For all types, first fill in the following common fields. Authentication fields are displayed according to the selected authentication method; see the description for the corresponding data source type for specific mandatory requirements. Fill in certificate fields according to TLS requirements.

Configuration Item Required Description and Entry Method
Data Source ID Yes Manually enter an identifier for this connection, such as mysql-orders, with a maximum of 100 characters. The datasource in a DQL Like expression uses this value; it is not the account or database name retrieved from the database
Name Yes A name that helps identify the connection on the query page, for example, "Production Order Database", with a maximum of 100 characters
Description No Additional information about the connection's purpose or data scope, with a maximum of 256 characters

Fill in the address, database or resource scope, and authentication information according to the corresponding type in Data Source Configuration and Query Examples. The address, account, password, or token comes from the data source administrator, operations personnel, or the cloud service's connection information page, and is not the Guance login account.

For fields such as TLS mode and certificates, see Common TLS Configuration, and fill them in according to server requirements.

The account should have read-only query permissions for the target data. Configuring a connection tells Guance how to access the data source; you do not need to save query statements in the database in advance, and this does not add permissions to the database account.

3. Test the Connection

After filling in the connection information, click Test Connection and proceed based on the result:

Result Action
Connection successful Continue saving the configuration; after it takes effect, verify read permissions for the target data with an actual query
Address, network, or timeout error Check the address and port; if needed, contact operations personnel to check the network, allowlist, and service status
Authentication failed Confirm with the data source administrator whether the username, password, authentication database, or token is correct
Insufficient permissions Confirm whether the account has read permissions for the target database, table, index, collection, or metrics

A successful connection test does not mean all objects are queryable. After changing the connection address, resource scope, or authentication information, test the connection again.

4. Query Settings and Permissions

Query Settings is collapsed by default. Expand it and fill in the options provided on the page as needed. The specific fields, default values, and upper limits are subject to the expanded page; these settings apply to actual queries after saving, not only to connection tests.

In the Permissions area, configure Custom Operation Permissions:

  • Disabled: Follow the default permissions for "External Data Sources".
  • Enabled: Set the operation permissions for this connection according to the expanded permission options.

These permissions control workspace members' operations on the connection and do not change the read permissions of the database account itself.

5. Save and Verify the Query

Click Save at the bottom of the page, return to the data source list to confirm the configuration, then go to the query page, select the connection, and run a read-only query to verify whether it is available.

When using DQL Like, write the Data Source ID entered during configuration into datasource in the expression, and keep it consistent with the instance selected on the query page. You can view and copy the ID in the data source list or details.

Start Querying

  • Ad hoc queries and analysis: Go to Metrics > Metrics Analysis, click + Add Data Source, select a connection and query mode, fill in the query, and then click Refresh in the upper right corner. For complete steps, see Query in Metrics Analysis.
  • Save to a chart: Go to the chart editing page of a dashboard, add a data source in the query area and configure the query, confirm the preview result, and then save. For complete steps, see Query in a Dashboard Chart.

For native queries, DQL Like, and examples of viewing sources and fields for each type, see Data Source Configuration and Query Examples.

Feedback

Is this page helpful?