Skip to content

Commit

Permalink
compat prometheus
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoineJac committed Jul 23, 2024
1 parent 4c772c6 commit 333c5d7
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
message: >
"**Prometheus**: Add compatibility for the new configuration field `ai-metrics`.
type: feature
scope: Plugin
12 changes: 12 additions & 0 deletions kong/clustering/compat/checkers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,18 @@ local compatible_checkers = {
dp_version, log_suffix)
end
end

if plugin.name == 'prometheus' then
local config = plugin.config
if config.ai_metrics ~= nil then
config.ai_metrics = nil
has_update = true"
log_warn_message('configures ' .. plugin.name .. ' plugin with ai_metrics',
'will be removed.',
dp_version, log_suffix)
has_update = true
end
end
end

return has_update
Expand Down
22 changes: 22 additions & 0 deletions spec/02-integration/09-hybrid_mode/09-config-compat_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,28 @@ describe("CP/DP config compat transformations #" .. strategy, function()
end)
end)

describe("prometheus plugins", function()
it("[prometheus] remove ai_metrics property for versions below 3.8", function()
-- [[ 3.7.x ]] --
local prometheus = admin.plugins:insert {
name = "prometheus",
enabled = true,
config = {
ai_metrics = true, -- becomes nil
},
}
-- ]]

local expected_prometheus_prior_38 = cycle_aware_deep_copy(prometheus)
expected_prometheus_prior_38.config.ai_metrics = nil

do_assert(uuid(), "3.7.0", expected_prometheus_prior_38)

-- cleanup
admin.plugins:remove({ id = prometheus.id })
end)
end)

describe("www-authenticate header in plugins (realm config)", function()
it("[basic-auth] removes realm for versions below 3.6", function()
local basic_auth = admin.plugins:insert {
Expand Down

0 comments on commit 333c5d7

Please sign in to comment.