leslie-tsang commented on code in PR #8871:
URL: https://github.com/apache/apisix/pull/8871#discussion_r1333213338
##########
apisix/plugins/opentelemetry.lua:
##########
@@ -112,6 +113,11 @@ local attr_schema = {
},
default = {},
},
+ set_ngx_var = {
+ type = "boolean",
+ description = "set nginx variables",
+ default = false,
+ },
Review Comment:
```suggestion
set_ngx_var = {
type = "boolean",
description = "set nginx variables",
default = false,
},
```
##########
apisix/plugins/opentelemetry.lua:
##########
@@ -332,6 +338,17 @@ function _M.rewrite(conf, api_ctx)
kind = span_kind.server,
attributes = attributes,
})
+
+ if plugin_info.set_ngx_var then
+ local span_context = ctx:span():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:
Would be better to use `ctx.var` instead ?
--
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]