diff --git a/kong/plugins/zipkin/handler.lua b/kong/plugins/zipkin/handler.lua index 91da3d8..09e4c6a 100644 --- a/kong/plugins/zipkin/handler.lua +++ b/kong/plugins/zipkin/handler.lua @@ -102,8 +102,13 @@ if subsystem == "http" then initialize_request = function(conf, ctx) local req = kong.request - local header_type, trace_id, span_id, parent_id, should_sample, baggage = - tracing_headers.parse(req.get_headers()) + local header_type = conf.default_header_type + local trace_id, span_id, parent_id, should_sample, baggage + if conf.header_type ~= "ignore" then + header_type, trace_id, span_id, parent_id, should_sample, baggage = + tracing_headers.parse(req.get_headers()) + end + local method = req.get_method() if should_sample == nil then diff --git a/kong/plugins/zipkin/schema.lua b/kong/plugins/zipkin/schema.lua index f5d7922..c401577 100644 --- a/kong/plugins/zipkin/schema.lua +++ b/kong/plugins/zipkin/schema.lua @@ -54,7 +54,7 @@ return { { include_credential = { type = "boolean", required = true, default = true } }, { 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", "jaeger" } } }, + one_of = { "preserve", "ignore", "b3", "b3-single", "w3c", "jaeger" } } }, { default_header_type = { type = "string", required = true, default = "b3", one_of = { "b3", "b3-single", "w3c", "jaeger" } } }, { static_tags = { type = "array", elements = static_tag, diff --git a/kong/plugins/zipkin/tracing_headers.lua b/kong/plugins/zipkin/tracing_headers.lua index 4ebc331..a54ba6b 100644 --- a/kong/plugins/zipkin/tracing_headers.lua +++ b/kong/plugins/zipkin/tracing_headers.lua @@ -338,6 +338,7 @@ local function set(conf_header_type, found_header_type, proxy_span, conf_default if conf_header_type ~= "preserve" and found_header_type ~= nil and + conf_header_type ~= "ignore" and conf_header_type ~= found_header_type then kong.log.warn("Mismatched header types. conf: " .. conf_header_type .. ". found: " .. found_header_type)