

如需與 Amazon Timestream for LiveAnalytics 類似的功能，請考慮使用 Amazon Timestream for InfluxDB。它提供簡化的資料擷取和單一位數毫秒查詢回應時間，以進行即時分析。[在這裡](https://docs.aws.amazon.com//timestream/latest/developerguide/timestream-for-influxdb.html)進一步了解。

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 排程查詢錯誤報告
<a name="scheduledqueries-errorreport"></a>

本節說明執行排程查詢發生錯誤時，Timestream for LiveAnalytics 產生錯誤報告的位置、格式和原因。

**Topics**
+ [原因](#scheduled-queries-error-report-reasons)
+ [Location](#scheduled-queries-error-report-location)
+ [格式](#scheduled-queries-error-report-format)
+ [錯誤類型](#scheduled-queries-error-report-error-types)
+ [範例](#scheduled-queries-error-report-example)

## 排程查詢錯誤報告原因
<a name="scheduled-queries-error-report-reasons"></a>

針對可復原的錯誤產生錯誤報告。無法復原的錯誤不會產生錯誤報告。遇到無法復原的錯誤時，LiveAnalytics 的 Timestream 可以自動停用排程查詢。其中包含：
+ `AssumeRole` 失敗
+ 指定客戶受管 KMS 金鑰與 KMS 通訊時遇到的任何 4xx 錯誤
+ 排程查詢執行時遇到的任何 4xx 錯誤
+ 擷取查詢結果期間遇到的任何 4xx 錯誤

對於無法復原的錯誤，Timestream for LiveAnalytics 會傳送失敗通知，其中包含無法復原的錯誤訊息。也會傳送更新通知，指出排程查詢已停用。

## 排程查詢錯誤報告位置
<a name="scheduled-queries-error-report-location"></a>

排定的查詢錯誤報告位置具有下列命名慣例：

```
s3://customer-bucket/customer-prefix/
```

以下是排程查詢 ARN 的範例：

```
arn:aws:timestream:us-east-1:000000000000:scheduled-query/test-query-hd734tegrgfd
```

```
s3://customer-bucket/customer-prefix/test-query-hd734tegrgfd/<InvocationTime>/<Auto or Manual>/<Actual Trigger Time>
```

*自動*表示 Timestream for LiveAnalytics 自動排程的排程查詢，*手動*表示使用者透過 Amazon Timestream for LiveAnalytics Query 中的 `ExecuteScheduledQuery` API 動作手動觸發的排程查詢。如需 的詳細資訊`ExecuteScheduledQuery`，請參閱 [ExecuteScheduledQuery](https://docs.aws.amazon.com/timestream/latest/developerguide/API_query_ExecuteScheduledQuery.html)。

## 排程查詢錯誤報告格式
<a name="scheduled-queries-error-report-format"></a>

 錯誤報告具有下列 JSON 格式：

```
{
    "reportId": <String>,            // A unique string ID for all error reports belonging to a particular scheduled query run
    "errors": [ <Error>, ... ],      // One or more errors
}
```

## 排程查詢錯誤類型
<a name="scheduled-queries-error-report-error-types"></a>

`Error` 物件可以是三種類型之一：
+ 記錄擷取錯誤

  ```
  {
      "reason": <String>,              // The error message String
      "records": [ <Record>, ... ],    // One or more rejected records )
  }
  ```
+ 資料列剖析和驗證錯誤

  ```
  {
      "reason": <String>,        // The error message String
      "rawLine": <String>,       // [Optional] The raw line String that is being parsed into record(s) to be ingested. This line has encountered the above-mentioned parse error.
  }
  ```
+ 一般錯誤

  ```
  {
      "reason": <String>,        // The error message
  }
  ```

## 排程查詢錯誤報告範例
<a name="scheduled-queries-error-report-example"></a>

以下是因擷取錯誤而產生的錯誤報告範例。

```
{
    "reportId": "C9494AABE012D1FBC162A67EA2C18255",
    "errors": [
        {
            "reason": "The record timestamp is outside the time range [2021-11-12T14:18:13.354Z, 2021-11-12T16:58:13.354Z) of the memory store.",
            "records": [
                {
                    "dimensions": [
                        {
                            "name": "dim0",
                            "value": "d0_1",
                            "dimensionValueType": null
                        },
                        {
                            "name": "dim1",
                            "value": "d1_1",
                            "dimensionValueType": null
                        }
                    ],
                    "measureName": "random_measure_value",
                    "measureValue": "3.141592653589793",
                    "measureValues": null,
                    "measureValueType": "DOUBLE",
                    "time": "1637166175635000000",
                    "timeUnit": "NANOSECONDS",
                    "version": null
                },
                {
                    "dimensions": [
                        {
                            "name": "dim0",
                            "value": "d0_2",
                            "dimensionValueType": null
                        },
                        {
                            "name": "dim1",
                            "value": "d1_2",
                            "dimensionValueType": null
                        }
                    ],
                    "measureName": "random_measure_value",
                    "measureValue": "6.283185307179586",
                    "measureValues": null,
                    "measureValueType": "DOUBLE",
                    "time": "1637166175636000000",
                    "timeUnit": "NANOSECONDS",
                    "version": null
                },
                {
                    "dimensions": [
                        {
                            "name": "dim0",
                            "value": "d0_3",
                            "dimensionValueType": null
                        },
                        {
                            "name": "dim1",
                            "value": "d1_3",
                            "dimensionValueType": null
                        }
                    ],
                    "measureName": "random_measure_value",
                    "measureValue": "9.42477796076938",
                    "measureValues": null,
                    "measureValueType": "DOUBLE",
                    "time": "1637166175637000000",
                    "timeUnit": "NANOSECONDS",
                    "version": null
                },
                {
                    "dimensions": [
                        {
                            "name": "dim0",
                            "value": "d0_4",
                            "dimensionValueType": null
                        },
                        {
                            "name": "dim1",
                            "value": "d1_4",
                            "dimensionValueType": null
                        }
                    ],
                    "measureName": "random_measure_value",
                    "measureValue": "12.566370614359172",
                    "measureValues": null,
                    "measureValueType": "DOUBLE",
                    "time": "1637166175638000000",
                    "timeUnit": "NANOSECONDS",
                    "version": null
                }
            ]
        }
    ]
}
```