

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# OpenSearch Ingestion パイプラインを OpenTelemetry コレクターで使用する
<a name="configure-client-otel"></a>

[OpenTelemetry Collector](https://opentelemetry.io/docs/collector/) を使用して、OpenSearch Ingestion パイプラインにログ、トレース、メトリクスを取り込むことができます。1 つのパイプラインを使用して、すべてのログ、トレース、メトリクスをドメインまたはコレクション上の異なるインデックスに取り込むことができます。パイプラインを使用して、ログ、トレース、またはメトリクスのみを個別に取り込むこともできます。

**Topics**
+ [前提条件](#otel-prereqs)
+ [ステップ 1: パイプラインロールを設定する](#otel-pipeline-role)
+ [ステップ 2: パイプラインを作成する](#create-otel-pipeline)
+ [クロスアカウント接続](#x-account-connectivity)
+ [制限事項](#otel-limitations)
+ [OpenTelemetry ソースに推奨される CloudWatch アラーム](#otel-pipeline-metrics)

## 前提条件
<a name="otel-prereqs"></a>

[OpenTelemetry 設定ファイルを](https://opentelemetry.io/docs/collector/configuration/)セットアップするときに、取り込みを行うには、以下を設定する必要があります。
+ 取り込みロールには、パイプラインを操作するための`osis:Ingest`アクセス許可が必要です。詳細については、[「取り込みロール](https://docs.aws.amazon.com/opensearch-service/latest/developerguide/pipeline-security-overview.html#pipeline-security-same-account)」を参照してください。
+ エンドポイント値にはパイプラインエンドポイントを含める必要があります。例: `https://pipeline-endpoint.us-east-1.osis.amazonaws.com.`
+ サービス値は である必要があります`osis`。
+ OTLP/HTTP Exporter の圧縮オプションは、パイプラインが選択したソースの圧縮オプションと一致する必要があります。

```
extensions:
    sigv4auth:
        region: "region"
        service: "osis"

exporters:
    otlphttp:
        logs_endpoint: "https://pipeline-endpoint.us-east-1.osis.amazonaws.com/v1/logs"
        metrics_endpoint: "https://pipeline-endpoint.us-east-1.osis.amazonaws.com/v1/metrics"
        traces_endpoint: "https://pipeline-endpoint.us-east-1.osis.amazonaws.com/v1/traces"
        auth:
            authenticator: sigv4auth
        compression: none

service:
    extensions: [sigv4auth]
    pipelines:
        traces:
        receivers: [jaeger]
        exporters: [otlphttp]
```

## ステップ 1: パイプラインロールを設定する
<a name="otel-pipeline-role"></a>

 OpenTelemetry コレクター設定をセットアップしたら、[パイプライン設定で使用するパイプラインロールを設定します](https://docs.aws.amazon.com/opensearch-service/latest/developerguide/pipeline-security-overview.html#pipeline-security-sink)。パイプラインロールが OTLP ソースに必要な特定のアクセス許可はなく、OpenSearch ドメインまたはコレクションへのアクセス権をパイプラインに付与するアクセス許可のみです。

## ステップ 2: パイプラインを作成する
<a name="create-otel-pipeline"></a>

 その後、ソースとして OTLP を指定する OpenSearch Ingestion パイプラインを次のように設定できます。OpenTelemetry ログ、メトリクス、トレースを個々のソースとして設定することもできます。

OTLP ソースパイプライン設定:

```
version: 2
otlp-pipeline:
    source:
        otlp:
            logs_path: /otlp-pipeline/v1/logs
            traces_path: /otlp-pipeline/v1/traces
            metrics_path: /otlp-pipeline/v1/metrics
    sink:
        - opensearch:
            hosts: ["https://search-mydomain.region.es.amazonaws.com"]
            index: "ss4o_metrics-otel-%{yyyy.MM.dd}"
            index_type: custom
            aws:
                region: "region"
```

OpenTelemetry Logs パイプライン設定:

```
version: 2
otel-logs-pipeline:
  source:
    otel_logs_source:
        path: /otel-logs-pipeline/v1/logs
  sink:
    - opensearch:
        hosts: ["https://search-mydomain.region.es.amazonaws.com"]
        index: "ss4o_metrics-otel-%{yyyy.MM.dd}"
        index_type: custom
        aws:
            region: "region"
```

OpenTelemetry Metrics パイプライン設定:

```
version: 2
otel-metrics-pipeline:
  source:
    otel_metrics_source:
        path: /otel-metrics-pipeline/v1/metrics
  sink:
    - opensearch:
        hosts: ["https://search-mydomain.region.es.amazonaws.com"]
        index: "ss4o_metrics-otel-%{yyyy.MM.dd}"
        index_type: custom
        aws:
            region: "region"
```

OpenTelemetry Traces パイプライン設定:

```
version: 2
otel-trace-pipeline:
  source:
    otel_trace_source:
        path: /otel-traces-pipeline/v1/traces
  sink:
    - opensearch:
        hosts: ["https://search-mydomain.region.es.amazonaws.com"]
        index: "ss4o_metrics-otel-%{yyyy.MM.dd}"
        index_type: custom
        aws:
            region: "region"
```

事前設定されたブループリントを使用して、このパイプラインを作成できます。詳細については、「[ブループリントの使用](pipeline-blueprint.md)」を参照してください。

## クロスアカウント接続
<a name="x-account-connectivity"></a>

 OpenTelemetry ソースを使用した OpenSearch OpenSearch Ingestion パイプラインには、クロスアカウント取り込み機能があります。Amazon OpenSearch Ingestion を使用すると、仮想プライベートクラウド (VPC) AWS アカウント から別の VPC 内のパイプラインエンドポイントにパイプラインを共有できます。詳細については、「[クロスアカウント取り込み用の OpenSearch Ingestion パイプラインの設定](cross-account-pipelines.md)」を参照してください。

## 制限事項
<a name="otel-limitations"></a>

 OpenSearch Ingestion パイプラインは、20 mb を超えるリクエストを受信できません。この値は、 `max_request_length`オプションでユーザーが設定します。このオプションはデフォルトで 10mb です。

## OpenTelemetry ソースに推奨される CloudWatch アラーム
<a name="otel-pipeline-metrics"></a>

 取り込みパイプラインのパフォーマンスをモニタリングするには、次の CloudWatch メトリクスをお勧めします。これらのメトリクスは、エクスポートから処理されたデータ量、ストリームから処理されたイベント量、エクスポートとストリームイベントの処理エラー、宛先に書き込まれたドキュメントの数を特定するのに役立ちます。これらのメトリクスの 1 つが、指定された時間にわたって指定された値を超えた場合にアクションを実行するように CloudWatch アラームを設定できます。

 OTLP ソースの CloudWatch メトリクスは の形式です`{pipeline-name}.otlp.{logs | traces | metrics}.{metric-name}`。例えば、`otel-pipeline.otlp.metrics.requestTimeouts.count`。

 個々の OpenTelemetry ソースを使用する場合、メトリクスは の形式になります`{pipeline-name}.{source-name}.{metric-name}`。例えば、`trace-pipeline.otel_trace_source.requestTimeouts.count`。

3 つの OpenTelemetry データ型はすべて同じメトリクスを持ちますが、簡潔にするために、メトリクスは OTLP ソースログタイプのデータの以下の表にのみ表示されます。


| メトリクス | 説明 | 
| --- |--- |
| otel-pipeline.BlockingBuffer.bufferUsage.value |  使用されているバッファの量を示します。  | 
|  otel-pipeline.otlp.logs.requestTimeouts.count  |  タイムアウトしたリクエストの数。  | 
|  otel-pipeline.otlp.logs.requestsReceived.count  |  OpenTelemetry Collector が受信したリクエストの数。  | 
|  otel-pipeline.otlp.logs.badRequests.count  |  OpenTelemetry Collector が受信した不正な形式のリクエストの数。  | 
|  otel-pipeline.otlp.logs.requestsTooLarge.count  |  OpenTelemetry Collector が受信した最大 20 mb を超えるリクエストの数。  | 
|  otel-pipeline.otlp.logs.internalServerError.count  | The number of HTTP 500 errors received from the OpenTelemetry Collector. | 
|  otel-pipeline.opensearch.bulkBadRequestErrors.count  | Count of errors during bulk requests due to malformed request. | 
|  otel-pipeline.opensearch.bulkRequestLatency.avg  | Average latency for bulk write requests made to OpenSearch. | 
|  otel-pipeline.opensearch.bulkRequestNotFoundErrors.count  | Number of bulk requests that failed because the target data could not be found. | 
|  otel-pipeline.opensearch.bulkRequestNumberOfRetries.count  | Number of retries by OpenSearch Ingestion pipelines to write OpenSearch cluster. | 
|  otel-pipeline.opensearch.bulkRequestSizeBytes.sum  | Total size in bytes of all bulk requests made to OpenSearch. | 
|  otel-pipeline.opensearch.documentErrors.count  | Number of errors when sending documents to OpenSearch. The documents causing the errors witll be sent to DLQ. | 
|  otel-pipeline.opensearch.documentsSuccess.count  | Number of documents successfully written to an OpenSearch cluster or collection. | 
|  otel-pipeline.opensearch.documentsSuccessFirstAttempt.count  | Number of documents successfully indexed in OpenSearch on the first attempt. | 
|  `otel-pipeline.opensearch.documentsVersionConflictErrors.count`  | Count of errors due to version conflicts in documents during processing. | 
|  `otel-pipeline.opensearch.PipelineLatency.avg`  | Average latency of OpenSearch Ingestion pipeline to process the data by reading from the source to writing to the destination. | 
|  otel-pipeline.opensearch.PipelineLatency.max  | Maximum latency of OpenSearch Ingestion pipeline to process the data by reading from the source to writing the destination. | 
|  otel-pipeline.opensearch.recordsIn.count  | Count of records successfully ingested into OpenSearch. This metric is essential for tracking the volume of data being processed and stored. | 
|  otel-pipeline.opensearch.s3.dlqS3RecordsFailed.count  | Number of records that failed to write to DLQ. | 
|  otel-pipeline.opensearch.s3.dlqS3RecordsSuccess.count  | Number of records that are written to DLQ. | 
|  otel-pipeline.opensearch.s3.dlqS3RequestLatency.count  | Count of latency measurements for requests to the Amazon S3 dead-letter queue. | 
|  otel-pipeline.opensearch.s3.dlqS3RequestLatency.sum  | Total latency for all requests to the Amazon S3 dead-letter queue | 
|  otel-pipeline.opensearch.s3.dlqS3RequestSizeBytes.sum  | Total size in bytes of all requests made to the Amazon S3 dead-letter queue. | 
|  otel-pipeline.recordsProcessed.count  | Total number of records processed in the pipeline, a key metric for overal throughput. | 
|  `otel-pipeline.opensearch.bulkRequestInvalidInputErrors.count`  | Count of bulk request errors in OpenSearch due to invalid input, crucial for monitoring data quality and operational issues. | 