Serverless framework - Enabling X-Ray in serverless.yml

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

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.