Files
higress/plugins
johnlanni 8d7524456e feat: support use_default_attributes for ai-statistics plugin
Add use_default_attributes configuration option to enable sensible defaults.
When use_default_attributes is set to true, plugin automatically applies
a default set of attributes without requiring manual configuration.

Default attributes include:
- messages: extract complete conversation history from request body
- question: auto-extract last user message (built-in attribute)
- answer: auto-extract assistant response (built-in attribute)
- reasoning: auto-extract reasoning process (built-in attribute)
- tool_calls: auto-extract tool calls (built-in attribute)
- reasoning_tokens: auto-extract reasoning token count (built-in attribute)
- cached_tokens: auto-extract cached token count (built-in attribute)
- input_token_details: record complete input token details (built-in attribute)
- output_token_details: record complete output token details (built-in attribute)

Additionally, when use_default_attributes is true:
- value_length_limit is set to 10MB if not specified
- enable_path_suffixes is set to [/completions, /messages] if not specified

This provides sensible defaults for LLM observability out-of-the-box.
2026-02-01 13:05:47 +08:00
..
2024-10-22 21:39:01 +08:00

Wasm 插件

目前 Higress 提供了 c++ 和 golang 两种 Wasm 插件开发框架,支持 Wasm 插件路由&域名级匹配生效。

同时提供了多个内置插件,用户可以基于 Higress 提供的官方镜像仓库直接使用这些插件(以 c++ 版本举例):

basic-authBasic Auth 认证鉴权

key-authKey 认证鉴权

hmac-authHmac 认证鉴权

jwt-auth JWT 认证鉴权

bot-detect:防互联网爬虫

custom-response:自定义应答

key-rate-limit:针对参数的限流

request-block:自定义请求屏蔽

使用方式具体可以参考此 wasm-cpp Plugin文档 ,或 wasm-go Plugin文档 中相关说明。

所有内置插件都已上传至 Higress 的官方镜像仓库higress-registry.cn-hangzhou.cr.aliyuncs.com/plugins

例如用如下配置使用 request-block 插件 的 1.0.0 版本:

apiVersion: extensions.higress.io/v1alpha1
kind: WasmPlugin
metadata:
  name: request-block
  namespace: higress-system
spec:
  selector:
    matchLabels:
      higress: higress-system-higress-gateway
  defaultConfig:
    block_urls:
    - "swagger.html"
  url: oci://higress-registry.cn-hangzhou.cr.aliyuncs.com/plugins/request-block:1.0.0

贡献 Wasm 插件

如果您想要为 Higress 贡献插件请参考下述说明。

根据你选择的开发语言,将插件代码放到 wasm-cpp/extensions ,或者 wasm-go/extensions 目录下。

除了代码以外,需要额外提供一个 README.md 文件说明插件配置方式,以及 VERSION 文件用于记录插件版本,用作推送镜像时的 tag。

提交 PR 后,我们将评估插件的通用性,并对代码逻辑进行审查,确认无误后,会将插件镜像推送到官方仓库,后面将出现在社区的插件市场中。