You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2020/03/30 09:17:17 UTC

[GitHub] [incubator-apisix] lilien1010 opened a new pull request #1370: enhance: plugin Zipkin add service name and report local server IP

lilien1010 opened a new pull request #1370: enhance: plugin Zipkin add service name and report local server IP
URL: https://github.com/apache/incubator-apisix/pull/1370
 
 
   
   ### Summary
   
   allow zipkin to set servie name so that we can track it in APM system
   
   ### Full changelog
   
   * plugins/zipkin.lua
   * plugins/zipkin/reporter.lua
   * t/plugin/zipkin.t
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-apisix] lilien1010 commented on a change in pull request #1370: enhance: plugin Zipkin add service name and report local server IP

Posted by GitBox <gi...@apache.org>.
lilien1010 commented on a change in pull request #1370: enhance: plugin Zipkin add service name and report local server IP
URL: https://github.com/apache/incubator-apisix/pull/1370#discussion_r401348180
 
 

 ##########
 File path: lua/apisix/plugins/zipkin.lua
 ##########
 @@ -29,7 +29,17 @@ local schema = {
     type = "object",
     properties = {
         endpoint = {type = "string"},
-        sample_ratio = {type = "number", minimum = 0.00001, maximum = 1}
+        sample_ratio = {type = "number", minimum = 0.00001, maximum = 1},
+        service_name = {
+            type = "string",
+            description = "service name for zipkin reporter",
+            default = "APISIX",
+        },
+        server_addr = {
 
 Review comment:
   done

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-apisix] moonming commented on a change in pull request #1370: enhance: plugin Zipkin add service name and report local server IP

Posted by GitBox <gi...@apache.org>.
moonming commented on a change in pull request #1370: enhance: plugin Zipkin add service name and report local server IP
URL: https://github.com/apache/incubator-apisix/pull/1370#discussion_r400054099
 
 

 ##########
 File path: t/plugin/zipkin.t
 ##########
 @@ -126,7 +126,8 @@ done
                         "plugins": {
                             "zipkin": {
                                 "endpoint": "http://127.0.0.1:1982/mock_zipkin",
-                                "sample_ratio": 1
+                                "sample_ratio": 1,
+                                "service_name":"APISIX"
 
 Review comment:
   Add space after `:`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-apisix] moonming commented on a change in pull request #1370: enhance: plugin Zipkin add service name and report local server IP

Posted by GitBox <gi...@apache.org>.
moonming commented on a change in pull request #1370: enhance: plugin Zipkin add service name and report local server IP
URL: https://github.com/apache/incubator-apisix/pull/1370#discussion_r400053007
 
 

 ##########
 File path: lua/apisix/plugins/zipkin.lua
 ##########
 @@ -42,6 +47,20 @@ local _M = {
     schema = schema,
 }
 
+local function excute_cmd(cmd)
+    local t, err = io.popen(cmd)
+    if not t then
+        return nil, "failed to execute command: " .. cmd .. ", error info:" .. err
+    end
+    local data = t:read("*all")
+    t:close()
+    return data
+end
+
+local LOCAL_SERVER_IP,_ = excute_cmd("hostname -I | awk '{print $1}'")
 
 Review comment:
   how about nginx var `server_addr`?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-apisix] lilien1010 closed pull request #1370: enhance: plugin Zipkin add service name and report local server IP

Posted by GitBox <gi...@apache.org>.
lilien1010 closed pull request #1370: enhance: plugin Zipkin add service name and report local server IP
URL: https://github.com/apache/incubator-apisix/pull/1370
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-apisix] moonming commented on a change in pull request #1370: enhance: plugin Zipkin add service name and report local server IP

Posted by GitBox <gi...@apache.org>.
moonming commented on a change in pull request #1370: enhance: plugin Zipkin add service name and report local server IP
URL: https://github.com/apache/incubator-apisix/pull/1370#discussion_r401346020
 
 

 ##########
 File path: lua/apisix/plugins/zipkin.lua
 ##########
 @@ -29,7 +29,17 @@ local schema = {
     type = "object",
     properties = {
         endpoint = {type = "string"},
-        sample_ratio = {type = "number", minimum = 0.00001, maximum = 1}
+        sample_ratio = {type = "number", minimum = 0.00001, maximum = 1},
+        service_name = {
+            type = "string",
+            description = "service name for zipkin reporter",
+            default = "APISIX",
+        },
+        server_addr = {
 
 Review comment:
   need add doc for `server_addr`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-apisix] lilien1010 commented on a change in pull request #1370: enhance: plugin Zipkin add service name and report local server IP

Posted by GitBox <gi...@apache.org>.
lilien1010 commented on a change in pull request #1370: enhance: plugin Zipkin add service name and report local server IP
URL: https://github.com/apache/incubator-apisix/pull/1370#discussion_r400664895
 
 

 ##########
 File path: doc/plugins/zipkin-cn.md
 ##########
 @@ -118,3 +120,45 @@ $ curl http://127.0.0.1:2379/v2/keys/apisix/routes/1 -X PUT -d value='
 ```
 
 现在就已经移除了 Zipkin 插件了。其他插件的开启和移除也是同样的方法。
+
+
+## 上游服务是Golang的示例代码
+
+```golang
+
 
 Review comment:
   sure

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-apisix] lilien1010 commented on a change in pull request #1370: enhance: plugin Zipkin add service name and report local server IP

Posted by GitBox <gi...@apache.org>.
lilien1010 commented on a change in pull request #1370: enhance: plugin Zipkin add service name and report local server IP
URL: https://github.com/apache/incubator-apisix/pull/1370#discussion_r401348100
 
 

 ##########
 File path: lua/apisix/plugins/zipkin.lua
 ##########
 @@ -29,7 +29,17 @@ local schema = {
     type = "object",
     properties = {
         endpoint = {type = "string"},
-        sample_ratio = {type = "number", minimum = 0.00001, maximum = 1}
+        sample_ratio = {type = "number", minimum = 0.00001, maximum = 1},
+        service_name = {
+            type = "string",
+            description = "service name for zipkin reporter",
+            default = "APISIX",
+        },
+        server_addr = {
 
 Review comment:
   sure

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-apisix] lilien1010 commented on a change in pull request #1370: enhance: plugin Zipkin add service name and report local server IP

Posted by GitBox <gi...@apache.org>.
lilien1010 commented on a change in pull request #1370: enhance: plugin Zipkin add service name and report local server IP
URL: https://github.com/apache/incubator-apisix/pull/1370#discussion_r400587909
 
 

 ##########
 File path: doc/plugins/zipkin-cn.md
 ##########
 @@ -34,8 +34,9 @@
 
 ## 属性
 
-* `endpoint`: Ziplin 的 http 节点,例如`http://127.0.0.1:9411/api/v2/spans`。
+* `endpoint`: Zipkin 的 http 节点,例如`http://127.0.0.1:9411/api/v2/spans`。
 * `sample_ratio`: 监听的比例,最小为0.00001,最大为1。
+* `service_name`: 可选参数,标记当前服务的名称,默认是APISIX。
 
 Review comment:
   change all to `APISIX`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-apisix] lilien1010 commented on a change in pull request #1370: enhance: plugin Zipkin add service name and report local server IP

Posted by GitBox <gi...@apache.org>.
lilien1010 commented on a change in pull request #1370: enhance: plugin Zipkin add service name and report local server IP
URL: https://github.com/apache/incubator-apisix/pull/1370#discussion_r400664423
 
 

 ##########
 File path: lua/apisix/plugins/zipkin.lua
 ##########
 @@ -131,6 +144,9 @@ function _M.access(conf, ctx)
     opentracing.proxy_span = opentracing.request_span:start_child_span(
             "apisix.proxy", ctx.ACCESS_END_TIME)
 
+    opentracing.proxy_span:set_tag("peer.service", conf.service_name)
 
 Review comment:
   sure I am adding more test cases

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-apisix] lilien1010 commented on a change in pull request #1370: enhance: plugin Zipkin add service name and report local server IP

Posted by GitBox <gi...@apache.org>.
lilien1010 commented on a change in pull request #1370: enhance: plugin Zipkin add service name and report local server IP
URL: https://github.com/apache/incubator-apisix/pull/1370#discussion_r400074628
 
 

 ##########
 File path: lua/apisix/plugins/zipkin.lua
 ##########
 @@ -109,6 +130,10 @@ function _M.rewrite(conf, ctx)
     local request_span = ctx.opentracing.request_span
     ctx.opentracing.rewrite_span = request_span:start_child_span(
                                             "apisix.rewrite", start_timestamp)
+
+    ctx.opentracing.rewrite_span:set_tag("peer.service",conf.service_name)
 
 Review comment:
   done

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-apisix] membphis commented on a change in pull request #1370: enhance: plugin Zipkin add service name and report local server IP

Posted by GitBox <gi...@apache.org>.
membphis commented on a change in pull request #1370: enhance: plugin Zipkin add service name and report local server IP
URL: https://github.com/apache/incubator-apisix/pull/1370#discussion_r400630065
 
 

 ##########
 File path: doc/plugins/zipkin-cn.md
 ##########
 @@ -118,3 +120,45 @@ $ curl http://127.0.0.1:2379/v2/keys/apisix/routes/1 -X PUT -d value='
 ```
 
 现在就已经移除了 Zipkin 插件了。其他插件的开启和移除也是同样的方法。
+
+
+## 上游服务是Golang的示例代码
+
+```golang
+
 
 Review comment:
   remove this useless line

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-apisix] moonming commented on a change in pull request #1370: enhance: plugin Zipkin add service name and report local server IP

