Skip to content

Commit

Permalink
fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
moonming committed Jul 26, 2019
1 parent 315c179 commit 9d7da79
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
Binary file added doc/images/plugin/zipkin-1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/plugin/zipkin-2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions doc/plugins/zipkin.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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,
Expand All @@ -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": {
Expand Down
1 change: 1 addition & 0 deletions lua/apisix/core/response.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 2 additions & 8 deletions lua/apisix/plugins/zipkin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions t/plugin/zipkin.t
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down

0 comments on commit 9d7da79

Please sign in to comment.