Amazon Api Gateway

Información general

Amazon API Gateway es un servicio totalmente gestionado que facilita a los desarrolladores la creación, la publicación, el mantenimiento, la monitorización y la protección de API a cualquier escala.

Habilita esta integración para ver todas tus métricas de API Gateway en Datadog.

Configuración

Instalación

Si aún no lo has hecho, configura la integración de Amazon Web Services.

Recopilación de métricas

  1. En la página Integración de AWS, asegúrate de que API Gateway está activada en la pestaña Metric Collection.

  2. Añade los siguientes permisos a tu política de IAM de Datadog para que se apliquen etiquetas personalizadas a las etapas de API Gateway:

    • apigateway:GET
    • tag:GetResources
  3. Instala la integración Datadog - Amazon API Gateway.

A cada una de las métricas recuperadas de AWS se le asignan las mismas etiquetas (tags) que aparecen en la consola de AWS, donde se incluyen el nombre del host y los grupos de seguridad, entre otras cosas.

Nota: Si has activado las métricas CloudWatch detalladas, debes activarlas para todos los recursos y las rutas que componen una Stage. De lo contrario, los valores agregados en Datadog no serán correctos.

Recopilación de logs

Para activar el registro de API Gateway:

  1. Abre API Gateway en tu consola AWS.

  2. Selecciona la API que quieras y ve a la sección Stages (Etapas).

  3. En la pestaña Logs (Registros), activa Enable CloudWatch Logs (Activar logs CloudWatch) y Enable Access Logging (Activar registro de acceso).

  4. Selecciona el nivel INFO para garantizar que abarcas todas las solicitudes.

  5. Asegúrate de que el nombre del grupo CloudWatch comienza con api-gateway.

  6. Selecciona el formato JSON (CLF y CSV también son compatibles) y añade lo siguiente en la casilla Log format (Formato del log):

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

Enviar logs a Datadog

  1. Si aún no lo ha hecho, configura la función AWS Lambda de recopilación de logs de Datadog.
  2. Una vez instalada la función de Lambda, añade manualmente un activador en el grupo de log de CloudWatch que contiene tus logs de API Gateway en la consola de AWS. Selecciona el grupo de logs CloudWatch correspondiente, ponle un nombre al filtro (y deja el filtro vacío si quieres) y añade el desencadenador.

Una vez completado, navega hasta la página Logs para empezar a explorar tus logs.

Datos recopilados

Métricas

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

Eventos

La integración de Amazon API Gateway no incluye ningún evento.

Checks de servicios

La integración de Amazon API Gateway no incluye ningún check de servicio.

Solucionar problemas

¿Necesitas ayuda? Ponte en contacto con el servicio de asistencia de Datadog.