Skip to content

feat: enable use_default_attributes for ai-statistics plugin#228

Merged
johnlanni merged 1 commit into
mainfrom
feat/ai-statistics-use-default-attributes
Feb 1, 2026
Merged

feat: enable use_default_attributes for ai-statistics plugin#228
johnlanni merged 1 commit into
mainfrom
feat/ai-statistics-use-default-attributes

Conversation

@johnlanni
Copy link
Copy Markdown
Contributor

@johnlanni johnlanni commented Feb 1, 2026

Summary

Update ai-statistics WasmPlugin configuration in AI Gateway config template to use use_default_attributes: true by default, making the plugin apply globally with sensible defaults for LLM observability.

Motivation

The previous configuration had two issues:

  1. The plugin was disabled by default (defaultConfigDisable: true)
  2. Required per-ingress matchRules with manual attribute configuration, which was verbose and error-prone

With the new use_default_attributes feature in ai-statistics plugin (higress#3427), we can simplify configuration significantly - the plugin now applies globally to all AI routes without needing matchRules.

Changes

Configuration Updates

  • Changed defaultConfigDisable from true to false - plugin now enabled globally
  • Added defaultConfig with use_default_attributes: true - uses default attributes automatically
  • Removed matchRules completely - plugin applies to all routes globally
  • Removed generated matchRules loop for all ingresses (25 lines total removed)

Before

spec:
  defaultConfigDisable: true  # Disabled by default
  matchRules:               # Per-ingress config required
    - config:
        attributes:
        - apply_to_log: true
          key: question
          value: messages.@reverse.0.content
          value_source: request_body
        # ... 12 more lines of attribute config
      configDisable: false
      ingress:
      - ai-route-openai.internal
    - configDisable: false
      ingress:
      - ai-route-moonshot.internal
    # ... more ingress entries

After

spec:
  defaultConfig:
    use_default_attributes: true  # Use sensible defaults
  defaultConfigDisable: false     # Enabled globally
  # No matchRules needed - applies to all routes automatically

Benefits

  • Simpler: 3 insertions, 25 deletions - much cleaner configuration
  • Better defaults: Plugin enabled globally with sensible attributes for all AI routes
  • Easier to use: No need to configure per-ingress matchRules or attributes
  • Still flexible: Users can still override with custom configuration if needed

Related Issues

@johnlanni johnlanni requested a review from CH3CHO as a code owner February 1, 2026 04:47
@lingma-agents
Copy link
Copy Markdown

lingma-agents Bot commented Feb 1, 2026

🔍 代码审查进行中

⏳ 正在审查

⏰️ 剩余时间:约需数分钟

🔄 分支流向: feat/ai-statistics-use-default-attributesmain

📦 提交: 审查当前PR从0ec0203cffa911的提交。


📒 文件清单 (1 个文件)
📝 变更: 1 个文件

📝 变更文件:

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

…g 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.
@johnlanni johnlanni force-pushed the feat/ai-statistics-use-default-attributes branch from cffa911 to 0943c0d Compare February 1, 2026 04:52
@johnlanni johnlanni merged commit 8b661df into main Feb 1, 2026
3 checks passed
@lingma-agents
Copy link
Copy Markdown

lingma-agents Bot commented Feb 1, 2026

CodeReview流程已终止

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant