feat(ai-proxy-multi): add support for healthcheck#12509
Merged
Conversation
Revolyssup
marked this pull request as draft
August 11, 2025 08:47
Revolyssup
marked this pull request as ready for review
August 11, 2025 17:48
membphis
reviewed
Aug 12, 2025
| if not plugin_conf._meta.parent then | ||
| local mt_table = getmetatable(plugin_conf._meta) | ||
| if mt_table then | ||
| mt_table.parent = parent |
Member
There was a problem hiding this comment.
Contributor
Author
There was a problem hiding this comment.
the healthcheck_manager module is tied only to manage the checkers on the upstream configuration. I don't know if we can use that mechanism here because here we are creating custom healthchecker using the checks configuration in the plugin configuration.
Member
There was a problem hiding this comment.
yes, i think we have to use the healthcheck_manager way
the old way parent is bad way which was deprecated
nic-6443
reviewed
Aug 12, 2025
membphis
reviewed
Aug 12, 2025
| local function fetch_latest_conf(resource_path) | ||
| -- if resource path contains json path, extract out the prefix | ||
| -- for eg: extracts /routes/1 from /routes/1#plugins.abc | ||
| resource_path = resource_path:match("^(.-)#") or resource_path |
Member
There was a problem hiding this comment.
use local res = ngx.re.split(...)
the res[1] is resource path, res[2] is sub resource path
we can add a new function to parse the path
| local plugin_name = get_plugin_name(resource_path) | ||
| if plugin_name and plugin_name ~= "" then | ||
| local json_path = "$." .. (resource_path:match("#(.+)$") or "") | ||
| local tab = jp.value(res_conf.value, json_path) |
This reverts commit 234e174.
nic-6443
approved these changes
Aug 19, 2025
membphis
approved these changes
Aug 19, 2025
AlinsRan
approved these changes
Aug 21, 2025
jizhuozhi
pushed a commit
to jizhuozhi/apisix
that referenced
this pull request
Oct 18, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist
Add healthcheck logic to faciilitate the selection of healthy ai backend while using ai-proxy-multi plugin.
Healthcheck manager has been modified with the capability to use dynamically created upstreams via the resource key.
For eg: if resource key is : /routes/1#<path to configuration>, the the configuration will be passed to the construct_upstream function implemented by the plugin to create an upstream instead of trying to simply extract from resource. This helps to leverage the healthcheck manager for use in ai-proxy and even traffic-split plugin as the healthcheck creation/management is decoupled from the routes or services(parent).