概要

Amazon API Gateway は、開発者があらゆる規模で API の作成、公開、保守、監視、およびセキュリティ保護を簡単に行えるフルマネージド型サービスです。

このインテグレーションを有効にすると、Datadog にすべての API Gateway メトリクスを表示できます。

セットアップ

インストール

Amazon Web Services インテグレーションをまだセットアップしていない場合は、セットアップします。

メトリクスの収集

  1. AWS インテグレーションページで、Metric Collection タブの下にある API Gateway が有効になっていることを確認します。

  2. API Gateway ステージにカスタムタグを適用するには、次のアクセス許可を Datadog IAM ポリシーに追加します。

    • apigateway:GET
    • tag:GetResources
  3. Datadog - Amazon API Gateway インテグレーションをインストールします。

AWS から取得される各メトリクスには、ホスト名やセキュリティ グループなど、AWS コンソールに表示されるのと同じタグが割り当てられます。

: CloudWatch の詳細メトリクスを有効にしている場合、ステージ内のすべてのリソースまたはルートで有効にする必要があります。無効の場合、Datadog の集計値が不正確になります。

ログ収集

API Gateway ログを有効にするには

  1. AWS コンソールで API Gateway に移動します。

  2. 目的の API を選択し、Stages セクションに移動します。

  3. Logs タブで、Enable CloudWatch LogsEnable Access Logging を有効にします。

  4. INFO レベルを選択して、すべてのリクエストが取得されるようにします。

  5. CloudWatch Group の名前が api-gateway で開始することを確認します。

  6. JSON 形式を選択し (CLF と CSV もサポートされています)、Log format ボックスに以下を追加します。

    {
        "apiId": "$context.apiId",
        "stage": "$context.stage",
        "requestId":"$context.requestId",
        "ip":"$context.identity.sourceIp",
        "caller":"$context.identity.caller",
        "user":"$context.identity.user",
        "requestTime":$context.requestTimeEpoch,
        "httpMethod":"$context.httpMethod",
        "resourcePath":"$context.resourcePath",
        "status":$context.status,
        "protocol":"$context.protocol",
        "responseLength":$context.responseLength
    }
    

ログを Datadog に送信する方法

  1. Datadog ログコレクション AWS Lambda 関数をまだセットアップしていない場合は、セットアップします。
  2. Lambda 関数がインストールされたら、AWS コンソールから手動で API Gateway ログを含む CloudWatch ロググループにトリガーを追加します。 対応する CloudWatch ロググループを選択し、フィルター名を追加して (空にすることも可能)、トリガーを追加します。

完了したら、Logs ページに移動し、ログの検索を開始します。

収集データ

メトリクス

aws.apigateway.4xx
(count)
The number of client-side errors for HTTP APIs
Shown as operation
aws.apigateway.4xxerror
(count)
The number of client-side errors for REST APIs
Shown as operation
aws.apigateway.5xx
(count)
The number of server-side errors for HTTP APIs
Shown as operation
aws.apigateway.5xxerror
(count)
The number of server-side errors for REST APIs
Shown as operation
aws.apigateway.cache_hit_count
(count)
The number of requests served from the API cache
Shown as operation
aws.apigateway.cache_miss_count
(count)
The number of requests served from the back end when API caching is enabled
Shown as operation
aws.apigateway.client_error
(count)
The average number of requests that have a 4XX response returned by API Gateway before the integration is invoked.
Shown as operation
aws.apigateway.client_error.sum
(count)
The total number of requests that have a 4XX response returned by API Gateway before the integration is invoked.
Shown as operation
aws.apigateway.connect_count
(count)
The average number of messages sent to the $connect route integration.
Shown as operation
aws.apigateway.connect_count.sum
(count)
The total number of messages sent to the $connect route integration.
Shown as operation
aws.apigateway.count
(count)
The number call to API methods
Shown as operation
aws.apigateway.execution_error
(count)
Average errors that occurred when calling the integration.
Shown as operation
aws.apigateway.execution_error.sum
(count)
Total errors that occurred when calling the integration.
Shown as operation
aws.apigateway.integration_error
(count)
The average number of requests that return a 4XX/5XX response from the integration.
Shown as operation
aws.apigateway.integration_error.sum
(count)
The total number of requests that return a 4XX/5XX response from the integration.
Shown as operation
aws.apigateway.integration_latency
(gauge)
The time between when API Gateway relays a request to the back end and when it receives a response from the back end.
Shown as millisecond
aws.apigateway.integration_latency.maximum
(gauge)
The maximum time between when API Gateway relays a request to the back end and when it receives a response from the back end.
Shown as millisecond
aws.apigateway.integration_latency.minimum
(gauge)
The minimum time between when API Gateway relays a request to the back end and when it receives a response from the back end.
Shown as millisecond
aws.apigateway.integration_latency.p90
(gauge)
The 90th percentile time between when API Gateway relays a request to the back end and when it receives a response from the back end.
Shown as millisecond
aws.apigateway.integration_latency.p95
(gauge)
The 95th percentile time between when API Gateway relays a request to the back end and when it receives a response from the back end.
Shown as millisecond
aws.apigateway.integration_latency.p99
(gauge)
The 99th percentile time between when API Gateway relays a request to the back end and when it receives a response from the back end.
Shown as millisecond
aws.apigateway.latency
(gauge)
The time between when API Gateway receives a request from a client and when it returns a response to the client. The latency includes the integration_latency and other API Gateway overhead.
Shown as millisecond
aws.apigateway.latency.maximum
(gauge)
The maximum time between when requests are received and when responses returned
Shown as millisecond
aws.apigateway.latency.minimum
(gauge)
The minimum time between when requests are received and when responses returned
Shown as millisecond
aws.apigateway.latency.p50
(gauge)
The 50th percentile time between when requests are received and when responses returned
Shown as millisecond
aws.apigateway.latency.p75
(gauge)
The 75th percentile time between when requests are received and when responses returned
Shown as millisecond
aws.apigateway.latency.p90
(gauge)
The 90th percentile time between when requests are received and when responses returned
Shown as millisecond
aws.apigateway.latency.p95
(gauge)
The 95th percentile time between when requests are received and when responses returned
Shown as millisecond
aws.apigateway.latency.p99
(gauge)
The 99th percentile time between when requests are received and when responses returned
Shown as millisecond
aws.apigateway.message_count
(count)
The average number of messages sent to the WebSocket API, either from or to the client.
Shown as operation
aws.apigateway.message_count.sum
(count)
The total number of messages sent to the WebSocket API, either from or to the client.
Shown as operation

イベント

Amazon API Gateway インテグレーションには、イベントは含まれません。

サービスチェック

Amazon API Gateway インテグレーションには、サービスのチェック機能は含まれません。

トラブルシューティング

ご不明な点は、Datadog のサポートチームまでお問合せください。