Skip to content

Commit

Permalink
Merge branch 'master' into feat/FTI-5861-AI-Metrics-Prometheus
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoineJac authored Jun 20, 2024
2 parents ff63000 + 99cb060 commit e6f6d60
Show file tree
Hide file tree
Showing 42 changed files with 769 additions and 309 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/update-ngx-wasm-module.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:
# create or update changelog file
readonly CHANGELOG_FILE=changelog/unreleased/kong/bump-ngx-wasm-module.yml
{
printf 'message: "Bump `ngx_wasm_module` to `%s`"\n' "$TO"
printf 'message: "Bumped `ngx_wasm_module` to `%s`"\n' "$TO"
printf 'type: dependency\n'
} > "$CHANGELOG_FILE"
Expand Down
4 changes: 2 additions & 2 deletions .requirements
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ LIBEXPAT_SHA256=d4cf38d26e21a56654ffe4acd9cd5481164619626802328506a2869afab29ab3

LUA_KONG_NGINX_MODULE=a8411f7cf4289049f0bd3e8e40088e7256389ed3 # 0.11.0
LUA_RESTY_LMDB=7d2581cbe30cde18a8482d820c227ca0845c0ded # 1.4.2
LUA_RESTY_EVENTS=21d152d42ace72e1d51b782ca6827b851cd6a1d4 # 0.2.1
LUA_RESTY_EVENTS=2dcd1d7a256c53103c0fdbe804f419174e0ea8ba # 0.3.0
LUA_RESTY_WEBSOCKET=966c69c39f03029b9b42ec0f8e55aaed7d6eebc0 # 0.4.0.1
ATC_ROUTER=ffd11db657115769bf94f0c4f915f98300bc26b6 # 1.6.2
SNAPPY=23b3286820105438c5dbb9bc22f1bb85c5812c8a # 1.2.0

KONG_MANAGER=nightly
NGX_WASM_MODULE=91d447ffd0e9bb08f11cc69d1aa9128ec36b4526
NGX_WASM_MODULE=ae7b61150de7c14eb901307daed403b67f29e962
WASMER=3.1.1
WASMTIME=19.0.0
V8=12.0.267.17
Expand Down
5 changes: 5 additions & 0 deletions changelog/unreleased/kong/ai-proxy-azure-streaming.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
message: |
**AI-proxy-plugin**: Fixed a bug where certain Azure models would return partial tokens/words
when in response-streaming mode.
scope: Plugin
type: bugfix
5 changes: 5 additions & 0 deletions changelog/unreleased/kong/ai-proxy-fix-model-parameter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
message: |
**AI-proxy-plugin**: Fixed a bug where Cohere and Anthropic providers don't read the `model` parameter properly
from the caller's request body.
scope: Plugin
type: bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
message: |
**AI-proxy-plugin**: Fixed a bug where using "OpenAI Function" inference requests would log a
request error, and then hang until timeout.
scope: Plugin
type: bugfix
5 changes: 5 additions & 0 deletions changelog/unreleased/kong/ai-proxy-fix-sending-own-model.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
message: |
**AI-proxy-plugin**: Fixed a bug where AI Proxy would still allow callers to specify their own model,
ignoring the plugin-configured model name.
scope: Plugin
type: bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
message: |
**AI-proxy-plugin**: Fixed a bug where AI Proxy would not take precedence of the
plugin's configured model tuning options, over those in the user's LLM request.
scope: Plugin
type: bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
message: |
**AI-proxy-plugin**: Fixed a bug where setting OpenAI SDK model parameter "null" caused analytics
to not be written to the logging plugin(s).
scope: Plugin
type: bugfix
2 changes: 1 addition & 1 deletion changelog/unreleased/kong/bump-lua-resty-events.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
message: "Bumped lua-resty-events to 0.2.1"
message: "Bumped lua-resty-events to 0.3.0"
type: dependency
scope: Core
2 changes: 1 addition & 1 deletion changelog/unreleased/kong/bump-lua-resty-healthcheck.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
message: "Bumped lua-resty-healthcheck from 3.0.1 to 3.0.2, to reduce active healthcheck timer usage."
message: "Bumped lua-resty-healthcheck from 3.0.1 to 3.1.0, to reduce active healthcheck timer usage."
type: dependency
scope: Core
2 changes: 2 additions & 0 deletions changelog/unreleased/kong/bump-ngx-wasm-module.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
message: "Bumped `ngx_wasm_module` to `ae7b61150de7c14eb901307daed403b67f29e962`"
type: dependency
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
message: "**OpenTelemetry / Zipkin**: remove redundant deprecation warnings"
type: bugfix
scope: Plugin
3 changes: 3 additions & 0 deletions changelog/unreleased/kong/jwt_www_authenticate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
message: "**jwt**: Add WWW-Authenticate headers to 401 responses."
type: bugfix
scope: Plugin
4 changes: 4 additions & 0 deletions changelog/unreleased/kong/oauth2_www_authenticate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
message: "**OAuth2**: Add WWW-Authenticate headers to all 401 responses and realm option."
type: bugfix
scope: Plugin

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
message: Fixed an issue where the `route` entity would accept an invalid regex pattern if the `router_flavor` is `traditional` or `traditional_compatible`. Now, the invalid regex pattern for matching the value of request headers will not be accepted when creating the `route` entity.
type: bugfix
scope: Core
2 changes: 1 addition & 1 deletion kong-3.8.0-0.rockspec
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ dependencies = {
"binaryheap >= 0.4",
"luaxxhash >= 1.0",
"lua-protobuf == 0.5.1",
"lua-resty-healthcheck == 3.0.2",
"lua-resty-healthcheck == 3.1.0",
"lua-messagepack == 0.5.4",
"lua-resty-aws == 1.5.0",
"lua-resty-openssl == 1.4.0",
Expand Down
6 changes: 6 additions & 0 deletions kong/clustering/compat/removed_fields.lua
Original file line number Diff line number Diff line change
Expand Up @@ -157,5 +157,11 @@ return {
hmac_auth = {
"realm",
},
jwt = {
"realm",
},
oauth2 = {
"realm",
},
},
}
4 changes: 4 additions & 0 deletions kong/db/schema/entities/routes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,10 @@ local routes = {
},
},
},
values = {
type = "array",
elements = typedefs.regex_or_plain_pattern,
}
} },

