- 06 Jan 2023
- 2 Minutes to read
- Updated on 06 Jan 2023
- 2 Minutes to read
If you are using Node.js lambdas in your application, Traceable provides a tracing agent for you. Configuring Traceable for your application using Node.js lambda consists of deploying a lambda, adding the Traceable Node.js, and Traceable collector layers. The final step is to configure the Traceable Node.js and Traceable collector layers. A high-level deployment architecture for Traceable's Node.js lambda is shown in the following diagram.
The deployment at a high-level divided into three parts:
- Deploy a lambda
- Add the Traceable node and Traceable collector layers
- Configure Traceable node and Traceable collector layers
Before you begin
Make a note of the following points before you begin installation and configuration:
- Make sure that you have installed and configured Traceable Platform agent. For more information, see Platform agent.
- Make sure that the port number 4318 is available to the lambda function.
- Make a note of the Traceable Platform agent IP address. It will be used in step 3 during configuration of layers.
- Make sure that you have an AWS account.
Step 1 – Deploy a lambda
To deploy a lambda, make sure to first find or create a lambda for Node.js 10.x, 12.x or 14.x lambda. The lambda must have an API gateway as the frontend.
The lambda must be using x86_64 architecture. Arm64 is currently not supported.
Step 2 – Add the layers
As part of adding layers, you need to add two layers to the Lambda.
- Layer 1 –
traceableai-nodejs- This layer works for any version of Node.js supported in Lambda 10.x, 12.x, and 14.x.
- Layer 2 –
Layer Latest Layer Version Node.js 8 Collector 5
In Lambda UI, when you add a layer, select Specify an ARN as shown below:
For detailed steps to add a layer, see Add the layers.
In the Specify an ARN section, use the following ARNs:
- Node.js ARN – Select the ARN based on the region:
- Collector ARN – Select the ARN based on the region:
<aws-region> with the region your lambda is in, for example, us-east-1
Before proceeding to configuring layers, make sure that Lambda has the following:
Step 3 – Configure the layers
As part of configuring layers, you would have to configure Node.js and Collector layers.
Configure collector layer
To configure the collector layer, configure the Traceable Platform agent endpoint by configuring
TPA_ENDPOINT environment variable.
TPA_ENDPOINT: http://<insert_your_tpa_ip>:4318as an environment variable;
tpais the Traceable Platform agent IP address that you made a note of in the Before you begin section.
- Make sure that the port number is 4318. This is important to connect to the Traceable Platform agent OTLP HTTP endpoint.
Configure Node.js layer
To configure Node.js layers, set
AWS_LAMBDA_EXEC_WRAPPER: /opt/traceableai-instrument environment variable on the lambda. This instructs the lambda to invoke Traceable's wrapper script instead of the default lambda handler. Traceable in turn invokes your original handler.
To verify a successful configuration of python lambda, invoke the lambda function by sending traffic through the API gateway endpoint. Login to Traceable platform and check whether the service and associated traces and spans are displayed.
Following are a few troubleshooting tips for the python lambda deployment:
|No data is reported||Set the |
|The response body is not captured||Check if the lambda returns a “Content-Type” header, that is set to a value including: |
|The request body is not captured||Check if the incoming request is sending a “Content-Type” header, that is set to a value including: |
|The status code is not reported||Check whether the lambda returns a |
If not, then update the lambda to return a