API GatewayのX-Rayトレースが無効になっている

運用要件に合わせてAPIリクエストのトレースを有効にしてください。

説明

REST API のステージで X-Ray のアクティブトレースを有効にすると、サンプリングされたリクエストのどこで時間がかかるかを確認できます。

想定される影響

パッシブトレースでも、上流サービスがトレースを開始したリクエストは X-Ray に表示されることがあります。

対処方法

対象ステージに tracing_enabled: true を設定します。リクエストを送り、そのステージでサンプリングされたトレースを X-Ray で確認します。

例

production のタスクは my_api.yml を読み込みます。既存の API を更新する場合は、その API の ID を指定します。例の community.aws.aws_api_gateway は community.aws.api_gateway の別名です。

変更前

yaml
- name: API Gatewayをデプロイ
  community.aws.aws_api_gateway:
    swagger_file: my_api.yml
    stage: production
    cache_enabled: true
    cache_size: "1.6"
    tracing_enabled: false
    endpoint_type: EDGE
    state: present

- name: API Gatewayの変更をデプロイ
  community.aws.aws_api_gateway:
    api_id: "abc123321cba"
    swagger_file: my_api.yml
    deploy_desc: Make auth fix available.
    cache_enabled: true
    cache_size: "1.6"
    endpoint_type: EDGE
    state: present

変更後

yaml
- name: API Gatewayをデプロイ
  community.aws.aws_api_gateway:
    swagger_file: my_api.yml
    stage: production
    cache_enabled: true
    cache_size: "1.6"
    tracing_enabled: true
    endpoint_type: EDGE
    state: present

参考資料