Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Serverless framework - Enabling X-Ray in serverless.yml

Is there a way to enable X-Ray from the serverless.yml for Lambda functions? I've added the X-Ray permissions in the file:

  iamRoleStatements:
    - Effect: "Allow"
      Resource: "*"
      Action:
        - "xray:*"

But Advanced Tracing still needs to be manually enabled in the AWS console.

like image 522
Bachman Avatar asked Oct 24 '17 14:10

Bachman


People also ask

Is AWS XRAY serverless?

AWS X-Ray is an important component in the AWS serverless stack that enables developers to conduct performance analysis and debug distributed microservice-based applications.

What is the use of serverless yml?

When you deploy a service, all functions, events and resources in serverless. yml are translated to an AWS CloudFormation template and deployed as a single CloudFormation stack. Check out the deployment guide to learn more about deployments and how they work.

Is AWS XRAY SDK included in Lambda?

X-Ray tracing is currently not supported for Lambda functions with Amazon Managed Streaming for Apache Kafka (Amazon MSK), self-managed Apache Kafka, or Amazon MQ with ActiveMQ and RabbitMQ event source mappings.


2 Answers

See the serverless documentation:

https://serverless.com/framework/docs/providers/aws/guide/functions/#aws-x-ray-tracing

service: myService

provider:
  name: aws
  runtime: nodejs8.10
  tracing:
    lambda: true

See also tracing for api gateway: https://serverless.com/framework/docs/providers/aws/events/apigateway/#aws-x-ray-tracing

# serverless.yml

provider:
  name: aws
  tracing:
    apiGateway: true
like image 67
Ulad Kasach Avatar answered Nov 03 '22 02:11

Ulad Kasach


It's in development. If you're unwilling to wait until the official functionality is released, you can install the plugin until it's ready.

like image 41
Trent Bartlem Avatar answered Nov 03 '22 00:11

Trent Bartlem