Posted by GitBox <gi...@apache.org>.
moonming commented on a change in pull request #1370: enhance: plugin Zipkin add service name and report local server IP
URL: https://github.com/apache/incubator-apisix/pull/1370#discussion_r400606628
 
 

 ##########
 File path: lua/apisix/plugins/zipkin.lua
 ##########
 @@ -94,6 +99,8 @@ function _M.rewrite(conf, ctx)
              -- TODO: support ipv6
             ["peer.ipv4"] = core.request.get_remote_client_ip(ctx),
             ["peer.port"] = core.request.get_remote_client_port(ctx),
+            ["peer.service"] = conf.service_name,
+            ["local.ip"] = ctx.var.server_addr,
 
 Review comment:
   can we add test cases for that?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-apisix] moonming commented on a change in pull request #1370: enhance: plugin Zipkin add service name and report local server IP

Posted by GitBox <gi...@apache.org>.
moonming commented on a change in pull request #1370: enhance: plugin Zipkin add service name and report local server IP
URL: https://github.com/apache/incubator-apisix/pull/1370#discussion_r400606384
 
 

 ##########
 File path: lua/apisix/plugins/zipkin.lua
 ##########
 @@ -29,7 +29,12 @@ local schema = {
     type = "object",
     properties = {
         endpoint = {type = "string"},
-        sample_ratio = {type = "number", minimum = 0.00001, maximum = 1}
+        sample_ratio = {type = "number", minimum = 0.00001, maximum = 1},
+        service_name = {
+            type = "string",
+            description = "service name for zipkin reporter",
+            default = {"APISIX"},
 
 Review comment:
   should not has `{` and `}`, right?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-apisix] moonming commented on a change in pull request #1370: enhance: plugin Zipkin add service name and report local server IP

Posted by GitBox <gi...@apache.org>.
moonming commented on a change in pull request #1370: enhance: plugin Zipkin add service name and report local server IP
URL: https://github.com/apache/incubator-apisix/pull/1370#discussion_r400254069
 
 

 ##########
 File path: doc/plugins/zipkin-cn.md
 ##########
 @@ -34,8 +34,9 @@
 
 ## 属性
 
-* `endpoint`: Ziplin 的 http 节点,例如`http://127.0.0.1:9411/api/v2/spans`。
+* `endpoint`: Zipkin 的 http 节点,例如`http://127.0.0.1:9411/api/v2/spans`。
 * `sample_ratio`: 监听的比例,最小为0.00001,最大为1。
+* `service_name`: 可选参数,标记当前服务的名称,默认是APISIX。
 
 Review comment:
   `apisix` in Lua code

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-apisix] lilien1010 opened a new pull request #1370: enhance: plugin Zipkin add service name and report local server IP

Posted by GitBox <gi...@apache.org>.
lilien1010 opened a new pull request #1370: enhance: plugin Zipkin add service name and report local server IP
URL: https://github.com/apache/incubator-apisix/pull/1370
 
 
   
   ### Summary
   
   allow zipkin to set servie name so that we can track it in APM system
   
   ### Full changelog
   
   * plugins/zipkin.lua
   * plugins/zipkin/reporter.lua
   * t/plugin/zipkin.t
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-apisix] moonming commented on a change in pull request #1370: enhance: plugin Zipkin add service name and report local server IP

Posted by GitBox <gi...@apache.org>.
moonming commented on a change in pull request #1370: enhance: plugin Zipkin add service name and report local server IP
URL: https://github.com/apache/incubator-apisix/pull/1370#discussion_r400053650
 
 

 ##########
 File path: lua/apisix/plugins/zipkin.lua
 ##########
 @@ -109,6 +130,10 @@ function _M.rewrite(conf, ctx)
     local request_span = ctx.opentracing.request_span
     ctx.opentracing.rewrite_span = request_span:start_child_span(
                                             "apisix.rewrite", start_timestamp)
+
+    ctx.opentracing.rewrite_span:set_tag("peer.service",conf.service_name)
 
 Review comment:
   add space after comma

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-apisix] lilien1010 commented on a change in pull request #1370: enhance: plugin Zipkin add service name and report local server IP

Posted by GitBox <gi...@apache.org>.
lilien1010 commented on a change in pull request #1370: enhance: plugin Zipkin add service name and report local server IP
URL: https://github.com/apache/incubator-apisix/pull/1370#discussion_r400665182
 
 

 ##########
 File path: lua/apisix/plugins/zipkin.lua
 ##########
 @@ -29,7 +29,12 @@ local schema = {
     type = "object",
     properties = {
         endpoint = {type = "string"},
-        sample_ratio = {type = "number", minimum = 0.00001, maximum = 1}
+        sample_ratio = {type = "number", minimum = 0.00001, maximum = 1},
+        service_name = {
+            type = "string",
+            description = "service name for zipkin reporter",
+            default = {"APISIX"},
 
 Review comment:
   fixed

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-apisix] lilien1010 commented on a change in pull request #1370: enhance: plugin Zipkin add service name and report local server IP

Posted by GitBox <gi...@apache.org>.
lilien1010 commented on a change in pull request #1370: enhance: plugin Zipkin add service name and report local server IP
URL: https://github.com/apache/incubator-apisix/pull/1370#discussion_r400587821
 
 

 ##########
 File path: doc/plugins/zipkin.md
 ##########
 @@ -39,6 +39,7 @@ It's also works with `Apache SkyWalking`, which is support Zipkin v1/v2 format.
 |---------     |--------|-----------|
 | endpoint     |required|the http endpoint of Ziplin, for example: `http://127.0.0.1:9411/api/v2/spans`.|
 | sample_ratio |required|the ratio of sample, the minimum is 0.00001, the maximum is 1.|
+| service_name |optional|service name for zipkin reporter.|
 
 Review comment:
   done

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-apisix] lilien1010 closed pull request #1370: enhance: plugin Zipkin add service name and report local server IP

Posted by GitBox <gi...@apache.org>.
lilien1010 closed pull request #1370: enhance: plugin Zipkin add service name and report local server IP
URL: https://github.com/apache/incubator-apisix/pull/1370
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-apisix] moonming commented on a change in pull request #1370: enhance: plugin Zipkin add service name and report local server IP

