Socket
Socket
Sign inDemoInstall

aws-xray-ts-decorator

Package Overview
Dependencies
47
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    aws-xray-ts-decorator

Instrument your Promises with AWS X-Ray in Typescript with elegant decorators


Version published
Weekly downloads
138
decreased by-28.12%
Maintainers
1
Install size
72.5 MB
Created
Weekly downloads
 

Readme

Source

AWS X-Ray Typescript Decorator

Tired of using AWSXRay.captureAsyncFunc and/or AWSXRay.capturePromise polluting the body of your methods? Instrument your class async methods and Promises with this simple yet elegant decorator.

License: MIT Twitter: rafalwilinski

Install

yarn add aws-xray-ts-decorator

or with NPM

npm install aws-xray-ts-decorator --save

Usage

class MyTestClass {
  // All of these arguments are optional
  @XRayInstrumented({
    segmentName: "customSegmentName", // by default it's name of called function
    metadata: { // Add custom metadata as StringMap
      memberId: "1"
    },
    annotations: { // Add custom annotations as StringMap
      context: "this is important!"
    },
    forceCreateSegment: true, // Creates new AWSXRay.Segment if such is not created yet
    addParamsMetadata: true // Adds function parameters as metadata of subsegment
  })
  someAsyncMethod(input: number): Promise<any> {
    ...
  }
}

This snippet will start a subsegment customSegmentName before someAsyncMethod gets invoked and close it as soon as it resolves.

For more details, see example.

Author

👤 Rafal Wilinski <raf.wilinski@gmail.com>

🤝 Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!

📝 License

Copyright © 2019 Rafal Wilinski <raf.wilinski@gmail.com>.
This project is MIT licensed.

Keywords

FAQs

Last updated on 10 Dec 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc