kezhenxu94 commented on code in PR #104:
URL:
https://github.com/apache/skywalking-nginx-lua/pull/104#discussion_r854891407
##########
lib/skywalking/tracing_context.lua:
##########
@@ -109,14 +109,21 @@ function _M.newNoOP()
return {is_noop = true}
end
-function _M.new(serviceName, serviceInstanceName)
+function _M.new(serviceName, serviceInstanceName, requestId)
if serviceInstanceName == nil or serviceName == nil then
return _M.newNoOP()
end
+ -- use request_id as trace_id if it is present
+ local trace_id = Util.newID()
+ local segment_id = trace_id
+ if requestId ~= nil then
+ trace_id = requestId
+ end
Review Comment:
`Util.newID()` is not free so it'd better only invoke it when necessary
```suggestion
local trace_id = requestId
if trace_id == nil then
trace_id = Util.newID()
end
local segment_id = trace_id
```
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]