AlinsRan commented on code in PR #13899: URL: https://github.com/apache/apisix/pull/13899#discussion_r3893231229
########## apisix/control/v1.lua: ########## @@ -108,6 +116,36 @@ local function get_checker_type(checks) end +-- A plugin can run active health checks of its own on nodes that belong to no +-- upstream -- ai-proxy-multi probes every LLM instance and skips the unhealthy +-- ones when it picks a target. Those checkers are keyed by the resource key plus +-- a JSON path, a layout only the plugin knows, so ask the plugin for them +-- instead of guessing. What a checker stands for is the plugin's business too: +-- it names itself in `meta`, reported verbatim. +local function add_plugin_healthcheck_info(infos, value) + local plugins = value.value.plugins + if not plugins then + return + end + + for name, plugin_conf in pairs(plugins) do + local plugin_obj = plugin.get(name) + if plugin_obj and plugin_obj.list_healthcheck_targets then Review Comment: Valid on both counts, fixed in 9a0dd001. plugin.check_schema() keeps a config that the plugin rejects when it is disabled (plugin.lua:1024-1036), so `instances` can be any type at all — `ipairs` on a non-table raises, and one disabled config would fail the whole /v1/healthcheck response. And even a well-formed disabled config declares checkers that never exist, since the plugin never reaches pick_target(). check_disable() is the existing answer to "does this config ever run", so it is exported rather than restating the rule in the control API. Regression case added with `_meta.disable = true` plus `instances = "not an array"`, the shape that used to 500. -- 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]
