-
Notifications
You must be signed in to change notification settings - Fork 31
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm excited to see this patch.
Thinking of the scopes at which one can define these tags, is it possible to associate a plugin configuration with a particular Kubernetes Ingress object, or all the Ingress objects in a given namespace, as opposed to defining them globally?
@@ -205,6 +213,14 @@ elseif subsystem == "stream" then | |||
|
|||
request_span:set_tag("lc", "kong") | |||
|
|||
local static_tags = conf.static_tags | |||
if type(static_tags) == "table" then | |||
for i = 1, #static_tags do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do you choose between this technique and using ipairs
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one I'm not sure but if you do get confused between pairs and ipairs, we use ipairs
in the hot code paths to increase the probability that it is compiled by the JIT: http://wiki.luajit.org/NYI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Performance wise, both alternatives have similar speed (both get JITted) in LuaJIT. I think ipairs
is more readable, so if you are sure your code is going to get executed exclusively in LuaJIT, you should use ipairs.
However, if there's a chance your code is not going to be executed in LuaJIT, the performance of ipairs
is way worse than the numeric alternative in Vanilla Lua.
Since I maintain several non-LuaJIT-specific open source Lua libraries I always use the numeric for
"on automatic" - I almost never use ipairs
. I had internalized this so much that I had to think and reevaluate my thought process :)
kong/plugins/zipkin/schema.lua
Outdated
@@ -15,6 +40,7 @@ return { | |||
{ traceid_byte_count = { type = "integer", required = true, default = 16, one_of = { 8, 16 } } }, | |||
{ header_type = { type = "string", required = true, default = "preserve", | |||
one_of = { "preserve", "b3", "b3-single", "w3c" } } }, | |||
{ static_tags = { type = "array", elements = static_tag } } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I doesn't look like there's a way to enforce in the schema that the static_tag
values' names are unique. The last one wins if there are multiple tags with the same name. Should we validate that the names are unique?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is now included (code and tests)
Based on reading the existing code, it seems this plugin can be enabled on any service or route in Kong. That means, in the k8s world, you can associate a specific plugin configuration to:
We currently don't support running plugins for all ingress resource on a namespace. That's a limitation/feature of the controller and not this specific plugin. |
@hbagdi I confirm the plugin can be enabled on a Service or Route. |
Allows setting tags on the request span via configuration. Implements #3
Allows setting tags on the request span via configuration.
Implements #3