默认情况下, Agent Server 出于隐私考虑会在服务器日志中省略 HTTP 头。但是,记录请求 ID 和关联 ID 可以帮助您调试问题并追踪跨分布式系统的请求。您可以通过修改配置文件中的部分来选择记录所有 API 调用的请求头 logging_headers 中的部分来选择记录所有 API 调用的请求头。您可以通过修改 langgraph.json file.
{
"$schema": "https://langgra.ph/schema.json",
"http": {
"logging_headers": {
"includes": ["request-id", "x-purchase-id", "*-trace-*"],
"excludes": ["authorization", "x-api-key", "x-organization-id", "x-user-id"]
}
}
}
日志记录包含 includes 和 excludes 列表接受精确的请求头名称或使用 * 作为通配符来匹配任意数量的字符(不区分大小写)。为保护您的安全,不支持其他模式类型。
请注意,排除优先于包含。例如,如果您包含 *-id 但排除 x-user-id,则 x-user-id 请求头将不会被记录。