Grafana Cloud

Query your telemetry

You can use query editors, such as Grafana Explore, to write queries that filter and transform your telemetry data. Write queries when you need precise control over the data that you retrieve. Each telemetry signal has its own query language that’s optimized for its data type.

Write queries when you need specific filtering, want to build dashboards, or need to set up alert conditions.

About queries

Use queries to filter and transform your telemetry data to return the type of results you need. Each query language is optimized for its signal type. The following table shows each query language and what it does:

Query LanguageWhat it does
PromQLQuery time-series metrics and perform aggregations across labels. Use functions like rate(), sum(), and label matching to analyze metrics.
LogQLSearch logs for patterns and extract structured fields. Use label filters and line filters to find specific log entries.
TraceQLFilter distributed traces by span attributes and trace characteristics. Use attribute matching to find traces with specific properties.

You can visualize query results in dashboard panels, export them for analysis, or use them in alert rules.

When writing a query, follow these patterns:

  • Filter by time range to focus on specific periods.
  • Add filters using labels or attributes.
  • Filter by text or patterns in your data.
  • Apply parsers, aggregations, or functions to transform the data.

For more information about each signal type, refer to What are telemetry signals?.

When to write queries

You can write queries for the following use cases:

  • Filtering data with specific criteria, such as label values or time ranges.
  • Aggregating or transforming data, such as calculating rates or percentages.
  • Creating custom visualizations for dashboards.
  • Setting up precise alert conditions based on thresholds.

For visual exploration without queries, refer to Use Grafana Drilldown apps.

Access query editors

You can access query editors in the Explore app, in dashboard panels, and in alert rules. The following table shows where query editors are available and how to access them:

LocationHow to Access
ExploreNavigate to Explore from the Grafana navigation menu for free-form querying and iteration.
Dashboard panelsQuery editors appear when creating or editing panels.
Alert rulesQuery editors are available when creating or editing alert conditions.

For more information about data source configuration, refer to Connect data sources.

Build queries

Grafana Cloud provides visual query builders for major data sources that help you to get started without writing raw syntax. This functionality is called Builder mode.

Start in Builder mode to use a visual query designer with dropdowns and selections. Build queries by clicking elements without writing syntax. You can switch between the Builder and Code modes anytime to see the generated query and learn syntax.

Alternatively, you can select from pre-written query templates that provide instant starting points for customization with the Kick Start Your Query feature.

For each supported query language, you can complete the following steps:

  1. Start in Builder mode to visually construct your query.
  2. Switch to Code mode to see the generated syntax.
  3. Edit the query directly in Code mode for advanced use cases.

Note

As a best practice, test your queries in Explore before adding them to dashboards or alert rules.

Next steps