-
Notifications
You must be signed in to change notification settings - Fork 570
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ai-token-ratelimit 插件配置了限流不生效 #1826
Comments
目前限流依赖厂商返回字段里的tokens usage信息,azure这块的对接遗漏了,已经在这个PR里实现:https://github.com/alibaba/higress/pull/1818/files 已经更新到ai-proxy插件镜像的latest tag,晚些时候这个修复会同步到1.0.0的tag上 |
azure之前是不需要stream_options参数,默认会返回usage信息的,应该是后来 api 更新了。可以先更新下 ai-proxy 插件镜像,验证下问题是否得到修复 |
试了下没效果?我在 wasmplugin 配置里更新了 url 地址: |
2025-02-27T02:36:41.309061Z debug envoy wasm external/envoy/source/extensions/common/wasm/context.cc:1392 wasm log higress-system.ai-token-ratelimit: [ai-token-ratelimit] [81a65718-35a0-4472-a7f3-6b07a56ad0da] failed to get request header Authorization: error status returned by host: not found thread=45 我看到这个报错了,这个是请求没有加 Authorization 请求头吧 |
这个只是验证哈,因为没太多日志去 debug,我故意去掉 Authorization header 的情况下,token-ratelimit plugin 会打印日志,侧面证明了它是在工作的。但是目前问题还是带上 Authorization header 的情况下,实际不会去记数,我登陆 redis-cli 看了下 |
@Colstuwjx 我刚打了最新的 ai-proxy 的镜像, 你可以把 ai-proxy 改成 |
本来就是这个版本的,我重启 higress-gateway 会重新拉取最新版本的 plugin 吗?还是说 ai-proxy 配置也要一起删除重建 |
随便修改一下ai-proxy的配置并保存就可以更新了 |
试了下,好像还是不起作用, ai-token-ratelimit 插件还是没跑通功能,另:ai-quota 插件的功能本地没跑通,云上 redis + mcpbridge 倒是测通了 😂 |
确定连上redis了吗,可以进容器执行 curl localhost:15000/logging?wasm=debug -X POST 连上redis可以看到所有向redis发送的RESP指令 |
试了下
但是 ratelimit 好像完全没请求的样子,gateway 里也没找到相关日志,但是是有配置的:
|
If you are reporting any crash or any potential security issue, do not
open an issue in this repo. Please report the issue via ASRC(Alibaba Security Response Center) where the issue will be triaged appropriately.
Ⅰ. Issue Description
参考 文档 配置了一个 ratelimit 限流,但是实际去请求时并没有实现每分钟 token 级别的限流效果。
Ⅱ. Describe what happened
在 default namespace 下安装了 redis:
在 mcp 配置了 redis dns 和 azure openai endpoint dns:
同时在 ingress 里配置了 redis:
wasm plugin:
业务服务的 ingress (wasmplugin 太多了,就不贴了):
本地请求时发现并没有实现限流效果:
如果不带
Authorization
header 请求的话,ratelimit plugin 会打印一条 header not found 日志,证明实际有正常运行,但是没起到限流作用:Ⅲ. Describe what you expected to happen
希望能如文档描述的那样,请求达到 token 限制时 response 返回 429,未达到限制时
x-ratelimit-remaining-tokens
可以体现剩余 token 数量,方便后续跟踪定位问题Ⅳ. How to reproduce it (as minimally and precisely as possible)
以上
Ⅴ. Anything else we need to know?
Ⅵ. Environment:
The text was updated successfully, but these errors were encountered: