You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/how-to-guides/observability/tracing/tempo.md
+12-2
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ Once you have traces being collected, you can visualize and query them in Grafan
14
14
15
15
The easiest way to get started with querying traces in Grafana Tempo is to use the query builder mode. The query builder mode is a graphical interface that helps you build LogQL queries by selecting labels and fields from your logs.
16
16
17
-
Start by selecting the `*-tempo` data source for the environment you want to query traces for. Then select the Search query type to open the query builder mode.
17
+
Start by selecting the tempo data source for the environment you want to query traces for (one ending with `-tempo`). Then select the Search query type to open the query builder mode.
18
18
19
19

20
20
@@ -24,7 +24,17 @@ Bellow the query builder you will see the TraceQL query that is being built as y
24
24
25
25
Click the `Run query` button to run the query and see the results. You can also add the query to a dashboard by clicking the `Add to dashboard` button.
26
26
27
-
[:octicons-link-external-24: Learn more about Grafana Tempo query editor](https://grafana.com/docs/grafana/latest/datasources/tempo/query-editor/)
27
+
[:octicons-link-external-24: Learn more about Grafana Tempo query editor on grafana.com](https://grafana.com/docs/grafana/latest/datasources/tempo/query-editor/)
28
+
29
+
### TraceQL query language
30
+
31
+
Grafana Tempo uses the TraceQL query language to query traces. TraceQL is a query language for querying trace data, and it is based on the LogQL query language used by Grafana Loki for querying logs and the PromQL query language used by Prometheus for querying metrics.
32
+
33
+
TraceQL provides a powerful and flexible way to query trace data, and it is designed to be easy to use and understand. You can use TraceQL to filter and aggregate trace data, and to create visualizations and alerts based on trace data.
Copy file name to clipboardExpand all lines: docs/reference/glossary.md
+9-9
Original file line number
Diff line number
Diff line change
@@ -2,37 +2,37 @@
2
2
3
3
## Observability
4
4
5
-
Observability is a measure of how well internal states of a system can be inferred from knowledge of its external outputs. It is a measure of how well a system's internal states can be inferred from knowledge of its external outputs. In other words, observability is the ability to understand the internal state of a system by examining its outputs.
5
+
Observability is the art of understanding how a system behaves by adding instrumentation such as logs, metrics, and traces.
6
6
7
7
### Metrics
8
8
9
-
Metrics are a numerical measurement of something in your application. They are useful for understanding the performance of your application and is generally more scalable than logs both in terms of storage and querying since they are structured data.
9
+
Metrics are a numerical measurement of something in your application such as the number of requests or the response time. Metrics are much better suited for for dashboards and alerts compared to logs.
10
10
11
11
### Prometheus
12
12
13
-
[Prometheus](https://prometheus.io/) is a time-series database that is used to store metrics. It is a very powerful tool that can be used to create alerts and dashboards. Prometheus is used by many open source projects and is the de facto standard for metrics in the cloud native world.
13
+
[Prometheus](https://prometheus.io/) is a time-series database that is used to store and query metrics from Grafana.
14
14
15
15
### Alertmanager
16
16
17
-
[Alertmanager](https://prometheus.io/docs/alerting/alertmanager/) is a component of Prometheus that is used to create and manage alerts. It can send alerts to various different channels like email, Slack, PagerDuty, etc.
17
+
[Alertmanager](https://prometheus.io/docs/alerting/alertmanager/) is a component of Prometheus that is used to create and manage Slack alerts based on the metrics collected by Prometheus.
18
18
19
19
### Grafana
20
20
21
-
[Grafana](https://grafana.com/) is a tool for creating dashboards and visualizing data. It is often used in combination with Prometheus to create dashboards and alerts.
21
+
[Grafana](https://grafana.com/) is a tool for creating application dashboards and visualizing data such as metrics, traces, and logs in a user-friendly way.
22
22
23
23
### Traces
24
24
25
-
Traces are a record of the path a request takes through your application. They are useful for understanding how a request is processed in your application.
25
+
Traces are a record of the path a request takes through your application. They are useful for understanding how a request is processed across multiple internal and external services.
26
26
27
27
### Span
28
28
29
-
A span represents a single unit of work in a trace, like a SQL query or an HTTP call to an external service.
29
+
A span represents a single unit of work in a Trace, like a SQL query or an HTTP call to an API.
30
30
31
31
### Context
32
32
33
33
Each Span carries a Context that includes metadata about the trace (like a unique trace identifier and span identifier) and any other data you choose to include. This context is propagated across process boundaries, allowing all the work that's part of a single trace to be linked together, even if it spans multiple services.
34
34
35
-
### Grafa Tempo
35
+
### Grafana Tempo
36
36
37
37
[Grafana Tempo](https://grafana.com/oss/tempo/) is an open-source, easy-to-use, high-scale, and cost-effective distributed tracing backend that stores and queries traces in a way that is easy to understand and use. It is fully integrated with Grafana, allowing you to visualize and query traces in the same interface as your metrics, and logs.
38
38
@@ -44,7 +44,7 @@ Each Span carries a Context that includes metadata about the trace (like a uniqu
44
44
45
45
Logs are a record of what has happened in your application. They are useful for debugging, but due to their unstructured format they generally do not scale very well.
46
46
47
-
### Kiibana
47
+
### Kibana
48
48
49
49
[Kibana](https://www.elastic.co/kibana) is a tool for visualizing logs. It is often used in combination with Elasticsearch to create dashboards and alerts.
Copy file name to clipboardExpand all lines: docs/reference/observability/logs/logql.md
+1-3
Original file line number
Diff line number
Diff line change
@@ -4,12 +4,10 @@ tags: [reference, loki]
4
4
---
5
5
# LogQL Reference
6
6
7
-
[LogQL][logql] is the query language used in Grafana Loki to query logs. It is a powerful query language that allows you to filter, aggregate, and search for logs and should be familiar to anyone who has used SQL or [PromQL](../metrics/promql.md).
7
+
LogQL is the query language used in Grafana Loki to query logs. It is a powerful query language that allows you to filter, aggregate, and search for logs and should be familiar to anyone who has used SQL or [PromQL](../metrics/promql.md).
8
8
9
9
Where LogQL differs from PromQL is it's trailing pipeline syntax, or log pipeline. A log pipeline is a set of stage expressions that are chained together and applied to the selected log streams. Each expression can filter out, parse, or mutate log lines and their respective labels.
Copy file name to clipboardExpand all lines: docs/reference/observability/tracing/traceql.md
+87-1
Original file line number
Diff line number
Diff line change
@@ -4,4 +4,90 @@ tags: [reference, tempo]
4
4
---
5
5
# TraceQL Reference
6
6
7
-
*https://grafana.com/docs/loki/latest/query/
7
+
TraceQL is the query language used in Grafana Tempo to query traces. It is a powerful query language that allows you to filter, aggregate, and search for traces and should be familiar to anyone who has used SQL or [PromQL](../metrics/promql.md).
8
+
9
+
Where TraceQL differs from PromQL is it's trailing pipeline syntax, or trace pipeline. A trace pipeline is a set of stage expressions that are chained together and applied to the selected trace data. Each expression can filter out, parse, or mutate trace spans and their respective labels.
10
+
11
+
## Syntax
12
+
13
+
A TraceQL query is composed by two main parts: the **trace span selector(s)** (the query) and the **trace pipeline** (aggregations).
14
+
15
+
```traceql
16
+
{label="value"} | stage1 | stage2 | stage3
17
+
```
18
+
19
+
### Trace Span Selector
20
+
21
+
The trace span selector is used to select spans based on their attributes. It is a set of key-value pairs that are used to filter spans.
22
+
23
+
Some span metadata are intrinsic to the span, such as `name`, `status`, `duration`, and `kind`, while others (attributes and resources) are user-defined, such as `service.name`, `db.operation`, and `http.status_code`.
Similar to PromQL, TraceQL supports a set of operators for comparing span attributes and values. One notable difference is type coercion, where the type of the attribute is inferred from the value being compared.
32
+
33
+
-`=` - Equality
34
+
-`!=` - Inequality
35
+
-`>` - Greater than
36
+
-`>=` - Greater than or equal to
37
+
-`<` - Less than
38
+
-`<=` - Less than or equal to
39
+
-`=~` - Regular expression
40
+
-`!~` - Negated regular expression
41
+
42
+
#### Combining spansets
43
+
44
+
Since a trace can be composed of multiple spans, multiple selectors can be used together to filter spans based on different attributes.
45
+
46
+
TraceQL supports two types of combining spansets: logical (`&&` and `||`) and structural relations (`>`, `>>`, `<<``<`, and `~`).
47
+
48
+
##### Logical
49
+
50
+
The logical operators `&&` and `||` are used to combine spansets based on their attributes.
To further refine the selected spans, a trace pipeline can be used to apply a set of aggregation functions on the selected spans.
77
+
78
+
-`count` - The count of spans in the spanset.
79
+
-`avg` - The average of a given numeric attribute or intrinsic for a spanset.
80
+
-`max` - The max value of a given numeric attribute or intrinsic for a spanset.
81
+
-`min` - The min value of a given numeric attribute or intrinsic for a spanset.
82
+
-`sum` - The sum value of a given numeric attribute or intrinsic for a spanset.
83
+
84
+
We can use the `count()` function to count the number of spans in the selected traces. In the following example, we select traces that contains more then 3 database SELECT operations:
0 commit comments