From 0943c0d6f4d39c452d5ffef336bb9f52698b67f2 Mon Sep 17 00:00:00 2001 From: johnlanni Date: Sun, 1 Feb 2026 12:47:02 +0800 Subject: [PATCH] feat: enable use_default_attributes for ai-statistics plugin in config template 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. --- .../scripts/config-template/ai-gateway.sh | 28 ++----------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/all-in-one/scripts/config-template/ai-gateway.sh b/all-in-one/scripts/config-template/ai-gateway.sh index 1ceae9d..d80fcf8 100644 --- a/all-in-one/scripts/config-template/ai-gateway.sh +++ b/all-in-one/scripts/config-template/ai-gateway.sh @@ -137,29 +137,6 @@ spec: priority: 100 url: oci://higress-registry.cn-hangzhou.cr.aliyuncs.com/plugins/ai-proxy:2.0.0" >"$WASM_PLUGIN_CONFIG_FOLDER/ai-proxy.internal.yaml" -AI_STATISTICS_MATCH_RULES="" -for i in "${GENERATED_INGRESSES[@]}" -do - AI_STATISTICS_MATCH_RULES="$AI_STATISTICS_MATCH_RULES - - config: - attributes: - - apply_to_log: true - key: question - value: messages.@reverse.0.content - value_source: request_body - - apply_to_log: true - key: answer - rule: append - value: choices.0.delta.content - value_source: response_streaming_body - - apply_to_log: true - key: answer - value: choices.0.message.content - value_source: response_body - configDisable: false - ingress: - - $i" -done echo -e "\ apiVersion: extensions.higress.io/v1alpha1 kind: WasmPlugin @@ -176,9 +153,10 @@ metadata: namespace: higress-system resourceVersion: \"1\" spec: - defaultConfigDisable: true + defaultConfig: + use_default_attributes: true + defaultConfigDisable: false failStrategy: FAIL_OPEN - matchRules:$AI_STATISTICS_MATCH_RULES phase: UNSPECIFIED_PHASE priority: 900 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"