-
Notifications
You must be signed in to change notification settings - Fork 156
Docs: Tracer examples for addMetadata
and addAnnotation
don't work
#1699
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
<!--- Instructions: 1. Make sure you follow our Contributing Guidelines: https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/CONTRIBUTING.md 2. Please follow the template, and do not remove any section/item. If something is not applicable leave it empty, but leave it in the PR. 3. --> ## Description of your changes <!--- Include here a summary of the change. Please include also relevant motivation and context. Add any applicable code snippets, links, screenshots, or other resources that can help us verify your changes. --> This PR introduces changes to the code snippets found in the Tracer documentation and related to adding annotations and metadata to a segment. The original snippets were mistakenly not handling the opening and closing of a custom subsegment and were instead suggesting to attempt annotating the `facade` segment. This is a mistake because that segment is managed by the service and cannot be modified, resulting in an error. The PR fixes this and shows the full code snippet. ### Related issues, RFCs <!--- Add here the number (i.e. #42) to the Github Issue or RFC that is related to this PR. Don't include any other text, otherwise the Github Issue will not be detected. Note: If no issue is present the PR might get blocked and not be reviewed. --> **Issue number:** #1699 ## Checklist - [x] [My changes meet the tenets criteria](https://docs.powertools.aws.dev/lambda-typescript/#tenets) - [x] I have performed a *self-review* of my own code - [x] I have *commented* my code where necessary, particularly in areas that should be flagged with a TODO, or hard-to-understand areas - [x] I have made corresponding changes to the *documentation* - [x] My changes generate *no new warnings* - [ ] I have *added tests* that prove my change is effective and works - [x] The PR title follows the [conventional commit semantics](https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/.github/semantic.yml#L2) ### Breaking change checklist ***Is it a breaking change?:*** NO - [ ] I have documented the migration process - [ ] I have added, implemented necessary warnings (if it can live side by side) --- By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice. **Disclaimer**: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.
Hi @perpil thanks for reporting this, I'm working on a PR to make some changes to these sections and address your issue. |
|
This is now released under v1.13.1 version! |
Uh oh!
There was an error while loading. Please reload this page.
What were you searching in the docs?
I was trying to add my own metadata to the xray traces.
Is this related to an existing documentation section?
https://docs.powertools.aws.dev/lambda/typescript/latest/core/tracer/#annotations-metadata
How can we improve?
These examples don't actually work, the result in errors like this:
You cannot add metadata to the main segment in a Lambda execution environment
You cannot annotate the main segment in a Lambda execution environment
Either document that you need to start new segment before you can use
addMetadata
andaddAnnotation
with an admonition or wrap these examples with code to start a new segment, switch to it,addMetadata
/addAnnotation
close the segment and switch back.Got a suggestion in mind?
No response
Acknowledgment
The text was updated successfully, but these errors were encountered: