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/apm/advanced-queries.asciidoc
+37-16Lines changed: 37 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,42 +2,63 @@
2
2
[[advanced-queries]]
3
3
=== Query your data
4
4
5
-
Querying your APM data is a powerful tool that can make finding bottlenecks in your code even easier.
6
-
Imagine you have a user that complains about a slow response time in a specific service.
7
-
With the query bar, you can easily filter the APM app to only display trace data for that user,
8
-
or, to only show transactions that are slower than a specified time threshold.
5
+
Querying your APM data is an essential tool that can make finding bottlenecks in your code even more straightforward.
9
6
10
-
[float]
11
-
==== Example APM app queries
7
+
Using the query bar, a powerful data query feature, you can pass advanced queries on your data
8
+
to filter on specific pieces of information you’re interested in.
9
+
10
+
The query bar comes with a handy autocomplete that helps find the fields and even provides suggestions to the data they include.
11
+
You can select the query bar and hit the down arrow on your keyboard to begin scanning recommendations.
12
12
13
-
* Exclude response times slower than 2000 ms: `transaction.duration.us > 2000000`
14
-
* Filter by response status code: `context.response.status_code ≥ 400`
15
-
* Filter by single user ID: `context.user.id : 12`
13
+
[float]
14
+
[[apm-app-advanced-queries]]
15
+
=== Querying in the APM app
16
16
17
-
When querying in the APM app, you're merely searching and selecting data from fields in Elasticsearch documents.
18
-
Queries entered into the query bar are also added as parameters to the URL,
19
-
so it's easy to share a specific query or view with others.
17
+
When querying in the APM app, you’re merely searching and selecting data from fields in {es} documents. Queries entered
18
+
into the query bar are also added as parameters to the URL, so it’s easy to share a specific query or view with others.
20
19
21
20
When you type, you can begin to see some of the transaction fields available for filtering:
22
21
23
22
[role="screenshot"]
24
23
image::apm/images/apm-query-bar.png[Example of the Kibana Query bar in APM app in Kibana]
25
24
26
-
TIP: Read the {kibana-ref}/kuery-query.html[Kibana Query Language Enhancements] documentation to learn more about the capabilities of the {kib} query language.
25
+
[TIP]
26
+
=====
27
+
To learn more about the {kib} query language capabilities, see the {kibana-ref}/kuery-query.html[Kibana Query Language Enhancements] documentation.
28
+
=====
29
+
30
+
[float]
31
+
[[apm-app-queries]]
32
+
==== APM app queries
33
+
34
+
APM queries can be handy for removing noise from your data in the <<services,Services>>, <<transactions,Transactions>>,
35
+
<<errors,Errors>>, <<metrics,Metrics>>, and <<traces,Traces>> views.
36
+
37
+
For example, in the *Services* view, you can quickly view a list of all the instrumented services running on your production
38
+
environment: `service.environment : production`. Or filter the list by including the APM agent's name and the host it’s running on:
39
+
`service.environment : "production" and agent.name : "java" and host.name : "prod-server1"`.
40
+
41
+
On the *Traces* view, you might want to view failed transaction results from any of your running containers:
42
+
`transaction.result :"FAILURE" and container.id : *`.
43
+
44
+
On the *Transactions* view, you may want to list only the slower transactions than a specified time threshold: `transaction.duration.us > 2000000`.
45
+
Or filter the list by including the service version and the Kubernetes pod it's running on:
46
+
`transaction.duration.us > 2000000 and service.version : "7.12.0" and kubernetes.pod.name : "pod-5468b47f57-pqk2m"`.
27
47
28
48
[float]
29
49
[[discover-advanced-queries]]
30
50
=== Querying in Discover
31
51
32
52
Alternatively, you can query your APM documents in {kibana-ref}/discover.html[*Discover*].
33
-
Querying documents in *Discover* works the same way as querying in the APM app,
53
+
Querying documents in *Discover* works the same way as queries in the APM app,
34
54
and *Discover* supports all of the example APM app queries shown on this page.
35
55
36
56
[float]
37
-
==== Example Discover query
57
+
[[discover-queries]]
58
+
==== Discover queries
38
59
39
60
One example where you may want to make use of *Discover*,
40
-
is for viewing _all_ transactions for an endpoint, instead of just a sample.
61
+
is to view _all_ transactions for an endpoint instead of just a sample.
41
62
42
63
TIP: Starting in v7.6, you can view ten samples per bucket in the APM app, instead of just one.
0 commit comments