Amazon Api Gateway

This page is not yet available in Spanish. We are working on its translation.
If you have any questions or feedback about our current translation project, feel free to reach out to us!

Overview

Amazon API Gateway is a fully managed service that makes it easy for developers to create, publish, maintain, monitor, and secure APIs at any scale.

Enable this integration to see all of your API Gateway metrics in Datadog.

Setup

Installation

If you haven’t already, set up the Amazon Web Services integration.

Metric collection

  1. On the AWS integration page, ensure that API Gateway is enabled under the Metric Collection tab.

  2. Add the following permissions to your Datadog IAM policy in order to get custom tags applied to API Gateway Stages:

    • apigateway:GET
    • tag:GetResources
  3. Install the Datadog - Amazon API Gateway integration.

Each of the metrics retrieved from AWS are assigned the same tags that appear in the AWS console, including but not limited to host name, security-groups, and more.

Note: If you’ve enabled detailed CloudWatch metrics, you must enable them for all Resources or Routes within a Stage. Otherwise, aggregate values in Datadog will be incorrect.

Log collection

To enable API Gateway logging:

  1. Go to API Gateway in your AWS console.

  2. Select the wanted API and go to the Stages section.

  3. In the Logs tab, enable Enable CloudWatch Logs and Enable Access Logging.

  4. Select the INFO level to make sure you have all the requests.

  5. Make sure your CloudWatch Group name starts with api-gateway.

  6. Select the JSON format (CLF and CSV are also supported) and add the following in the Log format box:

    {
        "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
    }
    

Send logs to Datadog

  1. If you haven’t already, set up the Datadog log collection AWS Lambda function.
  2. Once the Lambda function is installed, manually add a trigger on the CloudWatch Log group that contains your API Gateway logs in the AWS console. Select the corresponding CloudWatch Log group, add a filter name (but feel free to leave the filter empty) and add the trigger.

Once completed, navigate to the Logs page to start exploring your logs!

Data Collected

Metrics

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

Events

The Amazon API Gateway integration does not include any events.

Service Checks

The Amazon API Gateway integration does not include any service checks.

Troubleshooting

Need help? Contact Datadog support.

PREVIEWING: rtrieu/product-analytics-ui-changes