Skip to content

Commit 57d26b9

Browse files
authored
Merge pull request #79598 from skrthomas/OSDOCS-10815
OSDOCS-10815:Troubleshooting long range Loki queries
2 parents f2e17d6 + d6444b1 commit 57d26b9

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
:_mod-docs-content-type: CONCEPT
2+
[id="network-observability-troubleshooting-large-query-timeout_{context}"]
3+
= Running a large query results in Loki errors
4+
When running large queries for a long time, Loki errors can occur, such as a `timeout` or `too many outstanding requests`. There is no complete corrective for this issue, but there are several ways to mitigate it:
5+
6+
Adapt your query to add an indexed filter::
7+
+
8+
With Loki queries, you can query on both indexed and non-indexed fields or labels. Queries that contain filters on labels perform better. For example, if you query for a particular Pod, which is not an indexed field, you can add its Namespace to the query. The list of indexed fields can be found in the "Network flows format reference", in the `Loki label` column.
9+
10+
Consider querying Prometheus rather than Loki::
11+
+
12+
Prometheus is a better fit than Loki to query on large time ranges. However, whether or not you can use Prometheus instead of Loki depends on the use case. For example, queries on Prometheus are much faster than on Loki, and large time ranges do not impact performance. But Prometheus metrics do not contain as much information as flow logs in Loki. The Network Observability OpenShift web console automatically favors Prometheus over Loki if the query is compatible; otherwise, it defaults to Loki. If your query does not run against Prometheus, you can change some filters or aggregations to make the switch. In the OpenShift web console, you can force the use of Prometheus. An error message is displayed when incompatible queries fail, which can help you figure out which labels to change to make the query compatible. For example, changing a filter or an aggregation from *Resource* or *Pods* to *Owner*.
13+
14+
Consider using the FlowMetrics API to create your own metric::
15+
If the data that you need isn't available as a Prometheus metric, you can use the FlowMetrics API to create your own metric. For more information, see "FlowMetrics API Reference" and "Configuring custom metrics by using FlowMetric API".
16+
17+
Configure Loki to improve the query performance::
18+
+
19+
If the problem persists, you can consider configuring Loki to improve the query performance. Some options depend on the installation mode you used for Loki, such as using the Operator and `LokiStack`, or `Monolithic` mode, or `Microservices` mode.
20+
+
21+
* In `LokiStack` or `Microservices` modes, try link:https://loki-operator.dev/docs/api.md/#loki-grafana-com-v1-LokiComponentSpec[increasing the number of querier replicas].
22+
* Increase the link:https://loki-operator.dev/docs/api.md/#loki-grafana-com-v1-QueryLimitSpec[query timeout]. You must also increase the Network Observability read timeout to Loki in the `FlowCollector` `spec.loki.readTimeout`.
23+
24+

observability/network_observability/troubleshooting-network-observability.adoc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,10 @@ include::modules/troubleshooting-network-observability-loki-empty-ring.adoc[leve
3030
== Resource troubleshooting
3131

3232
include::modules/troubleshooting-network-observability-loki-tenant-rate-limit.adoc[leveloffset=+1]
33+
include::modules/troubleshooting-network-observability-loki-large-query-timeout.adoc[leveloffset=+1]
34+
35+
[role="_additional-resources"]
36+
.Additional resources
37+
* xref:../../observability/network_observability/json-flows-format-reference.adoc#network-observability-flows-format_json_reference[Network flows format reference]
38+
* xref:../../observability/network_observability/flowmetric-api.adoc#flowmetric-flows-netobserv-io-v1alpha1[FlowMetric API reference]
39+
* xref:../../observability/network_observability/metrics-alerts-dashboards.adoc#network-observability-configuring-custom-metrics_metrics-dashboards-alerts[Configuring custom metrics by using FlowMetric API]

0 commit comments

Comments
 (0)