

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# Amazon Bedrock 和 AgentCore Amazon X-Ray
Amazon Bedrock AgentCore

Amazon Bedrock Amazon X-Ray 与 AgentCore 集成，为您的 AI 代理和工具提供分布式跟踪功能。这种集成允许您在请求流经代理应用程序时对其进行跟踪，从而帮助您识别性能瓶颈并解决问题。

AgentCore 通过 X-Ray 集成支持分布式跟踪，允许您监控 AI 代理和工具的性能。当您为 AgentCore 资源启用可观察性时，您可以跨服务边界传播跟踪上下文，并了解您的代理与其他 Amazon 服务的交互方式。有关更多信息，请参阅 [Amazon Bedrock AgentCore](https://docs.amazonaws.cn//bedrock-agentcore/latest/devguide/what-is-genesis.html)。

AgentCore 支持以下 X-Ray 功能：
+ 将跟踪上下文传播到下游服务
+ 使用 Amazon Distro for OpenTelemetry (ADOT) SDK 进行自定义插入

## 设置 X-Ray AgentCore
Amazon S3

要将 X-Ray 与配合使用 AgentCore，您需要在 Amazon 账户中启用 “ CloudWatch 交易搜索”。这是一次性设置， AgentCore 允许向 X-Ray 发送跟踪数据。有关更多信息，请参阅[启用交易搜索](https://docs.amazonaws.cn/AmazonCloudWatch/latest/monitoring/CloudWatch-Transaction-Search.html)。

有关为设置可观察性的更多信息 AgentCore，请参阅为您的 [Amazon Bedrock AgentCore 代理或工具添加可观察性](https://docs.amazonaws.cn/bedrock-agentcore/latest/devguide/observability-configure.html)。

## 将跟踪标头与 AgentCore
Amazon S3

AgentCore 支持用于分布式跟踪的 X-Ray 跟踪标头格式。您可以在请求中包含`X-Amzn-Trace-Id`标头， AgentCore 以维护跨服务边界的跟踪上下文。