diff --git a/doc/images/plugin/zipkin-1.jpg b/doc/images/plugin/zipkin-1.jpg new file mode 100644 index 0000000000000..935146bacd339 Binary files /dev/null and b/doc/images/plugin/zipkin-1.jpg differ diff --git a/doc/images/plugin/zipkin-2.jpg b/doc/images/plugin/zipkin-2.jpg new file mode 100644 index 0000000000000..291cd4b9b05ac Binary files /dev/null and b/doc/images/plugin/zipkin-2.jpg differ diff --git a/doc/plugins/zipkin.md b/doc/plugins/zipkin.md index bcfd4d730b49d..e3b54685d673b 100644 --- a/doc/plugins/zipkin.md +++ b/doc/plugins/zipkin.md @@ -8,7 +8,7 @@ ## Name -`Zipkin` is a OpenTracing plugin. +[Zipkin](https://github.com/openzipkin/zipkin) is a OpenTracing plugin. It's also works with `Apache SkyWalking`, which is support Zipkin v1/v2 format. @@ -66,6 +66,10 @@ Then you can use a browser to access the webUI of Zipkin: http://127.0.0.1:9411/zipkin ``` +![](../../doc/images/plugin/zipkin-1.png) + +![](../../doc/images/plugin/zipkin-2.png) + ## Disable Plugin When you want to disable the zipkin plugin, it is very simple, @@ -77,7 +81,6 @@ $ curl http://127.0.0.1:2379/v2/keys/apisix/routes/1 -X PUT -d value=' { "methods": ["GET"], "uri": "/index.html", - "id": 1, "plugins": { }, "upstream": { diff --git a/lua/apisix/core/response.lua b/lua/apisix/core/response.lua index d17f385af78fe..ed61ea39c91ce 100644 --- a/lua/apisix/core/response.lua +++ b/lua/apisix/core/response.lua @@ -80,6 +80,7 @@ end function _M.get_upstream_status(ctx) + -- $upstream_status maybe including mutiple status, only need the last one return tonumber(str_sub(ctx.var.upstream_status or "", -3)) end diff --git a/lua/apisix/plugins/zipkin.lua b/lua/apisix/plugins/zipkin.lua index cd55c84341794..ca19a79c16c50 100644 --- a/lua/apisix/plugins/zipkin.lua +++ b/lua/apisix/plugins/zipkin.lua @@ -32,13 +32,7 @@ local _M = { function _M.check_schema(conf) - local ok, err = core.schema.check(schema, conf) - - if not ok then - return false, err - end - - return true + return core.schema.check(schema, conf) end @@ -66,7 +60,7 @@ end function _M.rewrite(conf, ctx) local tracer = core.lrucache.plugin_ctx(plugin_name, ctx, - create_tracer, conf) + create_tracer, conf) ctx.opentracing_sample = tracer.sampler:sample() if not ctx.opentracing_sample then diff --git a/t/plugin/zipkin.t b/t/plugin/zipkin.t index a07484367eef4..028dfe347312b 100644 --- a/t/plugin/zipkin.t +++ b/t/plugin/zipkin.t @@ -163,8 +163,10 @@ passed GET /opentracing --- response_body opentracing ---- error_log -report2endpoint ok +--- grep_error_log eval +qr/\[info\].*/ +--- grep_error_log_out eval +qr{report2endpoint ok}