yangxikun commented on code in PR #8834:
URL: https://github.com/apache/apisix/pull/8834#discussion_r1103730459
##########
apisix/plugins/opentelemetry.lua:
##########
@@ -333,6 +333,12 @@ function _M.rewrite(conf, api_ctx)
kind = span_kind.server,
attributes = attributes,
})
+
+ local span_context = ctx.sp:context()
Review Comment:
use `ctx:span():context()`
##########
apisix/plugins/opentelemetry.lua:
##########
@@ -333,6 +333,12 @@ function _M.rewrite(conf, api_ctx)
kind = span_kind.server,
attributes = attributes,
})
+
+ local span_context = ctx.sp:context()
+ ngx.var.opentelemetry_context_traceparent =
string.format("00-%s-%s-%02x",span_context.trace_id, span_context.span_id,
span_context.trace_flags)
Review Comment:
missing space before span_context.trace_id
##########
apisix/plugins/opentelemetry.lua:
##########
@@ -333,6 +333,12 @@ function _M.rewrite(conf, api_ctx)
kind = span_kind.server,
attributes = attributes,
})
+
+ local span_context = ctx.sp:context()
+ ngx.var.opentelemetry_context_traceparent =
string.format("00-%s-%s-%02x",span_context.trace_id, span_context.span_id,
span_context.trace_flags)
+ ngx.var.opentelemetry_trace_id = span_context.trace_id
+ ngx.var.opentelemetry_span_id = span_context.span_id
Review Comment:
We should add a bool field `set_ngx_var`(default false) in opentelemetry
attr_schema, so user can enable/disable it, and keep backward compatibility.
--
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]