Skip to content

Commit

Permalink
fix: update otel version to match Kong Gateway version
Browse files Browse the repository at this point in the history
To make this fix work, we're adding a hack that prevents the normal
plugin compatibility checks to be done for the opentelemetry plugin if
the version of the plugin reported by the DP is 0.1.0.
  • Loading branch information
hanshuebner committed Jul 2, 2024
1 parent 25bcc8e commit 9b8deb8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
18 changes: 13 additions & 5 deletions kong/clustering/compat/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,19 @@ function _M.check_configuration_compatibility(cp, dp)
-- CP plugin needs to match DP plugins with major version
-- CP must have plugin with equal or newer version than that on DP

if cp_plugin.major ~= dp_plugin.major or
cp_plugin.minor < dp_plugin.minor then
local msg = "configured data plane " .. name .. " plugin version " .. dp_plugin.version ..
" is different to control plane plugin version " .. cp_plugin.version
return nil, msg, CLUSTERING_SYNC_STATUS.PLUGIN_VERSION_INCOMPATIBLE
if name == "opentelemetry" and dp_plugin.major == 0 and dp_plugin.minor == 1 then
-- The first version of the opentelemetry plugin was introduced into the Kong code base with a version
-- number 0.1.0 and released that way. In subsequent releases, the version number was then not updated
-- to avoid the compatibility check from failing. To work around this issue and allow us to fix the
-- version number of the opentelemetry plugin, we're accepting the plugin with version 0.1.0 to be
-- compatible
else
if cp_plugin.major ~= dp_plugin.major or
cp_plugin.minor < dp_plugin.minor then
local msg = "configured data plane " .. name .. " plugin version " .. dp_plugin.version ..
" is different to control plane plugin version " .. cp_plugin.version
return nil, msg, CLUSTERING_SYNC_STATUS.PLUGIN_VERSION_INCOMPATIBLE
end
end
end
end
Expand Down
3 changes: 2 additions & 1 deletion kong/plugins/opentelemetry/handler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ local clone = require "table.clone"
local otlp = require "kong.plugins.opentelemetry.otlp"
local propagation = require "kong.tracing.propagation"
local tracing_context = require "kong.tracing.tracing_context"
local kong_meta = require "kong.meta"


local ngx = ngx
Expand All @@ -24,7 +25,7 @@ local _log_prefix = "[otel] "


local OpenTelemetryHandler = {
VERSION = "0.1.0",
VERSION = kong_meta.version,
PRIORITY = 14,
}

Expand Down

0 comments on commit 9b8deb8

Please sign in to comment.