Write TraceQL query

TraceQL is a query language designed for searching and filtering traces within Grafana Cloud. It enables you to write expressions that specify criteria to locate specific traces. A basic TraceQL query consists of key-value pairs that filter traces, ensuring only those matching the defined criteria are included in the results.

In this milestone, you’ll write a TraceQL query using the Search query builder that visualizes a list of traces in a table.

To write a TraceQL query, perform the following steps.

  1. In the Query Builder, click the Search tab located to the right of Query type. The Search query builder

    The traces table populates with a list of traces and a list of search criteria appears.

  2. For any of the search criteria, select an operator and a value.

    For example, when:

    • Service Name = app-2048
    • Span Name = POST /
    • Status = Error

    The resulting TraceQL query is:
    {resource.service.name="app-2048" && name="POST /" && status=error}

  3. Click Refresh to update the list of traces in the table.

  4. On the right of the page, under Panel options, enter a panel Title and description.

    The title appears at the top of the panel.

  5. Click Save dashboard located in the upper-right of the page, enter a title and description, and select a folder, if applicable.

  6. Click Save.

  7. On the top toolbar, click Back to dashboard.

In the next milestone you’ll add a dashboard variable.

More to explore (optional)

At this point in your journey, you can explore the following paths:

TraceQL

Investigate traces using Search query builder

Query tracing data


page 5 of 10