Amazon API Gateway

개요

Amazon API Gateway는 개발자가 규모에 관계없이 API를 쉽게 생성, 게시, 유지 관리, 모니터링 및 보호할 수 있는 완전 관리형 서비스입니다.

이 통합을 활성화하여 Datadog에서 모든 API Gateway 메트릭을 확인할 수 있습니다.

설정

설치

이미 하지 않은 경우 Amazon Web Services 통합을 설정합니다.

메트릭 수집

  1. AWS 통합 페이지에서 API GatewayMetric Collection 탭에서 활성화되어 있는지 확인하세요.

  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도 지원됨)을 선택하고 다음을 로그 형식 상자에 추가하세요.

    {
        "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. 람다 함수가 설치되면 AWS 콘솔에서 API Gateway 로그를 포함하는 클라우드와치(CloudWatch) 로그 그룹에 대해 수동으로 트리거를 추가합니다. 해당 CloudWatch Log 그룹을 선택하고 필터 이름을 추가한 다음(필터는 비워두어도 됨) 트리거를 추가합니다.

완료되면 로그 페이지]6로 이동하여 로그 탐색을 시작하세요.

수집한 데이터

메트릭

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 지원팀에 문의하세요.

PREVIEWING: rtrieu/product-analytics-ui-changes