tzssangglass commented on code in PR #6960:
URL: https://github.com/apache/apisix/pull/6960#discussion_r867596851


##########
apisix/stream/xrpc/runner.lua:
##########
@@ -70,9 +75,53 @@ local function put_req_ctx(session, ctx)
 end
 
 
+local function filter_logger(ctx, logger)
+    if not logger or not logger.filter or #logger.filter == 0 then
+        return false
+    end
+
+    local expr, err = expr.new(logger.filter)
+    if err then
+        core.log.error("failed to validate the 'filter' expression: ", err)
+        return false
+    end
+    return expr:eval(ctx)
+end
+
+
+local function run_log_plugin(ctx, logger)
+    local pkg_name = "apisix.stream.plugins." .. logger.name
+    local ok, plugin = pcall(require, pkg_name)
+    if not ok then
+        core.log.error("failed to load plugin [", plugin, "] err: ", plugin)
+        return
+    end
+
+    core.ctx.set_vars_meta(ctx)
+    ctx.conf_id = tostring(logger.conf)
+    ctx.conf_type = "xrpc-logger"

Review Comment:
   There is a problem here, since it is possible to run the plugin in `logger`, 
`metrics` stage, so `conf_id`, `conf_type` can only be set here. We need to 
find a way to solve this problem.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to