Add Aggregate by doc for tracing (#74148)

* Add Aggregate by doc for tracing

* Update docs/sources/shared/datasources/tempo-search-traceql.md

* Update docs/sources/shared/datasources/tempo-search-traceql.md

Co-authored-by: Joey <90795735+joey-grafana@users.noreply.github.com>

* Updates from talk with Marty

* Update docs/sources/shared/datasources/tempo-search-traceql.md

* Apply suggestions from code review

Co-authored-by: Jennifer Villa <jvilla2013@gmail.com>

* Update docs/sources/shared/datasources/tempo-search-traceql.md

* Update docs/sources/shared/datasources/tempo-search-traceql.md

* Update docs/sources/shared/datasources/tempo-search-traceql.md

* Apply suggestions from code review

* Update tempo-search-traceql.md

Changed heading level of define tags to be nested under define filters.

* Updates from prettier

* Apply suggestions from code review

* Run yarn prettier:write

---------

Co-authored-by: Joey <90795735+joey-grafana@users.noreply.github.com>
Co-authored-by: Jennifer Villa <jvilla2013@gmail.com>
Co-authored-by: Joey Tawadrous <joey.tawadrous@grafana.com>
This commit is contained in:
Kim Nylander
2023-09-04 05:06:41 -04:00
committed by GitHub
parent cad4fca8aa
commit 1922f4c9a1

View File

@@ -21,6 +21,10 @@ The TraceQL query builder, located on the **Explore** > **Query type** > **Searc
![The TraceQL query builder](/static/img/docs/tempo/screenshot-traceql-query-type-search-v10.png)
The builder lets you run the most common queries in as few clicks as possible. You don't need to know the underlying query language or database architecture to use it.
The builder supports a subset of TraceQL capabilities. For example, if you wish to use structural operators (`>>`, `>`, `~`), you need to use the query editor on the **TraceQL** tab.
You can use the query builders drop-downs to compose TraceQL queries. The selections you make automatically generate a [TraceQL query](/docs/tempo/latest/traceql).
To access **Search**, select your Tempo data source, and then choose **Explore** and select **Query type** > **Search**.
@@ -81,7 +85,7 @@ To define filters, follow these steps:
You can either select **Run query** to execute the query or define tags and then run the query.
## Define tags
### Define tags
You can add any tags to your query. Tags can be selected by scoped (span or resource) or unscoped. If you select unscoped, then all tags are searched for matches.
@@ -93,6 +97,39 @@ To add a tag, follow these steps:
1. Select a value from the **Select value** drop-down. This field is populated based upon the tag.
1. Optional: Select **+** to add an additional tag.
## Optional: Use Aggregate by
{{% admonition type="warning" %}}
**Aggregate by** is an [experimental feature](/docs/release-life-cycle/). Engineering and on-call support is not available. Documentation is either limited or not provided outside of code comments. No SLA is provided.
[Enable the `metricsSummary` feature toggle](/docs/grafana/latest/setup-grafana/configure-grafana/feature-toggles/) in Grafana to use this feature. Your Grafana Tempo data source must also point to a Tempo database with the [Metrics Summary API](https://grafana.com/docs/tempo/latest/api_docs/metrics-summary/) enabled. Contact Grafana Support to enable this feature in Grafana Cloud.
{{% /admonition %}}
Using **Aggregate by**, you can calculate RED metrics (total span count, percent erroring spans, and latency information) for spans of `kind=server` that match your filter criteria, grouped by one or more attributes.
This capability is based on the [metrics summary API](/docs/grafana-cloud/monitor-infrastructure/traces/metrics-summary-api/).
Metrics summary only calculates summaries based on spans received within the last hour.
When you use **Aggregate by**, the selections you make determine how the information is reported in the Table. Every combination that matches selections in your data is listed in the table.
Each aggregate value, for example `intrinsic`:`name`, has a corresponding column in the results table.
For example, **names** matching `GET /:endpoint` with a **span.http.user_agent** of `k6/0.46` appeared in 31,466 spans. Instead of being listed by traces and associated spans, the query results are grouped by the the selections in **Aggregate by**.
The RED metrics are calculated for every name and user agent combination found in your data.
![Use Aggregate by to calculate RED metrics for spans and group by attributes](/static/img/docs/tempo/screenshot-traces-aggregate-by.png)
The screenshot shows all of the successful HTTP `status_code` API calls against the `mystical-server` service.
The results are shown in the same order used in **Aggregate by**.
For example, **Aggregate by** lists `intrinsic.name` followed by `span.http.user_agent`.
The first column in the results Table shows **name** and then **span.http.user_agent**.
To use this capability:
1. In the **Aggregate by** row, select a scope from the first drop-down box. For example, `span`.
1. Select an attribute from the second drop-down.
1. Optional: Select **+** to add an **Aggregate by** row.
1. Optional: Select a **Time range** to expand or narrow the data set for an hour's range.
1. Select **Run query**.
### Optional: Add queries
Using **Add query**, you can have successive queries that run in sequential order.