feat: add ratelimit metrics in the ai-token-ratelimit plugin (#1918)

This commit is contained in:
小小hao
2025-03-19 21:51:56 +08:00
committed by GitHub
parent eef8adf42f
commit 6742df57df
2 changed files with 51 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ import (
"strings"
"github.com/alibaba/higress/plugins/wasm-go/pkg/wrapper"
"github.com/higress-group/proxy-wasm-go-sdk/proxywasm"
"github.com/tidwall/gjson"
re "github.com/wasilibs/go-re2"
"github.com/zmap/go-iptree/iptree"
@@ -59,6 +60,7 @@ type ClusterKeyRateLimitConfig struct {
rejectedCode uint32 // 当请求超过阈值被拒绝时,返回的HTTP状态码
rejectedMsg string // 当请求超过阈值被拒绝时,返回的响应体
redisClient wrapper.RedisClient
counterMetrics map[string]proxywasm.MetricCounter // Metrics
}
type LimitRuleItem struct {