Posted by GitBox <gi...@apache.org>.
moonming commented on a change in pull request #1370: enhance: plugin Zipkin add service name and report local server IP
URL: https://github.com/apache/incubator-apisix/pull/1370#discussion_r401345965
 
 

 ##########
 File path: lua/apisix/plugins/zipkin.lua
 ##########
 @@ -29,7 +29,17 @@ local schema = {
     type = "object",
     properties = {
         endpoint = {type = "string"},
-        sample_ratio = {type = "number", minimum = 0.00001, maximum = 1}
+        sample_ratio = {type = "number", minimum = 0.00001, maximum = 1},
+        service_name = {
+            type = "string",
+            description = "service name for zipkin reporter",
+            default = "APISIX",
+        },
+        server_addr = {
 
 Review comment:
   need add doc for `server_addr`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-apisix] lilien1010 commented on a change in pull request #1370: enhance: plugin Zipkin add service name and report local server IP

Posted by GitBox <gi...@apache.org>.
lilien1010 commented on a change in pull request #1370: enhance: plugin Zipkin add service name and report local server IP
URL: https://github.com/apache/incubator-apisix/pull/1370#discussion_r400074516
 
 

 ##########
 File path: t/plugin/zipkin.t
 ##########
 @@ -126,7 +126,8 @@ done
                         "plugins": {
                             "zipkin": {
                                 "endpoint": "http://127.0.0.1:1982/mock_zipkin",
-                                "sample_ratio": 1
+                                "sample_ratio": 1,
+                                "service_name":"APISIX"
 
 Review comment:
   done

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-apisix] membphis commented on a change in pull request #1370: enhance: plugin Zipkin add service name and report local server IP

Posted by GitBox <gi...@apache.org>.
membphis commented on a change in pull request #1370: enhance: plugin Zipkin add service name and report local server IP
URL: https://github.com/apache/incubator-apisix/pull/1370#discussion_r400630003
 
 

 ##########
 File path: lua/apisix/plugins/zipkin.lua
 ##########
 @@ -131,6 +144,9 @@ function _M.access(conf, ctx)
     opentracing.proxy_span = opentracing.request_span:start_child_span(
             "apisix.proxy", ctx.ACCESS_END_TIME)
 
+    opentracing.proxy_span:set_tag("peer.service", conf.service_name)
 
 Review comment:
   do we need a  test case to confirm this?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-apisix] lilien1010 commented on a change in pull request #1370: enhance: plugin Zipkin add service name and report local server IP

Posted by GitBox <gi...@apache.org>.
lilien1010 commented on a change in pull request #1370: enhance: plugin Zipkin add service name and report local server IP
URL: https://github.com/apache/incubator-apisix/pull/1370#discussion_r400074432
 
 

 ##########
 File path: lua/apisix/plugins/zipkin.lua
 ##########
 @@ -42,6 +47,20 @@ local _M = {
     schema = schema,
 }
 
+local function excute_cmd(cmd)
+    local t, err = io.popen(cmd)
+    if not t then
+        return nil, "failed to execute command: " .. cmd .. ", error info:" .. err
+    end
+    local data = t:read("*all")
+    t:close()
+    return data
+end
+
+local LOCAL_SERVER_IP,_ = excute_cmd("hostname -I | awk '{print $1}'")
 
 Review comment:
   changed into ctx.server_addr

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-apisix] lilien1010 commented on a change in pull request #1370: enhance: plugin Zipkin add service name and report local server IP

Posted by GitBox <gi...@apache.org>.
lilien1010 commented on a change in pull request #1370: enhance: plugin Zipkin add service name and report local server IP
URL: https://github.com/apache/incubator-apisix/pull/1370#discussion_r400664408
 
 

 ##########
 File path: lua/apisix/plugins/zipkin.lua
 ##########
 @@ -94,6 +99,8 @@ function _M.rewrite(conf, ctx)
              -- TODO: support ipv6
             ["peer.ipv4"] = core.request.get_remote_client_ip(ctx),
             ["peer.port"] = core.request.get_remote_client_port(ctx),
+            ["peer.service"] = conf.service_name,
+            ["local.ip"] = ctx.var.server_addr,
 
 Review comment:
   sure I am adding more test cases

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-apisix] moonming commented on a change in pull request #1370: enhance: plugin Zipkin add service name and report local server IP

Posted by GitBox <gi...@apache.org>.
moonming commented on a change in pull request #1370: enhance: plugin Zipkin add service name and report local server IP
URL: https://github.com/apache/incubator-apisix/pull/1370#discussion_r400253322
 
 

 ##########
 File path: doc/plugins/zipkin.md
 ##########
 @@ -39,6 +39,7 @@ It's also works with `Apache SkyWalking`, which is support Zipkin v1/v2 format.
 |---------     |--------|-----------|
 | endpoint     |required|the http endpoint of Ziplin, for example: `http://127.0.0.1:9411/api/v2/spans`.|
 | sample_ratio |required|the ratio of sample, the minimum is 0.00001, the maximum is 1.|
+| service_name |optional|service name for zipkin reporter.|
 
 Review comment:
   no default value?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services