diff --git a/kong/api/init.lua b/kong/api/init.lua index 4b68d3558039e..b6606e4181a1a 100644 --- a/kong/api/init.lua +++ b/kong/api/init.lua @@ -128,3 +128,5 @@ do end return app + +-- run tests \ No newline at end of file diff --git a/kong/plugins/sample-changer/handler.lua b/kong/plugins/sample-changer/handler.lua new file mode 100644 index 0000000000000..371c9707f4e84 --- /dev/null +++ b/kong/plugins/sample-changer/handler.lua @@ -0,0 +1,20 @@ +local kong_meta = require "kong.meta" + + + +local SampleChangerHandler = { + VERSION = kong_meta.version, + PRIORITY = 9000, +} +function SampleChangerHandler:access(conf) + if math.random() < 0.5 then + ngx.ctx.KONG_SPANS = { nil }; + ngx.ctx.KONG_SPANS[0] = 1; + -- kong.tracing = kong.tracing("off", { noop = true }); + + else + ngx.log(ngx.ERR, "THIS WAS REPORTED") + end +end + +return SampleChangerHandler diff --git a/kong/plugins/sample-changer/schema.lua b/kong/plugins/sample-changer/schema.lua new file mode 100644 index 0000000000000..eed9df95f74ae --- /dev/null +++ b/kong/plugins/sample-changer/schema.lua @@ -0,0 +1,16 @@ +local typedefs = require "kong.db.schema.typedefs" + +return { + name = "sample-changer", + fields = { + { protocols = typedefs.protocols_http }, -- TODO: support stream mode + { config = { + type = "record", + fields = { + { foo = { + description = "The foo ss.", + type = "integer" + } }, + } }, + }, }, +}