Giter VIP home page Giter VIP logo

serverless-plugin-xray's Introduction

serverless-plugin-xray

A maintained fork of outdated serverless-plugin-tracing.

npm version Coverage Status Github Checks

Enables AWS X-Ray (https://aws.amazon.com/xray/) for the entire Serverless stack or individual functions.

Update: as of 2.0.0, the plugin uses Cloud Formation to update TracingConfig and no longer makes additional AWS SDK calls. No change to YAML contract: stays same as in 1.x. Tested with [email protected].

Note: this plugin is currently Beta.

Note: 1.x was tested to work well with [email protected]. Some older versions of serverless may not work due to outdated Javascript SDK that does not support TracingConfig.

npm install --save-dev serverless-plugin-xray

Example serverless.yml:

service: my-great-service

provider:
  name: aws
  stage: test
  iamRoleStatements:
    - Effect: "Allow" # xray permissions (required)
      Action:
        - "xray:PutTraceSegments"
        - "xray:PutTelemetryRecords"
      Resource:
        - "*"

plugins:
  - serverless-plugin-xray

custom:
  serverless-plugin-xray:
    tracing: true # enable tracing

functions:
  mainFunction: # inherits tracing settings from "provider"
    handler: src/app/index.handler
  healthCheckFunction:
    tracing: false # overrides provider settings (opt out)

Output after serverless deploy:

Serverless: Tracing ENABLED for function
  "my-great-service-test-mainFunction"
Serverless: Tracing DISABLED for function
  "my-great-service-test-healthcheck"

Important: in addition to using the plugin, you need to enable capturing traces in the code as well:

const awsXRay = require('aws-xray-sdk');
const awsSdk = awsXRay.captureAWS(require('aws-sdk'));

The plugin only controls the checkbox that be viewed in AWS Console: go to AWS Lambda -> select a Lambda function -> Configuration tab -> Advanced settings -> "Enable active tracing". If tracing ends up being true for a function, the checkbox will be checked for that function.

serverless-plugin-xray's People

Contributors

alex-murashkin avatar alexanderms avatar and3rson avatar joeyvandijk avatar olecom avatar dougmoscrop avatar

Stargazers

ellen avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.