-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature to add Nginx variables related to tracing context #416
Feature to add Nginx variables related to tracing context #416
Conversation
@@ -863,7 +990,7 @@ static OTEL_SDK_STATUS_CODE otel_startInteraction(ngx_http_request_t* r, const c | |||
{ | |||
resolveBackends = conf->nginxModuleResolveBackends; | |||
} | |||
OTEL_SDK_ENV_RECORD* propagationHeaders = ngx_pcalloc(r->pool, 5 * sizeof(OTEL_SDK_ENV_RECORD)); | |||
OTEL_SDK_ENV_RECORD* propagationHeaders = ngx_pcalloc(r->pool, 6 * sizeof(OTEL_SDK_ENV_RECORD)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have some variable instead of magic number?
@@ -894,6 +1022,113 @@ static OTEL_SDK_STATUS_CODE otel_startInteraction(ngx_http_request_t* r, const c | |||
} | |||
return res; | |||
} | |||
static void otel_variables_decorator(ngx_http_request_t* r){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add some comments on what we are trying to achieve here? Because the code seems complex and not very intuitive to understand?
ngx_uint_t key; // The variable's hashed key. | ||
ngx_http_variable_value_t *value; // Pointer to the value object. | ||
|
||
if(var_name.data[0] == '$'){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the meaning of dollar? Is it delimiter? Please add some varieable and use it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'$' is used to identify Nginx Variables, as they have to start woth '$' sign. Will a comment work here ?
Fixes #415
Added 4 nginx variables $opentelemetry_trace_id, $opentelemetry_span_id, $opentelemetry_context_traceparent, $opentelemetry_context_b3 which can be accessed from the .conf files and can be used as needed.