Skip to content

Commit

Permalink
changes for unable to start proxy automatically error (#346)
Browse files Browse the repository at this point in the history
  • Loading branch information
aryanishan1001 authored Dec 6, 2023
1 parent 130c6e6 commit 8a6eff5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions instrumentation/otel-webserver-module/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ Currently, Nginx Webserver module monitores some fixed set of modules, which get
|*NginxModuleRequestHeaders* | | OPTIONAL: Specify the request headers to be captured in the span attributes. The headers are Case-Sensitive and should be comma-separated. e.g.```NginxModuleRequestHeaders Accept-Charset,Accept-Encoding,User-Agent;```|
|*NginxModuleResponseHeaders* | | OPTIONAL: Specify the response headers to be captured in the span attributes. The headers are Case-Sensitive and should be comma-separated. e.g.```NginxModuleResponseHeaders Content-Length,Content-Type;```|
|*NginxModuleOtelExporterOtlpHeaders* | | OPTIONAL: OTEL exporter headers like Meta data related exposrted end point. a list of key value pairs, and these are expected to be represented in a format matching to the W3C Correlation-Context, except that additional semi-colon delimited metadata is not supported, i.e.: key1=value1,key2=value2.|
|*NginxTrustIncomingSpans* | ON | OPTIONAL: Specify if you want to correlate Nginx instrumented traces and spans with incoming requests.|

### Build and Installation
#### Prerequisites
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,13 @@ static ngx_command_t ngx_http_opentelemetry_commands[] = {
NGX_HTTP_LOC_CONF_OFFSET,
offsetof(ngx_http_opentelemetry_loc_conf_t, nginxModuleResponseHeaders),
NULL},

{ ngx_string("NginxTrustIncomingSpans"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
ngx_conf_set_flag_slot,
NGX_HTTP_LOC_CONF_OFFSET,
offsetof(ngx_http_opentelemetry_loc_conf_t, nginxTrustIncomingSpans),
NULL},

ngx_null_command /* command termination */
};
Expand Down Expand Up @@ -437,6 +444,7 @@ static void* ngx_http_opentelemetry_create_loc_conf(ngx_conf_t *cf)
conf->nginxModuleTraceAsError = NGX_CONF_UNSET;
conf->nginxModuleOtelMaxQueueSize = NGX_CONF_UNSET;
conf->nginxModuleOtelSslEnabled = NGX_CONF_UNSET;
conf->nginxTrustIncomingSpans = NGX_CONF_UNSET;

return conf;
}
Expand All @@ -453,6 +461,8 @@ static char* ngx_http_opentelemetry_merge_loc_conf(ngx_conf_t *cf, void *parent,
ngx_conf_merge_value(conf->nginxModuleTraceAsError, prev->nginxModuleTraceAsError, 0);
ngx_conf_merge_value(conf->nginxModuleMaskCookie, prev->nginxModuleMaskCookie, 0);
ngx_conf_merge_value(conf->nginxModuleMaskSmUser, prev->nginxModuleMaskSmUser, 0);
ngx_conf_merge_value(conf->nginxTrustIncomingSpans, prev->nginxTrustIncomingSpans, 1);


ngx_conf_merge_str_value(conf->nginxModuleOtelSpanExporter, prev->nginxModuleOtelSpanExporter, "");
ngx_conf_merge_str_value(conf->nginxModuleOtelExporterEndpoint, prev->nginxModuleOtelExporterEndpoint, "");
Expand Down Expand Up @@ -1637,7 +1647,7 @@ static void fillRequestPayload(request_payload* req_payload, ngx_http_request_t*
for (ngx_uint_t j = 0; j < nelts; j++) {

h = &header[j];
for (int i = 0; i < headers_len; i++) {
for (int i = 0; i < headers_len && conf->nginxTrustIncomingSpans ; i++) {

if (strcmp(h->key.data, httpHeaders[i]) == 0) {
req_payload->propagation_headers[propagation_headers_idx].name = httpHeaders[i];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ typedef struct {
ngx_str_t nginxModuleRequestHeaders;
ngx_str_t nginxModuleResponseHeaders;
ngx_str_t nginxModuleOtelExporterOtlpHeaders;
ngx_flag_t nginxTrustIncomingSpans;

} ngx_http_opentelemetry_loc_conf_t;

/*
Expand Down

0 comments on commit 8a6eff5

Please sign in to comment.