이 단원에서는 Amazon API Gateway API에 대한 AWS X-Ray 추적 세그먼트, 하위 세그먼트 및 기타 추적 필드에 대해 설명합니다.
이 단원을 읽기 전에 X-Ray 개발자 안내서의 다음 주제를 검토하십시오.
API Gateway API에 대한 추적 객체의 예
이 단원에서는 API Gateway API에 대한 추적에서 볼 수 있는 몇 가지 객체에 대해 설명합니다.
주석
주석이 세그먼트와 하위 세그먼트에 표시될 수 있습니다. 주석은 트레이스를 필터링하는 샘플링 규칙에서 필터링 표현식으로 사용됩니다. 자세한 내용은 샘플링 규칙 구성을 참조하세요.
다음은 annotations
객체의 예입니다. 여기서 API 단계는 API ID와 API 단계 이름으로 식별됩니다.
"annotations": { "aws:api_id": "a1b2c3d4e5", "aws:api_stage": "dev" }
주석에 대한 자세한 내용은 X-Ray 세그먼트 문서에서 X-Ray 세그먼트 문서, 주석을 선택하세요.
AWS 리소스 데이터
aws
객체는 세그먼트에만 나타납니다. 다음은 기본 샘플링 규칙과 일치하는 aws
객체의 예입니다. 샘플링 규칙에 대한 심층적 설명은 샘플링 규칙 구성을 참조하세요.
"aws": { "xray": { "sampling_rule_name": "Default" }, "api_gateway": { "account_id": "123412341234", "rest_api_id": "a1b2c3d4e5", "stage": "dev", "request_id": "a1b2c3d4-a1b2-a1b2-a1b2-a1b2c3d4e5f6" } }
aws
객체에 대한 자세한 내용은 X-Ray 세그먼트 문서에서 X-Ray 세그먼트 문서, AWS 리소스 데이터를 선택하세요.
트레이스 이해
다음은 API Gateway 단계에 대한 추적 세그먼트입니다. 추적 세그먼트를 구성하는 필드에 대한 자세한 설명은 X-Ray 세그먼트 문서를 참조하세요.
{
"Document": {
"id": "a1b2c3d4a1b2c3d4",
"name": "testxray/dev",
"start_time": 1533928226.229,
"end_time": 1533928226.614,
"metadata": {
"default": {
"extended_request_id": "abcde12345abcde=",
"request_id": "a1b2c3d4-a1b2-a1b2-a1b2-a1b2c3d4e5f6"
}
},
"http": {
"request": {
"url": "https://example.com/dev?username=demo&message=hellofromdemo/",
"method": "GET",
"client_ip": "192.0.2.0",
"x_forwarded_for": true
},
"response": {
"status": 200,
"content_length": 0
}
},
"aws": {
"xray": {
"sampling_rule_name": "Default"
},
"api_gateway": {
"account_id": "123412341234",
"rest_api_id": "a1b2c3d4e5",
"stage": "dev",
"request_id": "a1b2c3d4-a1b2-a1b2-a1b2-a1b2c3d4e5f6"
}
},
"annotations": {
"aws:api_id": "a1b2c3d4e5",
"aws:api_stage": "dev"
},
"trace_id": "1-a1b2c3d4-a1b2c3d4a1b2c3d4a1b2c3d4",
"origin": "AWS::ApiGateway::Stage",
"resource_arn": "arn:aws:apigateway:us-east-1::/restapis/a1b2c3d4e5/stages/dev",
"subsegments": [
{
"id": "abcdefgh12345678",
"name": "Lambda",
"start_time": 1533928226.233,
"end_time": 1533928226.6130002,
"http": {
"request": {
"url": "https://example.com/2015-03-31/functions/arn:aws:lambda:us-east-1:123412341234:function:xray123/invocations",
"method": "GET"
},
"response": {
"status": 200,
"content_length": 62
}
},
"aws": {
"function_name": "xray123",
"region": "us-east-1",
"operation": "Invoke",
"resource_names": [
"xray123"
]
},
"namespace": "aws"
}
]
},
"Id": "a1b2c3d4a1b2c3d4"
}