fix(ai-statistics): add ValueSource to built-in attributes for streaming body buffering (#3491)

This commit is contained in:
澄潭
2026-02-13 09:03:06 +08:00
committed by GitHub
parent 927fb52309
commit c2be0e8c9a

View File

@@ -430,6 +430,26 @@ func parseConfig(configJson gjson.Result, config *AIStatisticsConfig) error {
config.valueLengthLimit = 10485760 // 10MB
}
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 {
config.attributes = make([]Attribute, len(attributeConfigs))
for i, attributeConfig := range attributeConfigs {