Skip to content

Commit b4f0f81

Browse files
authored
Merge branch 'master' into feature/pr-5974-add-api-examples-to-cache-guides
2 parents 50b0fc0 + 7de4b11 commit b4f0f81

File tree

34 files changed

+6339
-2677
lines changed

34 files changed

+6339
-2677
lines changed

.ci/vale/styles/config/vocabularies/InfluxDataDocs/accept.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ LogicalPlan
3131
[Mm]onitor
3232
MBs?
3333
PBs?
34-
Parquet
34+
Parquet|\b\w*-*parquet-\w*\b|\b--\w*parquet\w*\b|`[^`]*parquet[^`]*`
3535
Redoc
3636
SQLAlchemy
3737
SQLAlchemy

content/influxdb3/cloud-dedicated/query-data/execute-queries/client-libraries/python.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ related:
2626
- /influxdb3/cloud-dedicated/reference/influxql/
2727
- /influxdb3/cloud-dedicated/reference/sql/
2828
- /influxdb3/cloud-dedicated/query-data/execute-queries/troubleshoot/
29+
- /influxdb3/cloud-dedicated/query-data/troubleshoot-and-optimize/query-timeout-best-practices/
2930

3031
list_code_example: |
3132
```py
@@ -240,7 +241,8 @@ from influxdb_client_3 import InfluxDBClient3
240241
client = InfluxDBClient3(
241242
host='{{< influxdb/host >}}',
242243
token='DATABASE_TOKEN',
243-
database='DATABASE_NAME'
244+
database='DATABASE_NAME',
245+
timeout=60 # Set default timeout to 60 seconds
244246
)
245247
```
246248
{{% /code-placeholders %}}
@@ -275,6 +277,7 @@ client = InfluxDBClient3(
275277
host="{{< influxdb/host >}}",
276278
token='DATABASE_TOKEN',
277279
database='DATABASE_NAME',
280+
timeout=60, # Set default timeout to 60 seconds
278281
flight_client_options=flight_client_options(
279282
tls_root_certs=cert))
280283
...
@@ -332,7 +335,8 @@ client = InfluxDBClient3(
332335
# Execute the query and return an Arrow table
333336
table = client.query(
334337
query="SELECT * FROM home",
335-
language="sql"
338+
language="sql",
339+
timeout=30 # Override default timeout for simple queries (30 seconds)
336340
)
337341
338342
print("\n#### View Schema information\n")
@@ -377,7 +381,8 @@ client = InfluxDBClient3(
377381
# Execute the query and return an Arrow table
378382
table = client.query(
379383
query="SELECT * FROM home",
380-
language="influxql"
384+
language="influxql",
385+
timeout=30 # Override default timeout for simple queries (30 seconds)
381386
)
382387
383388
print("\n#### View Schema information\n")

content/influxdb3/cloud-dedicated/query-data/execute-queries/influxctl-cli.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ influxdb3/cloud-dedicated/tags: [query, sql, influxql, influxctl, CLI]
1313
related:
1414
- /influxdb3/cloud-dedicated/reference/cli/influxctl/query/
1515
- /influxdb3/cloud-dedicated/get-started/query/#execute-an-sql-query, Get started querying data
16+
- /influxdb3/cloud-dedicated/query-data/troubleshoot-and-optimize/query-timeout-best-practices/, Query timeout best practices
1617
- /influxdb3/cloud-dedicated/reference/sql/
1718
- /influxdb3/cloud-dedicated/reference/influxql/
1819
list_code_example: |
@@ -142,6 +143,34 @@ Replace the following:
142143
- {{% code-placeholder-key %}}`DATABASE_NAME`{{% /code-placeholder-key %}}:
143144
Name of the database to query
144145

146+
## Query timeouts
147+
148+
The [`influxctl --timeout` global flag](/influxdb3/cloud-dedicated/reference/cli/influxctl/) sets the maximum duration for API calls, including query requests.
149+
If a query takes longer than the specified timeout, the operation will be canceled.
150+
151+
### Timeout examples
152+
153+
Use different timeout values based on your query type:
154+
155+
{{% code-placeholders "DATABASE_(TOKEN|NAME)" %}}
156+
```sh
157+
# Shorter timeout for testing dashboard queries (10 seconds)
158+
influxctl query \
159+
--timeout 10s \
160+
--token DATABASE_TOKEN \
161+
--database DATABASE_NAME \
162+
"SELECT AVG(temperature) FROM sensors WHERE time >= now() - INTERVAL '1 day'"
163+
164+
# Longer timeout for analytical queries (5 minutes)
165+
influxctl query \
166+
--timeout 5m \
167+
--token DATABASE_TOKEN \
168+
--database DATABASE_NAME \
169+
"SELECT room, AVG(temperature) FROM sensors WHERE time >= now() - INTERVAL '30 days' GROUP BY room"
170+
```
171+
{{% /code-placeholders %}}
172+
173+
For guidance on selecting appropriate timeout values, see [Query timeout best practices](/influxdb3/cloud-dedicated/query-data/troubleshoot-and-optimize/query-timeout-best-practices/).
145174

146175
## Output format
147176

@@ -243,7 +272,7 @@ influxctl query \
243272
{{% /influxdb/custom-timestamps %}}
244273

245274
{{< expand-wrapper >}}
246-
{{% expand "View example results with unix nanosecond timestamps" %}}
275+
{{% expand "View example results with Unix nanosecond timestamps" %}}
247276
{{% influxdb/custom-timestamps %}}
248277
```
249278
+-------+--------+---------+------+---------------------+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
title: Query timeout best practices
3+
description: Learn how to set appropriate query timeouts to balance performance and resource protection.
4+
menu:
5+
influxdb3_cloud_dedicated:
6+
name: Query timeout best practices
7+
parent: Troubleshoot and optimize queries
8+
weight: 205
9+
related:
10+
- /influxdb3/cloud-dedicated/reference/client-libraries/v3/
11+
- /influxdb3/cloud-dedicated/query-data/execute-queries/influxctl-cli/
12+
source: shared/influxdb3-query-guides/query-timeout-best-practices.md
13+
---
14+
15+
<!--
16+
//SOURCE - content/shared/influxdb3-query-guides/query-timeout-best-practices.md
17+
>

content/influxdb3/cloud-dedicated/query-data/troubleshoot-and-optimize/troubleshoot.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ related:
1212
- /influxdb3/cloud-dedicated/query-data/sql/
1313
- /influxdb3/cloud-dedicated/query-data/influxql/
1414
- /influxdb3/cloud-dedicated/reference/client-libraries/v3/
15+
- /influxdb3/cloud-dedicated/query-data/troubleshoot-and-optimize/query-timeout-best-practices/
1516
aliases:
1617
- /influxdb3/cloud-dedicated/query-data/execute-queries/troubleshoot/
1718
- /influxdb3/cloud-dedicated/query-data/troubleshoot-and-optimize/trace/
@@ -30,7 +31,9 @@ If a query doesn't return any data, it might be due to the following:
3031

3132
- Your data falls outside the time range (or other conditions) in the query--for example, the InfluxQL `SHOW TAG VALUES` command uses a default time range of 1 day.
3233
- The query (InfluxDB server) timed out.
33-
- The query client timed out.
34+
- The query client timed out.
35+
See [Query timeout best practices](/influxdb3/cloud-dedicated/query-data/troubleshoot-and-optimize/query-timeout-best-practices/)
36+
for guidance on setting appropriate timeouts.
3437
- The query return type is not supported by the client library.
3538
For example, array or list types may not be supported.
3639
In this case, use `array_to_string()` to convert the array value to a string--for example:

content/influxdb3/cloud-dedicated/write-data/troubleshoot.md

Lines changed: 6 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -10,101 +10,15 @@ menu:
1010
influxdb3_cloud_dedicated:
1111
name: Troubleshoot issues
1212
parent: Write data
13-
influxdb3/cloud-dedicated/tags: [write, line protocol, errors]
13+
influxdb3/cloud-dedicated/tags: [write, line protocol, errors, partial writes]
1414
related:
15+
- /influxdb3/cloud-dedicated/get-started/write/
1516
- /influxdb3/cloud-dedicated/reference/syntax/line-protocol/
1617
- /influxdb3/cloud-dedicated/write-data/best-practices/
1718
- /influxdb3/cloud-dedicated/reference/internals/durability/
19+
source: /shared/influxdb3-write-guides/troubleshoot-distributed.md
1820
---
1921

20-
Learn how to avoid unexpected results and recover from errors when writing to {{% product-name %}}.
21-
22-
- [Handle write responses](#handle-write-responses)
23-
- [Review HTTP status codes](#review-http-status-codes)
24-
- [Troubleshoot failures](#troubleshoot-failures)
25-
- [Troubleshoot rejected points](#troubleshoot-rejected-points)
26-
27-
## Handle write responses
28-
29-
{{% product-name %}} does the following when you send a write request:
30-
31-
1. Validates the request.
32-
2. If successful, attempts to [ingest data](/influxdb3/cloud-dedicated/reference/internals/durability/#data-ingest) from the request body; otherwise, responds with an [error status](#review-http-status-codes).
33-
3. Ingests or rejects data in the batch and returns one of the following HTTP status codes:
34-
35-
- `204 No Content`: All data in the batch is ingested.
36-
- `400 Bad Request`: Some (_when **partial writes** are configured for the cluster_) or all of the data has been rejected. Data that has not been rejected is ingested and queryable.
37-
38-
The response body contains error details about [rejected points](#troubleshoot-rejected-points), up to 100 points.
39-
40-
Writes are synchronous--the response status indicates the final status of the write and all ingested data is queryable.
41-
42-
To ensure that InfluxDB handles writes in the order you request them,
43-
wait for the response before you send the next request.
44-
45-
### Review HTTP status codes
46-
47-
InfluxDB uses conventional HTTP status codes to indicate the success or failure of a request.
48-
The `message` property of the response body may contain additional details about the error.
49-
{{< product-name >}} returns one the following HTTP status codes for a write request:
50-
51-
| HTTP response code | Response body | Description |
52-
|:------------------------------|:------------------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
53-
| `204 No Content"` | no response body | If InfluxDB ingested all of the data in the batch |
54-
| `400 "Bad request"` | error details about rejected points, up to 100 points: `line` contains the first rejected line, `message` describes rejections | If some (_when **partial writes** are configured for the cluster_) or all request data isn't allowed (for example, if it is malformed or falls outside of the bucket's retention period)--the response body indicates whether a partial write has occurred or if all data has been rejected |
55-
| `401 "Unauthorized"` | | If the `Authorization` header is missing or malformed or if the [token](/influxdb3/cloud-dedicated/admin/tokens/) doesn't have [permission](/influxdb3/cloud-dedicated/reference/cli/influxctl/token/create/#examples) to write to the database. See [examples using credentials](/influxdb3/cloud-dedicated/get-started/write/#write-line-protocol-to-influxdb) in write requests. |
56-
| `404 "Not found"` | requested **resource type** (for example, "organization" or "database"), and **resource name** | If a requested resource (for example, organization or database) wasn't found |
57-
| `422 "Unprocessable Entity"` | `message` contains details about the error | If the data isn't allowed (for example, falls outside of the database’s retention period).
58-
| `500 "Internal server error"` | | Default status for an error |
59-
| `503 "Service unavailable"` | | If the server is temporarily unavailable to accept writes. The `Retry-After` header contains the number of seconds to wait before trying the write again.
60-
61-
The `message` property of the response body may contain additional details about the error.
62-
If your data did not write to the database, see how to [troubleshoot rejected points](#troubleshoot-rejected-points).
63-
64-
## Troubleshoot failures
65-
66-
If you notice data is missing in your database, do the following:
67-
68-
- Check the [HTTP status code](#review-http-status-codes) in the response.
69-
- Check the `message` property in the response body for details about the error.
70-
- If the `message` describes a field error, [troubleshoot rejected points](#troubleshoot-rejected-points).
71-
- Verify all lines contain valid syntax ([line protocol](/influxdb3/cloud-dedicated/reference/syntax/line-protocol/)).
72-
- Verify the timestamps in your data match the [precision parameter](/influxdb3/cloud-dedicated/reference/glossary/#precision) in your request.
73-
- Minimize payload size and network errors by [optimizing writes](/influxdb3/cloud-dedicated/write-data/best-practices/optimize-writes/).
74-
75-
## Troubleshoot rejected points
76-
77-
When writing points from a batch, InfluxDB rejects points that have syntax errors or schema conflicts.
78-
If InfluxDB processes the data in your batch and then rejects points, the [HTTP response](#handle-write-responses) body contains the following properties that describe rejected points:
79-
80-
- `code`: `"invalid"`
81-
- `line`: the line number of the _first_ rejected point in the batch.
82-
- `message`: a string that contains line-separated error messages, one message for each rejected point in the batch, up to 100 rejected points.
83-
84-
InfluxDB rejects points for the following reasons:
85-
86-
- a line protocol parsing error
87-
- an invalid timestamp
88-
- a schema conflict
89-
90-
Schema conflicts occur when you try to write data that contains any of the following:
91-
92-
- a wrong data type: the point falls within the same partition (default partitioning is measurement and day) as existing bucket data and contains a different data type for an existing field
93-
- a tag and a field that use the same key
94-
95-
### Example
96-
97-
The following example shows a response body for a write request that contains two rejected points:
98-
99-
```json
100-
{
101-
"code": "invalid",
102-
"line": 2,
103-
"message": "failed to parse line protocol:
104-
errors encountered on line(s):
105-
error parsing line 2 (1-based): Invalid measurement was provided
106-
error parsing line 4 (1-based): Unable to parse timestamp value '123461000000000000000000000000'"
107-
}
108-
```
109-
110-
Check for [field data type](/influxdb3/cloud-dedicated/reference/syntax/line-protocol/#data-types-and-format) differences between the rejected data point and points within the same database and partition--for example, did you attempt to write `string` data to an `int` field?
22+
<!-- The content for this page is at
23+
//SOURCE - content/shared/influxdb3-write-guides/troubleshoot-distributed.md
24+
-->

content/influxdb3/cloud-serverless/query-data/execute-queries/client-libraries/python.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ related:
2727
- /influxdb3/cloud-serverless/reference/influxql/
2828
- /influxdb3/cloud-serverless/reference/sql/
2929
- /influxdb3/cloud-serverless/query-data/execute-queries/troubleshoot/
30+
- /influxdb3/cloud-serverless/query-data/troubleshoot-and-optimize/query-timeout-best-practices/
3031

3132
list_code_example: |
3233
```py
@@ -241,7 +242,8 @@ from influxdb_client_3 import InfluxDBClient3
241242
client = InfluxDBClient3(
242243
host='{{< influxdb/host >}}',
243244
token='API_TOKEN',
244-
database='BUCKET_NAME'
245+
database='BUCKET_NAME',
246+
timeout=30 # Set default timeout to 30 seconds for serverless
245247
)
246248
```
247249
{{% /code-placeholders %}}
@@ -332,7 +334,8 @@ client = InfluxDBClient3(
332334
# Execute the query and return an Arrow table
333335
table = client.query(
334336
query="SELECT * FROM home",
335-
language="sql"
337+
language="sql",
338+
timeout=10 # Override default timeout for simple queries (10 seconds)
336339
)
337340
338341
print("\n#### View Schema information\n")
@@ -377,7 +380,8 @@ client = InfluxDBClient3(
377380
# Execute the query and return an Arrow table
378381
table = client.query(
379382
query="SELECT * FROM home",
380-
language="influxql"
383+
language="influxql",
384+
timeout=10 # Override default timeout for simple queries (10 seconds)
381385
)
382386
383387
print("\n#### View Schema information\n")
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
title: Query timeout best practices
3+
description: Learn how to set appropriate query timeouts to balance performance and resource protection.
4+
menu:
5+
influxdb3_cloud_serverless:
6+
name: Query timeout best practices
7+
parent: Troubleshoot and optimize queries
8+
identifier: query-timeout-best-practices
9+
weight: 201
10+
related:
11+
- /influxdb3/cloud-serverless/reference/client-libraries/v3/
12+
source: shared/influxdb3-query-guides/query-timeout-best-practices.md
13+
---
14+
15+
<!--
16+
//SOURCE - content/shared/influxdb3-query-guides/query-timeout-best-practices.md
17+
>

content/influxdb3/cloud-serverless/query-data/troubleshoot-and-optimize/troubleshoot.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ related:
1212
- /influxdb3/cloud-serverless/query-data/sql/
1313
- /influxdb3/cloud-serverless/query-data/influxql/
1414
- /influxdb3/cloud-serverless/reference/client-libraries/v3/
15+
- /influxdb3/cloud-serverless/query-data/troubleshoot-and-optimize/query-timeout-best-practices/
1516
aliases:
1617
- /influxdb3/cloud-serverless/query-data/execute-queries/troubleshoot/
1718
---
@@ -29,7 +30,9 @@ If a query doesn't return any data, it might be due to the following:
2930

3031
- Your data falls outside the time range (or other conditions) in the query--for example, the InfluxQL `SHOW TAG VALUES` command uses a default time range of 1 day.
3132
- The query (InfluxDB server) timed out.
32-
- The query client timed out.
33+
- The query client timed out.
34+
See [Query timeout best practices](/influxdb3/cloud-serverless/query-data/troubleshoot-and-optimize/query-timeout-best-practices/)
35+
for guidance on setting appropriate timeouts.
3336
- The query return type is not supported by the client library.
3437
For example, array or list types may not be supported.
3538
In this case, use `array_to_string()` to convert the array value to a string--for example:

0 commit comments

Comments
 (0)