diff --git a/plugins/wasm-go/extensions/ai-search/main.go b/plugins/wasm-go/extensions/ai-search/main.go index d19d09b5a..daeac08c0 100644 --- a/plugins/wasm-go/extensions/ai-search/main.go +++ b/plugins/wasm-go/extensions/ai-search/main.go @@ -362,7 +362,8 @@ func onHttpRequestBody(ctx wrapper.HttpContext, config Config, body []byte, log }, rewriteBody, func(statusCode int, responseHeaders http.Header, responseBody []byte) { if statusCode != http.StatusOK { - log.Errorf("search rewrite failed, status: %d", statusCode) + log.Errorf("search rewrite failed, status: %d, request url: %s, request cluster: %s, search rewrite model: %s", + statusCode, searchRewrite.url, searchRewrite.client.ClusterName(), searchRewrite.modelName) // After a rewrite failure, no further search is performed, thus quickly identifying the failure. proxywasm.ResumeHttpRequest() return diff --git a/plugins/wasm-go/pkg/wrapper/http_wrapper.go b/plugins/wasm-go/pkg/wrapper/http_wrapper.go index 36b4fe76c..85220834c 100644 --- a/plugins/wasm-go/pkg/wrapper/http_wrapper.go +++ b/plugins/wasm-go/pkg/wrapper/http_wrapper.go @@ -38,6 +38,7 @@ type HttpClient interface { Connect(rawURL string, headers [][2]string, body []byte, cb ResponseCallback, timeoutMillisecond ...uint32) error Trace(rawURL string, headers [][2]string, body []byte, cb ResponseCallback, timeoutMillisecond ...uint32) error Call(method, rawURL string, headers [][2]string, body []byte, cb ResponseCallback, timeoutMillisecond ...uint32) error + ClusterName() string } type ClusterClient[C Cluster] struct { @@ -80,6 +81,8 @@ func (c ClusterClient[C]) Call(method, rawURL string, headers [][2]string, body return HttpCall(c.cluster, method, rawURL, headers, body, cb, timeoutMillisecond...) } +func (c ClusterClient[C]) ClusterName() string { return c.cluster.ClusterName() } + func HttpCall(cluster Cluster, method, rawURL string, headers [][2]string, body []byte, callback ResponseCallback, timeoutMillisecond ...uint32) error { for i := len(headers) - 1; i >= 0; i-- {