AWS Lambda Function Integration with AWS X-Ray: Performance Optimization Guide

Integrating AWS X-Ray with Non-Instrumented Service Invocation

Prev Question Next Question

Question

A microservice application is developed using AWS Lambda functions which are invoked by non-instrumented service.

For performance optimization, AWS X-Ray needs to be integrated with this AWS Lambda function to get traces with multiple services.

What should a developer do when a non-instrumented service invokes an AWS Lambda function?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Correct Answer - C.

For an AWS Lambda function invoked by a non-instrumented service, the tracing can be enabled from the AWS console or by the following AWS CLI.

$ aws lambda update-function-configuration --tracing-config '{"Mode": "Active"}'

Option A is incorrect as AWS Lambda trace requests without any additional configuration if AWS Lambda function is called by another instrumented service & not for non-instrumented service.

Option B is incorrect as Start Tracing is an invalid option to enable Tracing for Lambda Function invoked by a non-instrumented service.

Option D is incorrect as the AWS Lambda function invoked by non-instrumented services supports tracing by enabling active tracing within a Lambda function.

For more information on AWS X-Ray with Lambda, refer to the following URL-

https://docs.aws.amazon.com/xray/latest/devguide/xray-services-lambda.html

The correct answer is C. Enable Active tracing under AWS Lambda Function configuration.

AWS X-Ray is a service that helps developers analyze and debug distributed applications, including those built using microservices. It provides end-to-end tracing of requests as they travel through the different components of the application, giving developers visibility into performance issues and errors.

To integrate AWS X-Ray with AWS Lambda functions, developers need to enable tracing for the function. There are two types of tracing available: Active tracing and Passive tracing.

Active tracing means that AWS Lambda will automatically create trace segments for incoming requests and send them to X-Ray. This is the recommended approach when integrating with non-instrumented services.

Passive tracing requires the caller to send a trace header along with the request, which AWS Lambda will then use to create trace segments. This approach is suitable when integrating with instrumented services that already generate trace headers.

Option A is incorrect because AWS Lambda does not automatically record traces for non-instrumented services without additional configuration.

Option B is incorrect because starting a trace is not enough to ensure that the trace will be sent to X-Ray. Additional configuration is needed to enable AWS Lambda to send the trace segments to X-Ray.

Option D is incorrect because AWS Lambda functions invoked by non-instrumented services do support tracing, but they require additional configuration to enable tracing.