You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by me...@apache.org on 2020/12/08 15:16:33 UTC
[apisix] branch master updated: chore(skywalking): the range of
sample rate should be `[0, ratio)` (#2984)
This is an automated email from the ASF dual-hosted git repository.
membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git
The following commit(s) were added to refs/heads/master by this push:
new 9324194 chore(skywalking): the range of sample rate should be `[0, ratio)` (#2984)
9324194 is described below
commit 93241949b46b58e13387ff84de89902498cf8f2f
Author: 罗泽轩 <sp...@gmail.com>
AuthorDate: Tue Dec 8 23:16:22 2020 +0800
chore(skywalking): the range of sample rate should be `[0, ratio)` (#2984)
---
apisix/plugins/skywalking.lua | 2 +-
t/plugin/skywalking.t | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/apisix/plugins/skywalking.lua b/apisix/plugins/skywalking.lua
index c62ba8a..cd66035 100644
--- a/apisix/plugins/skywalking.lua
+++ b/apisix/plugins/skywalking.lua
@@ -74,7 +74,7 @@ end
function _M.rewrite(conf, ctx)
core.log.debug("rewrite phase of skywalking plugin")
ctx.skywalking_sample = false
- if conf.sample_ratio == 1 or math.random() <= conf.sample_ratio then
+ if conf.sample_ratio == 1 or math.random() < conf.sample_ratio then
ctx.skywalking_sample = true
sw_tracer:start("upstream service")
core.log.info("tracer start")
diff --git a/t/plugin/skywalking.t b/t/plugin/skywalking.t
index e3bf55d..cce7503 100644
--- a/t/plugin/skywalking.t
+++ b/t/plugin/skywalking.t
@@ -105,7 +105,7 @@ passed
-=== TEST 2: tiger skywalking
+=== TEST 2: trigger skywalking
--- request
GET /opentracing
--- response_body
@@ -188,7 +188,7 @@ passed
-=== TEST 5: not tiger skywalking
+=== TEST 5: not trigger skywalking
--- request
GET /opentracing
--- response_body
@@ -252,7 +252,7 @@ passed
-=== TEST 7: not tiger skywalking
+=== TEST 7: not trigger skywalking
--- request
GET /opentracing
--- response_body