Skip to content

Docs: Tracer examples for addMetadata and addAnnotation don't work #1699

Closed
@perpil

Description

@perpil

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 and addAnnotation 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

  • I understand the final update might be different from my proposed suggestion, or refused.

Metadata

Metadata

Assignees

Labels

completedThis item is complete and has been merged/shippeddocumentationImprovements or additions to documentation

Type

No type

Projects

Status

Shipped

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions