Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rafalwilinski/aws-xray-ts-decorator
Instrument your Typescript code with AWS X-Ray using elegant decorators
https://github.com/rafalwilinski/aws-xray-ts-decorator
amazon-web-services aws aws-xray cloud instrumentation javascript observability tracing ts typescript typescript-decorators typescript-library
Last synced: 3 months ago
JSON representation
Instrument your Typescript code with AWS X-Ray using elegant decorators
- Host: GitHub
- URL: https://github.com/rafalwilinski/aws-xray-ts-decorator
- Owner: RafalWilinski
- License: mit
- Created: 2019-12-04T10:20:44.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-05T16:22:06.000Z (about 2 years ago)
- Last Synced: 2024-10-04T13:20:55.373Z (4 months ago)
- Topics: amazon-web-services, aws, aws-xray, cloud, instrumentation, javascript, observability, tracing, ts, typescript, typescript-decorators, typescript-library
- Language: TypeScript
- Homepage: https://rwilinski.me
- Size: 789 KB
- Stars: 20
- Watchers: 4
- Forks: 1
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# 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.
## Install
```sh
yarn add aws-xray-ts-decorator
```or with NPM
```sh
npm install aws-xray-ts-decorator --save
```## Usage
```java
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 {
...
}
}
```This snippet will start a subsegment `customSegmentName` before `someAsyncMethod` gets invoked and close it as soon as it resolves.
For more details, see [example](https://github.com/RafalWilinski/aws-xray-ts-decorator/blob/master/examples/index.ts).
## Author
👤 **Rafal Wilinski <[email protected]>**
- Twitter: [@rafalwilinski](https://twitter.com/rafalwilinski)
- Github: [@RafalWilinski](https://github.com/RafalWilinski)## 🤝 Contributing
Contributions, issues and feature requests are welcome!
Feel free to check [issues page](https://github.com/RafalWilinski/aws-xray-ts-decorator/issues).## Show your support
Give a ⭐️ if this project helped you!
## 📝 License
Copyright © 2019 [Rafal Wilinski <[email protected]>](https://github.com/RafalWilinski).
This project is [MIT](https://github.com/RafalWilinski/aws-xray-ts-decorator/blob/master/LICENSE) licensed.