You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So I created a lua plugin and use the log_by_lua block. However, the nginx variables are not set.
My code is:
-- simplified, it's actually called by the ingress-nginx plugin system, but the plugin is called from within log_by_lualog_by_lua_block {
localtrace_id=ngx.var.opentelemetry_trace_idlocalspan_id=ngx.var.opentelemetry_span_id-- do the transformation according to the datadog documentationngx.var.trace_id=trace_idngx.var.span_id=span_id
}
I then access it in my logs via the $span_id and $trace_id variables.
However, ngx.var.opentelemetry_trace_id and ngx.var.opentelemetry_span_id is always nil.
If I manually set the variables like local trace_id='somevalue' it prints the correct value in the log.
is log_by_lua_block the correct place to get the values? When are they actually set by the plugin?
is ngx.var.opentelemetry_trace_id the place where I can find the variable? I also looked at ngx.ctx but couldn't find anything there.
The text was updated successfully, but these errors were encountered:
I am using it with ingress-nginx (v 1.9.5) and have it set up like in the documentation: https://kubernetes.github.io/ingress-nginx/user-guide/third-party-addons/opentelemetry/
Unfortunately, to correlate the logs and traces with datadog, one needs to transform the log and span ids like described here:
https://docs.datadoghq.com/tracing/other_telemetry/connect_logs_and_traces/opentelemetry/?tab=python
So I created a lua plugin and use the log_by_lua block. However, the nginx variables are not set.
My code is:
I then access it in my logs via the
$span_id
and$trace_id
variables.However,
ngx.var.opentelemetry_trace_id
andngx.var.opentelemetry_span_id
is alwaysnil
.If I manually set the variables like
local trace_id='somevalue'
it prints the correct value in the log.log_by_lua_block
the correct place to get the values? When are they actually set by the plugin?ngx.var.opentelemetry_trace_id
the place where I can find the variable? I also looked atngx.ctx
but couldn't find anything there.The text was updated successfully, but these errors were encountered: