You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2020/04/19 09:41:35 UTC
[GitHub] [incubator-apisix] OnlyPiglet edited a comment on issue #1474: bug:
global_rule prometheus ineffective
OnlyPiglet edited a comment on issue #1474: bug: global_rule prometheus ineffective
URL: https://github.com/apache/incubator-apisix/issues/1474#issuecomment-616088114
I fixed it temporarily by inserting thie part of code
```lua
local ngx_ctx = ngx.ctx
local api_ctx = ngx_ctx.api_ctx
if router.global_rules and router.global_rules.values
and #router.global_rules.values > 0 then
local plugins = core.tablepool.fetch("plugins", 32, 0)
for _, global_rule in ipairs(router.global_rules.values) do
api_ctx.conf_type = "global_rule"
api_ctx.conf_version = global_rule.modifiedIndex
api_ctx.conf_id = global_rule.value.id
core.table.clear(plugins)
api_ctx.plugins = plugin.filter(global_rule, plugins)
run_plugin("log", plugins, api_ctx)
end
core.tablepool.release("plugins", plugins)
api_ctx.plugins = nil
api_ctx.conf_type = nil
api_ctx.conf_version = nil
api_ctx.conf_id = nil
end
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services