feat: troubleshoot write errors (#3003). Fix link in Flux reference. (#3104)

* feat: troubleshooting write errors (#3003). Fix link in Flux reference.

* Update content/influxdb/cloud/organizations/buckets/bucket-schema/_index.md

Co-authored-by: kelseiv <47797004+kelseiv@users.noreply.github.com>

* Update content/influxdb/cloud/write-data/troubleshoot.md

Co-authored-by: kelseiv <47797004+kelseiv@users.noreply.github.com>

* Update content/influxdb/cloud/write-data/troubleshoot.md

Co-authored-by: kelseiv <47797004+kelseiv@users.noreply.github.com>

* Update troubleshoot.md

* Update content/influxdb/cloud/write-data/troubleshoot.md

Co-authored-by: kelseiv <47797004+kelseiv@users.noreply.github.com>

* Update content/influxdb/cloud/write-data/troubleshoot.md

Co-authored-by: kelseiv <47797004+kelseiv@users.noreply.github.com>

* feat: link to timestamp precision definition and accepted values. Link terms in troubleshooting. (#3003)

* fix: link to optimize writes (closes #3110)

Co-authored-by: kelseiv <47797004+kelseiv@users.noreply.github.com>
pull/3106/head^2
Jason Stirnaman 2021-09-13 10:47:30 -05:00 committed by GitHub
parent df802c102a
commit a703908ea3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 178 additions and 8 deletions

View File

@ -30,7 +30,7 @@ The `bucket-schema` examples below reference [**InfluxDB data elements**](/influ
- [Create a bucket schema](#create-a-bucket-schema)
- [Update a bucket schema](#update-a-bucket-schema)
- [Errors](#errors)
- [Troubleshoot errors](#troubleshoot-errors)
### Create a bucket schema
Use the `influx` CLI to set the schema-type and measurement schemas for your bucket:
@ -134,7 +134,12 @@ Use the [`extended-output` flag](/influxdb/cloud/reference/cli/influx/bucket-sch
--columns-file sensor.ndjson
```
### Errors
### Troubleshoot errors
Troubleshoot and resolve the following bucket schema errors:
- [Not permitted by schema](#not-permitted-by-schema)
- [No measurement schemas](#no-measurement-schemas)
- [Failed to create measurement](#failed-to-create-measurement)
#### Not permitted by schema
If data in the write request doesn't conform to the defined schema, InfluxDB returns an error.

View File

@ -15,8 +15,8 @@ Use the `POST` request method and include the following in your request:
|:----------- |:---------- |
| Organization | Use the `org` query parameter in your request URL. |
| Bucket | Use the `bucket` query parameter in your request URL. |
| Precision | Use the `precision` query parameter in your request URL. |
| API token | Use the `Authorization: Token` header. |
| Precision | Use the [`precision`](/influxdb/cloud/write-data/#timestamp-precision) query parameter in your request URL. Default is `ns` |
| API token | Use the `Authorization: Token` header. |
| Line protocol | Pass as plain text in your request body. |
#### Example

View File

@ -0,0 +1,86 @@
---
title: Troubleshoot issues writing data
seotitle: Troubleshoot issues writing data
list_title: Troubleshoot issues writing data
weight: 105
description: >
Troubleshoot issues writing data. Find response codes for failed writes. Discover how writes fail, from exceeding rate or payload limits, to syntax errors and schema conflicts.
menu:
influxdb_cloud:
name: Troubleshoot issues
parent: Write data
nfluxdb/cloud/tags: [write, line protocol, errors]
related:
- /influxdb/cloud/api/#tag/Write, InfluxDB API /write endpoint
- /influxdb/cloud/reference/internals
- /influxdb/cloud/reference/cli/influx/write
---
Learn how to handle and recover from errors when writing to InfluxDB.
- [Discover common failure scenarios](#common-failure-scenarios)
- [Review HTTP status codes](#review-http-status-codes)
- [Troubleshoot failures](#troubleshoot-failures)
## Common failure scenarios
InfluxDB write requests may fail for a number of reasons.
Common failure scenarios that return an HTTP `4xx` or `5xx` error status code include the following:
- Exceeded a rate limit.
- API token was invalid.
- Client or server reached a timeout threshold.
- Size of the data payload was too large.
- Data was not formatted correctly.
- Data did not conform to the [explicit bucket schema](/influxdb/cloud/organizations/buckets/bucket-schema/).
See how to troubleshoot specific [bucket schema errors](/influxdb/cloud/organizations/buckets/bucket-schema/#troubleshoot-errors).
Writes may fail partially or completely even though InfluxDB returns an HTTP `2xx` status code for a valid request.
For example, a partial write may occur when InfluxDB writes all points that conform to the bucket schema, but rejects points that have the wrong data type in a field.
## HTTP status codes
InfluxDB uses conventional HTTP status codes to indicate the success or failure of a request.
Write requests return the following status codes:
- `204` **Success**: InfluxDB validated the request data format and accepted the data for writing to the bucket.
{{% note %}}
`204` doesn't indicate a successful write operation since writes are asynchronous.
If some of your data did not write to the bucket, see how to [troubleshoot rejected points](#troubleshoot-rejected-points).
{{% /note %}}
- `400` **Bad request**: The [line protocol](/influxdb/cloud/reference/syntax/line-protocol/) data in the request was malformed.
The response body contains the first malformed line in the data. All request data was rejected and not written.
- `401` **Unauthorized**: May indicate one of the following:
- [`Authorization: Token` header](/influxdb/cloud/api-guide/api_intro/#authentication) is missing or malformed.
- [API token](/influxdb/cloud/api-guide/api_intro/#authentication) value is missing from the header.
- API token does not have sufficient permissions to write to the organization and bucket. For more information about token types and permissions, see [Manage API tokens](/influxdb/cloud/security/tokens/)
- `404` **Not found**: A requested resource (e.g. an organization or bucket) was not found. The response body contains the requested resource type, e.g. "organization", and resource name.
- `413` **Request entity too large**: The payload exceeded the 50MB limit. All request data was rejected and not written.
- `429` **Too many requests**: API token is temporarily over quota. The `Retry-After` header describes when to try the write request again.
- `500` **Internal server error**: Default HTTP status for an error.
- `503` **Service unavailable**: Server is temporarily unavailable to accept writes. The `Retry-After` header describes when to try the write again.
The `message` property of the response body may contain additional details about the error.
## Troubleshoot failures
If you notice data is missing in your bucket, do the following:
- Check the `message` property in the response body for details about the error.
- Verify all lines contain valid syntax, e.g. [line protocol](/influxdb/cloud/reference/syntax/line-protocol/) or [CSV](/influxdb/cloud/reference/syntax/annotated-csv/).
- Verify the data types match the [bucket schema](/influxdb/cloud/organizations/buckets/bucket-schema/).
For example, did you attempt to write `string` data to an `int` field?
- Verify the timestamps match the [precision parameter](/influxdb/cloud/write-data/#timestamp-precision).
- Minimize payload size and network errors by [optimizing writes](/influxdb/cloud/write-data/best-practices/optimize-writes/)
### Troubleshoot rejected points
InfluxDB may reject points even if the HTTP request returns "Success".
If some of your data did not write to the bucket, check for [field type](/influxdb/cloud/reference/key-concepts/data-elements/#field-value) differences between the missing data point and other points that have the same [series](/influxdb/cloud/reference/key-concepts/data-elements/#series).
For example, did you attempt to write `string` data to an `int` field?
InfluxDB rejects points for the following reasons:
- The **batch** contains another point with the same series, but one of the fields has a different value type.
- The **bucket** contains a saved point with the same series, but one of the fields has a different value type.

View File

@ -81,7 +81,7 @@ In **extended annotated CSV**, measurements, fields, and values and their types
| | `--max-line-length` | Maximum number of bytes that can be read for a single line (default `16000000`) | integer | |
| `-o` | `--org` | Organization name (mutually exclusive with `--org-id`) | string | `INFLUX_ORG` |
| | `--org-id` | Organization ID (mutually exclusive with `--org`) | string | `INFLUX_ORG_ID` |
| `-p` | `--precision` | Precision of the timestamps (default `ns`) | string | `INFLUX_PRECISION` |
| `-p` | `--precision` | [Precision](/influxdb/v2.0/write-data/#timestamp-precision) of the timestamps (default `ns`) | string | `INFLUX_PRECISION` |
| | `--rate-limit` | Throttle write rate (examples: `5 MB / 5 min` or `1MB/s`). | string | |
| | `--skip-verify` | Skip TLS certificate verification | | `INFLUX_SKIP_VERIFY` |
| | `--skipHeader` | Skip first *n* rows of input data | integer | |

View File

@ -24,7 +24,7 @@ The `tripleEMA()` function calculates the exponential moving average of values i
the `_value` column grouped into `n` number of points, giving more weight to recent
data with less lag than
[`exponentialMovingAverage()`](/influxdb/v2.0/reference/flux/stdlib/built-in/transformations/exponentialmovingaverage/)
and [`doubleEMA()`](http://localhost:1313/influxdb/v2.0/reference/flux/stdlib/built-in/transformations/doubleema/).
and [`doubleEMA()`](/influxdb/v2.0/reference/flux/stdlib/built-in/transformations/doubleema/).
_**Function type:** Transformation_

View File

@ -15,8 +15,8 @@ Use the `POST` request method and include the following in your request:
|:----------- |:---------- |
| Organization | Use the `org` query parameter in your request URL. |
| Bucket | Use the `bucket` query parameter in your request URL. |
| Precision | Use the `precision` query parameter in your request URL. |
| API token | Use the `Authorization: Token <API token>` header. |
| Timestamp precision | Use the [`precision`](/influxdb/v2.0/write-data/#timestamp-precision) query parameter in your request URL. Default is `ns`. |
| API token | Use the `Authorization: Token <API token>` header. |
| Line protocol | Pass as plain text in your request body. |
#### Example API write request

View File

@ -0,0 +1,79 @@
---
title: Troubleshoot issues writing data
seotitle: Troubleshoot issues writing data
list_title: Troubleshoot issues writing data
weight: 106 >
Troubleshoot issues writing data. Find response codes for failed writes. Discover how writes fail, from exceeding rate or payload limits, to syntax errors and schema conflicts.
menu:
influxdb_2_0:
name: Troubleshoot issues
parent: Write data
influxdb/v2.0/tags: [write, line protocol, errors]
related:
- /influxdb/v2.0/api/#tag/Write, InfluxDB API /write endpoint
- /influxdb/v2.0/reference/internals
- /influxdb/v2.0/reference/cli/influx/write
---
Learn how to handle and recover from errors when writing to InfluxDB.
- [Discover common failure scenarios](#common-failure-scenarios)
- [HTTP status codes](#http-status-codes)
- [Troubleshoot failures](#troubleshoot-failures)
## Common failure scenarios
Write requests made to InfluxDB may fail for a number of reasons.
Common failure scenarios that return an HTTP `4xx` or `5xx` error status code include the following:
- Request exceeded a rate limit.
- API token was invalid.
- Client or server reached a timeout threshold.
- Size of the data payload was too large.
- Data was not formatted correctly.
Writes may fail partially or completely even though InfluxDB returns an HTTP `2xx` status code for a valid request. For example, a partial write may occur when InfluxDB writes all points that conform to the bucket schema, but rejects points that have the wrong data type in a field.
## HTTP status codes
InfluxDB uses conventional HTTP status codes to indicate the success or failure of a request.
Write requests return the following status codes:
- `204` **Success**: InfluxDB validated the request data format and accepted the data for writing to the bucket.
{{% note %}}
`204` doesn't indicate a successful write operation since writes are asynchronous.
If some of your data did not write to the bucket, see how to [troubleshoot rejected points](#troubleshoot-rejected-points).
{{% /note %}}
- `400` **Bad request**: The [line protocol](/influxdb/v2.0/reference/syntax/line-protocol/) data in the request was malformed.
The response body contains the first malformed line in the data. All request data was rejected and not written.
- `401` **Unauthorized**: May indicate one of the following:
- [`Authorization: Token` header](/influxdb/v2.0/api-guide/api_intro/#authentication) is missing or malformed.
- [API token](/influxdb/v2.0/api-guide/api_intro/#authentication) value is missing from the header.
- API token does not have sufficient permissions to write to the organization and the bucket. For more information about token types and permissions, see [Manage API tokens](/influxdb/v2.0/security/tokens/)
- `404` **Not found**: A requested resource (e.g. an organization or bucket) was not found. The response body contains the requested resource type, e.g. "organization", and resource name.
- `413` **Request entity too large**: All request data was rejected and not written. InfluxDB OSS only returns this error if the [Go (golang) `ioutil.ReadAll()`](https://pkg.go.dev/io/ioutil#ReadAll) function raises an error.
- `500` **Internal server error**: Default HTTP status for an error.
- `503` **Service unavailable**: Server is temporarily unavailable to accept writes. The `Retry-After` header describes when to try the write again.
The `message` property of the response body may contain additional details about the error.
## Troubleshoot failures
If you notice data is missing in your bucket, do the following:
- Check the `message` property in the response body for details about the error
- Verify all lines contain valid syntax, e.g. [line protocol](/influxdb/v2.0/reference/syntax/line-protocol/) or [CSV](/influxdb/v2.0/reference/syntax/annotated-csv/)
- Verify the data types match other data points with the same series.
For example, did you attempt to write `string` data to an `int` field?
- Verify the timestamps match the [precision parameter](/influxdb/v2.0/write-data/#timestamp-precision).
- Minimize payload size and network errors by [optimizing writes](/influxdb/v2.0/write-data/best-practices/optimize-writes/)
### Troubleshoot rejected points
InfluxDB may reject points even if the HTTP request returns "Success".
If some of your data did not write to the bucket, check for [field type](/influxdb/v2.0/reference/key-concepts/data-elements/#field-value) differences between the missing data point and other points that have the same [series](/influxdb/v2.0/reference/key-concepts/data-elements/#series).
For example, did you attempt to write `string` data to an `int` field?
InfluxDB rejects points for the following reasons:
- The **batch** contains another point with the same series, but one of the fields has a different value type.
- The **bucket** contains another point with the same series, but one of the fields has a different value type.