Question 1 · choose 1
A checkout service sends traces to AWS X-Ray. Support engineers want to find every trace for a given customer ID with a filter expression in the console. They also want the full order object, a nested JSON structure, stored on the trace so that they can read it in the trace details, but they never search by it. How should the developer record these two values?
- AThe customer ID as metadata and the order object as an annotation
- BThe customer ID as an annotation and the order object as metadata
- CBoth values as metadata on the segment
- DBoth values as annotations on the segment
Show the answer and why
AThe customer ID as metadata and the order object as an annotation
Incorrect
Metadata is not indexed, so the customer ID could not be searched, and annotations hold simple values, not nested objects.
BThe customer ID as an annotation and the order object as metadata
Correct
Annotations are simple key-value pairs indexed for filter expressions. Metadata can hold values of any type, including objects, and is stored on the trace without being indexed.
CBoth values as metadata on the segment
Incorrect
Metadata is not indexed for search, so filter expressions could not find traces by customer ID.
DBoth values as annotations on the segment
Incorrect
Annotation values are Booleans, numbers or strings, so the nested order object does not fit, and X-Ray indexes up to 50 annotations per trace.
Annotate what you search by; attach as metadata what you only want to read. With OpenTelemetry, attributes become metadata unless their keys are listed in aws.xray.annotations.
AWS documentation