Skip to content
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

Merged

Conversation

aryanishan1001
Copy link
Contributor

@aryanishan1001 aryanishan1001 commented Apr 2, 2024

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.

@marcalff marcalff added the Webserver This represents the otel-webserver-module in the instrumentation directory label Apr 13, 2024
@@ -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));
Copy link
Member

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){
Copy link
Member

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] == '$'){
Copy link
Member

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

Copy link
Contributor Author

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 ?

@DebajitDas DebajitDas merged commit b756753 into open-telemetry:main Apr 29, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Webserver This represents the otel-webserver-module in the instrumentation directory
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature to add nginx variables to access tracing context information
3 participants