{ regex_priority = { description = "A number used to choose which route resolves a given request when several routes match it using regexes simultaneously.", type = "integer", default = 0 }, },
Expand Down
155 changes: 63 additions & 92 deletions kong/db/schema/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ local tostring = tostring
local concat = table.concat
local insert = table.insert
local format = string.format
local ipairs = ipairs
local unpack = unpack
local assert = assert
local yield = require("kong.tools.yield").yield
Expand Down Expand Up @@ -1642,6 +1643,58 @@ local function adjust_field_for_context(field, value, context, nulls, opts)
end


local function resolve_reference(kong, value)
local deref, err = kong.vault.get(value)
if not deref then
if err then
kong.log.warn("unable to resolve reference ", value, " (", err, ")")
else
kong.log.notice("unable to resolve reference ", value)
end
end
return deref or ""
end


local function collect_previous_references(prev_refs, key, refs)
if prev_refs and prev_refs[key] then
if refs then
if not refs[key] then
refs[key] = prev_refs[key]
end

else
refs = { [key] = prev_refs[key] }
end
end
return refs
end


local function collect_subfield_reference(refs, key, references, index, narr, nrec)
if not refs then
refs = {
[key] = new_tab(narr, nrec)
}
elseif not refs[key] then
refs[key] = new_tab(narr, nrec)
end
refs[key][index] = references[index]
return refs
end


local function collect_field_reference(refs, key, reference)
if refs then
refs[key] = reference
else
refs = { [key] = reference }
end

return refs
end


--- Given a table, update its fields whose schema
-- definition declares them as `auto = true`,
-- based on its CRUD operation context, and set
Expand Down Expand Up @@ -1776,32 +1829,10 @@ function Schema:process_auto_fields(data, context, nulls, opts)
if resolve_references then
if ftype == "string" and field.referenceable then
if is_reference(value) then
if refs then
refs[key] = value
else
refs = { [key] = value }
end

local deref, err = kong.vault.get(value)
if deref then
value = deref

else
if err then
kong.log.warn("unable to resolve reference ", value, " (", err, ")")
else
kong.log.notice("unable to resolve reference ", value)
end

value = ""
end

elseif prev_refs and prev_refs[key] then
if refs then
refs[key] = prev_refs[key]
else
refs = { [key] = prev_refs[key] }
end
refs = collect_field_reference(refs, key, value)
value = resolve_reference(kong, value)
else
refs = collect_previous_references(prev_refs, key, refs)
end

elseif vtype == "table" and (ftype == "array" or ftype == "set") then
Expand All @@ -1811,43 +1842,13 @@ function Schema:process_auto_fields(data, context, nulls, opts)
if count > 0 then
for i = 1, count do
if is_reference(value[i]) then
if not refs then
refs = {}
end

if not refs[key] then
refs[key] = new_tab(count, 0)
end

refs[key][i] = value[i]

local deref, err = kong.vault.get(value[i])
if deref then
value[i] = deref

else
if err then
kong.log.warn("unable to resolve reference ", value[i], " (", err, ")")
else
kong.log.notice("unable to resolve reference ", value[i])
end

value[i] = ""
end
refs = collect_subfield_reference(refs, key, value, i, count, 0)
value[i] = resolve_reference(kong, value[i])
end
end
end

if prev_refs and prev_refs[key] then
if refs then
if not refs[key] then
refs[key] = prev_refs[key]
end

else
refs = { [key] = prev_refs[key] }
end
end
refs = collect_previous_references(prev_refs, key, refs)
end

elseif vtype == "table" and ftype == "map" then
Expand All @@ -1857,43 +1858,13 @@ function Schema:process_auto_fields(data, context, nulls, opts)
if count > 0 then
for k, v in pairs(value) do
if is_reference(v) then
if not refs then
refs = {}
end

if not refs[key] then
refs[key] = new_tab(0, count)
end

refs[key][k] = v

local deref, err = kong.vault.get(v)
if deref then
value[k] = deref

else
if err then
kong.log.warn("unable to resolve reference ", v, " (", err, ")")
else
kong.log.notice("unable to resolve reference ", v)
end

value[k] = ""
end
refs = collect_subfield_reference(refs, key, value, k, 0, count)
value[k] = resolve_reference(kong, v)
end
end
end

if prev_refs and prev_refs[key] then
if refs then
if not refs[key] then
refs[key] = prev_refs[key]
end

else
refs = { [key] = prev_refs[key] }
end
end
refs = collect_previous_references(prev_refs, key, refs)
end
end
end
Expand Down
Loading

0 comments on commit e6f6d60

Please sign in to comment.