Question #780
An application uses AWS X-Ray to analyze performance bottlenecks by capturing trace data. A developer needs to filter traces using application-specific attributes to isolate issues related to specific user interactions. How should the developer configure filter expressions in X-Ray to achieve this?
Include custom attributes as annotations in the segment document.
Add custom attributes as metadata in the segment document.
Define custom attributes as top-level fields in the segment document.
Implement custom attributes through conditional sampling rules.
Explanation
AWS X-Ray allows developers to add custom attributes as annotations or metadata in segment documents.
- Annotations (Option A) are indexed key-value pairs, making them searchable and usable in X-Ray filter expressions. This is the correct approach to filter traces based on application-specific attributes (e.g., user IDs, transaction types).
- Metadata (Option B) is not indexed and cannot be used in filter expressions, so it is unsuitable for this use case.
- Top-level fields (Option C) are predefined in X-Ray segment documents (e.g., name, id, start_time). Custom attributes cannot be added as top-level fields.
- Conditional sampling rules (Option D) control which requests are traced, not how traces are filtered post-capture.
By using annotations, developers can efficiently isolate traces related to specific user interactions using X-Ray's filtering capabilities.
Answer
The correct answer is: A