无服务器框架 - 在 serverless.yml 中启用 X-Ray

Serverless framework - Enabling X-Ray in serverless.yml

有没有办法从 serverless.yml 为 Lambda 函数启用 X-Ray? 我在文件中添加了 X-Ray 权限:

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

但是Advanced Tracing还是需要在AWS控制台手动启用。

in development. If you're unwilling to wait until the official functionality is released, you can install the plugin 准备就绪。

查看无服务器文档:

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

service: myService

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

另请参阅跟踪 api 网关:https://serverless.com/framework/docs/providers/aws/events/apigateway/#aws-x-ray-tracing

# serverless.yml

provider:
  name: aws
  tracing:
    apiGateway: true