Skill 4.2.4

Add annotations for tracing services

Key Concepts

With the X-Ray SDK or Powertools Tracer, code adds annotations (strings, numbers or booleans) to a segment or subsegment, such as customer_id or order_type. Annotations are indexed, so you can filter traces with expressions like annotation.customer_id = "123" and use them in trace groups.

Metadata can hold any object, such as full request payloads, but is not indexed or searchable. Each trace supports up to 50 annotations. You can also create custom subsegments around important blocks of code to time them separately.