You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2020/02/22 16:04:46 UTC
[skywalking-nginx-lua] branch master updated: Refactor tracing.lua
to client.lua
This is an automated email from the ASF dual-hosted git repository.
wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking-nginx-lua.git
The following commit(s) were added to refs/heads/master by this push:
new 7299e25 Refactor tracing.lua to client.lua
7299e25 is described below
commit 7299e25f35369a1281ad9f8cc68ec3aeb8febf41
Author: Wu Sheng <wu...@foxmail.com>
AuthorDate: Sun Feb 23 00:04:33 2020 +0800
Refactor tracing.lua to client.lua
---
examples/nginx.conf | 2 +-
lib/skywalking/{tracing.lua => client.lua} | 15 +++++++++++----
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/examples/nginx.conf b/examples/nginx.conf
index 00522bb..77b7eac 100644
--- a/examples/nginx.conf
+++ b/examples/nginx.conf
@@ -36,7 +36,7 @@ http {
local metadata_buffer = ngx.shared.metadata_buffer
metadata_buffer['serviceName'] = 'Service Name'
- require("tracing"):startTimer(metadata_buffer, "http://127.0.0.1:8080/skywalking")
+ require("client"):startTimer(metadata_buffer, "http://127.0.0.1:8080/skywalking")
}
server {
diff --git a/lib/skywalking/tracing.lua b/lib/skywalking/client.lua
similarity index 86%
rename from lib/skywalking/tracing.lua
rename to lib/skywalking/client.lua
index bc98370..48bba96 100644
--- a/lib/skywalking/tracing.lua
+++ b/lib/skywalking/client.lua
@@ -15,11 +15,11 @@
-- limitations under the License.
--
-local Tracing = {}
+local Client = {}
-- Tracing timer does the service and instance register
-- After register successfully, it sends traces and heart beat
-function Tracing:startTimer(metadata_buffer, backend_http_uri)
+function Client:startTimer(metadata_buffer, backend_http_uri)
-- The codes of timer setup is following the OpenResty timer doc
local delay = 3 -- in seconds
local new_timer = ngx.timer.at
@@ -34,6 +34,13 @@ function Tracing:startTimer(metadata_buffer, backend_http_uri)
self:registerService(metadata_buffer, backend_http_uri)
end
+ -- Register is in the async way, if register successfully, go for instance register
+ if metadata_buffer['serviceId'] ~= nil then
+ if metadata_buffer['serviceInstId'] == nil then
+
+ end
+ end
+
-- do the health check
local ok, err = new_timer(delay, check)
if not ok then
@@ -53,7 +60,7 @@ function Tracing:startTimer(metadata_buffer, backend_http_uri)
end
-- Register service
-function Tracing:registerService(metadata_buffer, backend_http_uri)
+function Client:registerService(metadata_buffer, backend_http_uri)
local log = ngx.log
local DEBUG = ngx.DEBUG
@@ -86,4 +93,4 @@ function Tracing:registerService(metadata_buffer, backend_http_uri)
end
end
-return Tracing
\ No newline at end of file
+return Client
\ No newline at end of file