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 12:52:17 UTC
[skywalking-nginx-lua] branch master updated (3d81e04 -> 16c28e3)
This is an automated email from the ASF dual-hosted git repository.
wusheng pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking-nginx-lua.git.
from 3d81e04 Fix CI
new 120b63f Use old cjson version in CI.
new c21619d Try lua json
new 16c28e3 Try CI
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.github/workflows/ci.yaml | 2 +-
lib/skywalking/segment.lua | 32 ++++++++++++++++++++++++++++----
lib/skywalking/span_test.lua | 5 -----
lib/skywalking/tracing_context_test.lua | 2 ++
4 files changed, 31 insertions(+), 10 deletions(-)
[skywalking-nginx-lua] 03/03: Try CI
Posted by wu...@apache.org.
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
commit 16c28e39a0316316c5e46f710d95b4109aa98fb8
Author: Wu Sheng <wu...@foxmail.com>
AuthorDate: Sat Feb 22 20:52:07 2020 +0800
Try CI
---
.github/workflows/ci.yaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index e0ff8c0..05972cf 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -48,7 +48,7 @@ jobs:
- name: 'Install Dependencies'
run: |
sudo luarocks install luaunit
- sudo luarocks install lua-cjson
+ sudo luarocks install lua-cjson 2.1.0-1
- name: 'Run Tests'
run: |
cd lib/skywalking
[skywalking-nginx-lua] 02/03: Try lua json
Posted by wu...@apache.org.
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
commit c21619debcd840aa226f9bdcee4e7505d9e0aaf1
Author: Wu Sheng <wu...@foxmail.com>
AuthorDate: Sat Feb 22 20:50:55 2020 +0800
Try lua json
---
.github/workflows/ci.yaml | 2 +-
lib/skywalking/segment.lua | 32 ++++++++++++++++++++++++++++----
lib/skywalking/span_test.lua | 5 -----
lib/skywalking/tracing_context_test.lua | 2 ++
4 files changed, 31 insertions(+), 10 deletions(-)
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 05972cf..e0ff8c0 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -48,7 +48,7 @@ jobs:
- name: 'Install Dependencies'
run: |
sudo luarocks install luaunit
- sudo luarocks install lua-cjson 2.1.0-1
+ sudo luarocks install lua-cjson
- name: 'Run Tests'
run: |
cd lib/skywalking
diff --git a/lib/skywalking/segment.lua b/lib/skywalking/segment.lua
index 3249c24..ea870e4 100644
--- a/lib/skywalking/segment.lua
+++ b/lib/skywalking/segment.lua
@@ -17,8 +17,7 @@
-- Segment represents a finished tracing context
-- Including all information to send to the SkyWalking OAP server.
-
-local cjson = require("cjson")
+local Util = require('util')
local Segment = {
trace_id,
@@ -33,6 +32,8 @@ local Segment = {
-- Following SkyWalking official trace protocol v2
-- https://github.com/apache/skywalking-data-collect-protocol/blob/master/language-agent-v2/trace.proto
local SegmentProtocol = {
+ globalTraceIds,
+ traceSegmentId,
serviceId,
serviceInstanceId,
spans,
@@ -46,9 +47,32 @@ function Segment:new()
return o
end
--- Transform the segment object to the
+function SegmentProtocol:new()
+ local o = {}
+ setmetatable(o, self)
+ self.__index = self
+
+ o.globalTraceIds = {}
+
+ return o
+end
+
+-- Return SegmentProtocol
function Segment:transform()
- return cjson.encode(self)
+ local segmentBuilder = SegmentProtocol:new()
+ segmentBuilder.serviceId = self.service_id
+ segmentBuilder.globalTraceIds[1] = Util:id2String(self.trace_id)
+ segmentBuilder.traceSegmentId = Util:id2String(self.segment_id)
+ segmentBuilder.serviceId = self.service_id
+ segmentBuilder.serviceInstanceId = self.service_inst_id
+
+ segmentBuilder.spans = {}
+ for i, span in ipairs(self.spans)
+ do
+ segmentBuilder.spans[#segmentBuilder.spans + 1] = span:transform()
+ end
+
+ return segmentBuilder
end
return Segment
\ No newline at end of file
diff --git a/lib/skywalking/span_test.lua b/lib/skywalking/span_test.lua
index 5ed2ffa..a2265e0 100644
--- a/lib/skywalking/span_test.lua
+++ b/lib/skywalking/span_test.lua
@@ -19,7 +19,6 @@ local lu = require('luaunit')
local TC = require('tracing_context')
local Span = require('span')
local SpanLayer = require("span_layer")
-local cjson = require("cjson")
TestSpan = {}
function TestSpan:testNewEntry()
@@ -142,10 +141,6 @@ TestSpan = {}
lu.assertEquals(#spanBuilder.logs, 1)
lu.assertEquals(spanBuilder.logs[1].data["logkey"], "logvalue")
lu.assertEquals(spanBuilder.logs[1].data["logkey1"], "logvalue2")
-
- local inJSON = cjson.encode(spanBuilder)
- lu.assertTrue(string.len(inJSON) > 0)
- -- print(inJSON)
end
-- end TestSpan
diff --git a/lib/skywalking/tracing_context_test.lua b/lib/skywalking/tracing_context_test.lua
index 63b47ad..d0c0dd1 100644
--- a/lib/skywalking/tracing_context_test.lua
+++ b/lib/skywalking/tracing_context_test.lua
@@ -69,6 +69,8 @@ TestTracingContext = {}
local isSegmentFinished, segment = context:drainAfterFinished()
lu.assertEquals(span2, segment.spans[1])
lu.assertEquals(span1, segment.spans[2])
+
+ local segmentBuilder = segment:transform()
end
function TestTracingContext:testNewNoOP()
[skywalking-nginx-lua] 01/03: Use old cjson version in CI.
Posted by wu...@apache.org.
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
commit 120b63fa69bef5f3eb078fa42645580bab492159
Author: Wu Sheng <wu...@foxmail.com>
AuthorDate: Sat Feb 22 18:06:13 2020 +0800
Use old cjson version in CI.
---
.github/workflows/ci.yaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index e0ff8c0..05972cf 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -48,7 +48,7 @@ jobs:
- name: 'Install Dependencies'
run: |
sudo luarocks install luaunit
- sudo luarocks install lua-cjson
+ sudo luarocks install lua-cjson 2.1.0-1
- name: 'Run Tests'
run: |
cd lib/skywalking