Skip to content

Commit 8b661df

Browse files
authored
feat: enable use_default_attributes for ai-statistics plugin in config template (#228)
Update ai-statistics WasmPlugin configuration in AI Gateway config template to use use_default_attributes by default. Changes: - Set defaultConfigDisable to false to enable plugin globally - Add defaultConfig with use_default_attributes: true - Remove matchRules completely - plugin now applies globally - Remove generated matchRules loop for all ingresses This makes AI Gateway easier to configure out-of-the-box with sensible defaults for LLM observability that apply to all AI routes automatically.
1 parent 0ec0203 commit 8b661df

1 file changed

Lines changed: 3 additions & 25 deletions

File tree

all-in-one/scripts/config-template/ai-gateway.sh

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -137,29 +137,6 @@ spec:
137137
priority: 100
138138
url: oci://higress-registry.cn-hangzhou.cr.aliyuncs.com/plugins/ai-proxy:2.0.0" >"$WASM_PLUGIN_CONFIG_FOLDER/ai-proxy.internal.yaml"
139139

140-
AI_STATISTICS_MATCH_RULES=""
141-
for i in "${GENERATED_INGRESSES[@]}"
142-
do
143-
AI_STATISTICS_MATCH_RULES="$AI_STATISTICS_MATCH_RULES
144-
- config:
145-
attributes:
146-
- apply_to_log: true
147-
key: question
148-
value: messages.@reverse.0.content
149-
value_source: request_body
150-
- apply_to_log: true
151-
key: answer
152-
rule: append
153-
value: choices.0.delta.content
154-
value_source: response_streaming_body
155-
- apply_to_log: true
156-
key: answer
157-
value: choices.0.message.content
158-
value_source: response_body
159-
configDisable: false
160-
ingress:
161-
- $i"
162-
done
163140
echo -e "\
164141
apiVersion: extensions.higress.io/v1alpha1
165142
kind: WasmPlugin
@@ -176,9 +153,10 @@ metadata:
176153
namespace: higress-system
177154
resourceVersion: \"1\"
178155
spec:
179-
defaultConfigDisable: true
156+
defaultConfig:
157+
use_default_attributes: true
158+
defaultConfigDisable: false
180159
failStrategy: FAIL_OPEN
181-
matchRules:$AI_STATISTICS_MATCH_RULES
182160
phase: UNSPECIFIED_PHASE
183161
priority: 900
184162
url: oci://higress-registry.cn-hangzhou.cr.aliyuncs.com/plugins/ai-statistics:2.0.0" >"$WASM_PLUGIN_CONFIG_FOLDER/ai-statistics-1.0.0.yaml"

0 commit comments

Comments
 (0)