chore(metrics): 补提交 RID contextvar(2.9.0 的 token 侧信道依赖它)
上一个提交漏了本文件:main.py 的 RID.set(rid) 与 calllog.note_tokens 都依赖 app/metrics.py 里新加的 RID ContextVar,不同步提交会导致仓库检出后无法启动。
This commit is contained in:
1 parent
3999c075ae
commit
c88a72ab8e
1 file changed
+2
@@ -20,6 +20,8 @@ log = logging.getLogger("api-gateway.metrics")
|
|||||||
# 普通账号只看自己名下(会话 + 自己的 API Key)产生的记录,admin 看全部。
|
# 普通账号只看自己名下(会话 + 自己的 API Key)产生的记录,admin 看全部。
|
||||||
ACCOUNT: ContextVar[str] = ContextVar("gw_account", default="anonymous")
|
ACCOUNT: ContextVar[str] = ContextVar("gw_account", default="anonymous")
|
||||||
ROLE: ContextVar[str] = ContextVar("gw_role", default="member")
|
ROLE: ContextVar[str] = ContextVar("gw_role", default="member")
|
||||||
|
# 2026-10-23 调用日志落地:请求级 rid 上下文,供 token 记账关联到具体那条日志
|
||||||
|
RID: ContextVar[str] = ContextVar("gw_rid", default="")
|
||||||
|
|
||||||
# M4: 按 rid 暂存请求体摘要(由 main.py 中间件写入)。AccessLog.add() 用它给每条日志
|
# M4: 按 rid 暂存请求体摘要(由 main.py 中间件写入)。AccessLog.add() 用它给每条日志
|
||||||
# 附上「具体请求内容」,便于在日志页查看实际发了什么。有界缓存,防无界增长。
|
# 附上「具体请求内容」,便于在日志页查看实际发了什么。有界缓存,防无界增长。
|
||||||
|
|||||||
Reference in new issue
Block a user