View a markdown version of this page

アプリケーションのテレメトリの取り込み - Amazon OpenSearch Service

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

アプリケーションのテレメトリの取り込み

Amazon OpenSearch Service でオブザーバビリティ機能を使用するには、アプリケーショントレース、ログ、メトリクスを取り込む必要があります。このページでは、テレメトリデータを処理して OpenSearch および Amazon Managed Service for Prometheus にルーティングするように OpenTelemetry Collector および OpenSearch Ingestion パイプラインを設定する方法について説明します。

OpenTelemetry Collector の設定

OpenTelemetry (OTel) Collector は、すべてのアプリケーションテレメトリのエントリポイントです。OTLP を介してデータを受信し、メトリクスを Prometheus に送信しながら、トレースとログを OpenSearch Ingestion にルーティングします。

OTel Collector は、次のいずれかの方法を使用して設定できます。

OTel Collector は、SigV4 認証を使用して OpenSearch Ingestion エンドポイントにトレースとログをエクスポートし、Prometheus リモート書き込みエクスポーターを使用してメトリクスを Amazon Managed Service for Prometheus にエクスポートします。OpenSearch Ingestion は、処理、エンリッチメント、および OpenSearch へのルーティングを処理します。

OpenSearch Ingestion を使用した OTel Collector の設定

次の設定例では、SigV4 認証を使用して、トレースとログを OpenSearch Ingestion エンドポイントにエクスポートし、メトリクスを Prometheus にエクスポートします。

extensions: sigv4auth: region: us-west-2 service: osis exporters: otlphttp/osis-traces: traces_endpoint: ${OSIS_ENDPOINT}/v1/traces auth: { authenticator: sigv4auth } compression: none otlphttp/osis-logs: logs_endpoint: ${OSIS_ENDPOINT}/v1/logs auth: { authenticator: sigv4auth } compression: none # Amazon Managed Service for Prometheus via Prometheus Remote Write with SigV4 auth prometheusremotewrite/amp: endpoint: "https://aps-workspaces.region.amazonaws.com/workspaces/workspace-id/api/v1/remote_write" auth: authenticator: sigv4auth service: extensions: [sigv4auth] pipelines: traces: receivers: [otlp] processors: [batch] exporters: [otlphttp/osis-traces] logs: receivers: [otlp] processors: [batch] exporters: [otlphttp/osis-logs] metrics: receivers: [otlp] processors: [batch] exporters: [prometheusremotewrite/amp]
注記

データを送信する IAM プリンシパルには、パイプライン ARN に対する osis:Ingestと アクセスaps:RemoteWrite許可が必要です。

OpenSearch Ingestion パイプラインの設定

OpenSearch Ingestion (またはセルフマネージド Data Prepper) は、OTel Collector からテレメトリを受け取り、アプリケーションパフォーマンスモニタリング (APM) のために処理します。

パイプラインアーキテクチャ

パイプラインは、テレメトリデータを次の段階で処理します。

  1. エントリパイプラインはすべてのテレメトリを受信し、ログとトレースを別々のサブパイプラインにルーティングします。

  2. ログパイプラインは、log-analytics-plainインデックスタイプを使用して OpenSearch にログデータを書き込みます。

  3. トレースパイプラインは、raw ストレージパイプラインとサービスマップパイプラインにスパンを分散します。

  4. raw トレースパイプラインプロセスはotel_tracesプロセッサにまたがり、trace-analytics-plain-rawインデックスタイプに保存されます。

  5. サービスマップパイプラインは、otel_apm_service_mapプロセッサを使用してトポロジと RED (レート、エラー、期間) メトリクスを生成します。リモート書き込みを通じて OpenSearch と Prometheus に書き込みます。

パイプラインの設定

次の例は、ログ、トレース、メトリクスなど、すべてのオブザーバビリティシグナルタイプをカバーする OpenSearch Ingestion の完全なパイプライン設定を示しています。すべてのパイプラインを含めることも、ユースケースに関連するパイプラインのみを含めることもできます。プレースホルダー値を、ユーザー自身の情報に置き換えます。

version: '2' # Main OTLP pipeline - receives all telemetry and routes by signal type otlp-pipeline: source: otlp: logs_path: '/pipeline-name/v1/logs' traces_path: '/pipeline-name/v1/traces' metrics_path: '/pipeline-name/v1/metrics' route: - logs: 'getEventType() == "LOG"' - traces: 'getEventType() == "TRACE"' - metrics: 'getEventType() == "METRIC"' processor: [] sink: - pipeline: name: otel-logs-pipeline routes: - logs - pipeline: name: otel-traces-pipeline routes: - traces - pipeline: name: otel-metrics-pipeline routes: - metrics # Log processing pipeline otel-logs-pipeline: source: pipeline: name: otlp-pipeline processor: - copy_values: entries: - from_key: "time" to_key: "@timestamp" sink: - opensearch: hosts: - 'https://opensearch-endpoint' index_type: log-analytics-plain aws: serverless: false region: 'region' sts_role_arn: "arn:aws:iam::account-id:role/pipeline-role" # Trace fan-out pipeline otel-traces-pipeline: source: pipeline: name: otlp-pipeline processor: [] sink: - pipeline: name: traces-raw-pipeline routes: [] - pipeline: name: service-map-pipeline routes: [] # Raw trace storage pipeline traces-raw-pipeline: source: pipeline: name: otel-traces-pipeline processor: - otel_traces: sink: - opensearch: hosts: - 'https://opensearch-endpoint' index_type: trace-analytics-plain-raw aws: serverless: false region: 'region' sts_role_arn: "arn:aws:iam::account-id:role/pipeline-role" # Service map generation pipeline (APM) service-map-pipeline: source: pipeline: name: otel-traces-pipeline processor: - otel_apm_service_map: group_by_attributes: - telemetry.sdk.language # Add any resource attribute to group by window_duration: 30s route: - otel_apm_service_map_route: 'getEventType() == "SERVICE_MAP"' - service_processed_metrics: 'getEventType() == "METRIC"' sink: - opensearch: hosts: - 'https://opensearch-endpoint' aws: serverless: false region: 'region' sts_role_arn: "arn:aws:iam::account-id:role/pipeline-role" routes: - otel_apm_service_map_route index_type: otel-v2-apm-service-map - prometheus: url: 'https://aps-workspaces.region.amazonaws.com/workspaces/workspace-id/api/v1/remote_write' aws: region: 'region' routes: - service_processed_metrics # Metrics processing pipeline otel-metrics-pipeline: source: pipeline: name: otlp-pipeline processor: - otel_metrics: sink: - prometheus: url: 'https://aps-workspaces.region.amazonaws.com/workspaces/workspace-id/api/v1/remote_write' aws: region: 'region'

取り込みの検証

OTel Collector とパイプラインを設定したら、テレメトリデータが正しく流れていることを確認します。

  • OpenSearch インデックスの検証 – ドメインに次のインデックスが存在することを確認します: otel-v1-apm-span-*otel-v2-apm-service-maplogs-otel-v1-*

  • Prometheus ターゲットの検証 – Prometheus リモート書き込みターゲットがサービスマップパイプラインからメトリクスを受信していることを確認します。

  • OpenSearch UI で検証オブザーバビリティに移動し、Application Monitoring に移動してサービスが表示されることを確認します。

次の手順

テレメトリデータが取り込まれたことを確認したら、次のトピックを参照してください。