mirror of
https://github.com/alibaba/higress.git
synced 2026-05-27 06:07:27 +08:00
fix(ai-statistics): add ValueSource to built-in attributes for streaming body buffering (#3491)
This commit is contained in:
@@ -430,6 +430,26 @@ func parseConfig(configJson gjson.Result, config *AIStatisticsConfig) error {
|
|||||||
config.valueLengthLimit = 10485760 // 10MB
|
config.valueLengthLimit = 10485760 // 10MB
|
||||||
}
|
}
|
||||||
log.Infof("Using default attributes configuration")
|
log.Infof("Using default attributes configuration")
|
||||||
|
// Check if any default attribute needs streaming body buffering
|
||||||
|
for _, attribute := range config.attributes {
|
||||||
|
if attribute.ValueSource == ResponseStreamingBody {
|
||||||
|
config.shouldBufferStreamingBody = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
// For built-in attributes without explicit ValueSource, check default sources
|
||||||
|
if attribute.ValueSource == "" && isBuiltinAttribute(attribute.Key) {
|
||||||
|
defaultSources := getBuiltinAttributeDefaultSources(attribute.Key)
|
||||||
|
for _, src := range defaultSources {
|
||||||
|
if src == ResponseStreamingBody {
|
||||||
|
config.shouldBufferStreamingBody = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if config.shouldBufferStreamingBody {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
config.attributes = make([]Attribute, len(attributeConfigs))
|
config.attributes = make([]Attribute, len(attributeConfigs))
|
||||||
for i, attributeConfig := range attributeConfigs {
|
for i, attributeConfig := range attributeConfigs {
|
||||||
|
|||||||
Reference in New Issue
Block a user