Default annotations and metadata for captureAWS()
- Dominant language
- JavaScript
- Stars
- 280
- Forks
- 157
- PR merge metrics
- No merged PRs in 30d
Description
Typically we use `captureAWS(require('aws-sdk'))` to patch all aws sdk calls and get xray traces with subsegments for all sdk calls. There are cases where one would want to add default annotations and/or metadata to all these traces but I do not see a way to achieve this.
For example, in our organisation we use separate cloudformation stacks to have isolated development environments within the same aws account. However, in the xray console we cannot restrict by cloudformation stack so it would help if all traces had a default annotation/metadata with the cloudformation stack name (and other details). This would then allow us to filter traces from the xray console using something like `annotations.environment = "envABC"`
I went through the code and it seems quite doable to change `captureAWS(awssdk)` to something like: `captureAWS(awssdk, defaultAnnotations = {}, defaultMetadata = {})`
This would then be called as follows:
```
let AWS = captureAWS(require('aws-sdk'),
{environment: 'envABC', author: 'xyz'},
{description: 'something'}
);
```
What do you think? Any better way to do this?
Contributor guide
Research direction
Start at the captureAWS entry point and review how annotations and metadata are currently applied to X-Ray traces and subsegments. Add a way to provide defaults for both when wrapping the AWS SDK, then verify that those values appear on all relevant traces and that existing captureAWS usage remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, javascript, node.js
- Domain
- observability
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100