You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2022/04/21 07:55:03 UTC
[GitHub] [skywalking-nginx-lua] kezhenxu94 commented on a diff in pull request #104: support to try to use request-id as trace-id when trace context absent
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: notifications-unsubscribe@skywalking.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org