mirror of
https://github.com/alibaba/higress.git
synced 2026-04-21 12:07:26 +08:00
fix(ai-statistics): adjust requestBodyBufferLimit (#2192)
Co-authored-by: Kent Dong <ch3cho@qq.com>
This commit is contained in:
@@ -27,6 +27,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
defaultMaxBodyBytes uint32 = 100 * 1024 * 1024
|
||||||
// Context consts
|
// Context consts
|
||||||
StatisticsRequestStartTime = "ai-statistics-request-start-time"
|
StatisticsRequestStartTime = "ai-statistics-request-start-time"
|
||||||
StatisticsFirstTokenTime = "ai-statistics-first-token-time"
|
StatisticsFirstTokenTime = "ai-statistics-first-token-time"
|
||||||
@@ -176,6 +177,11 @@ func onHttpRequestHeaders(ctx wrapper.HttpContext, config AIStatisticsConfig, lo
|
|||||||
if consumer, _ := proxywasm.GetHttpRequestHeader(ConsumerKey); consumer != "" {
|
if consumer, _ := proxywasm.GetHttpRequestHeader(ConsumerKey); consumer != "" {
|
||||||
ctx.SetContext(ConsumerKey, consumer)
|
ctx.SetContext(ConsumerKey, consumer)
|
||||||
}
|
}
|
||||||
|
hasRequestBody := wrapper.HasRequestBody()
|
||||||
|
if hasRequestBody {
|
||||||
|
_ = proxywasm.RemoveHttpRequestHeader("Content-Length")
|
||||||
|
ctx.SetRequestBodyBufferLimit(defaultMaxBodyBytes)
|
||||||
|
}
|
||||||
|
|
||||||
// Set user defined log & span attributes which type is fixed_value
|
// Set user defined log & span attributes which type is fixed_value
|
||||||
setAttributeBySource(ctx, config, FixedValue, nil, log)
|
setAttributeBySource(ctx, config, FixedValue, nil, log)
|
||||||
|
|||||||
Reference in New Issue
Block a user