Skip to content

Commit 19d9968

Browse files
authored
Update ngx_http_opentelemetry_module.c
Fix logging unnecessary errors
1 parent fd0554b commit 19d9968

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

instrumentation/otel-webserver-module/src/nginx/ngx_http_opentelemetry_module.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -696,15 +696,15 @@ static ngx_int_t ngx_http_opentelemetry_init(ngx_conf_t *cf)
696696
ngx_uint_t phase_index;
697697
ngx_int_t res;
698698

699-
ngx_writeError(cf->cycle->log, __func__, "Starting Opentelemetry Module init");
699+
ngx_writeTrace(cf->cycle->log, __func__, "Starting Opentelemetry Module init"); // Log only with tracing
700700

701701
cp = ap = pap = srp = prp = rp = lp = pcp = 0;
702702

703703
res = -1;
704704

705705
cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
706706

707-
ngx_writeError(cf->cycle->log, __func__, "Registering handlers for modules in different phases");
707+
ngx_writeTrace(cf->cycle->log, __func__, "Registering handlers for modules in different phases"); // Log only with tracing
708708

709709
for (m = 0; cf->cycle->modules[m]; m++) {
710710
if (cf->cycle->modules[m]->type == NGX_HTTP_MODULE) {
@@ -800,7 +800,7 @@ static ngx_int_t ngx_http_opentelemetry_init(ngx_conf_t *cf)
800800
/* hostname is extracted from the nginx cycle. The attribute hostname is needed
801801
for OTEL spec and the only place it is available is cf->cycle
802802
*/
803-
ngx_writeError(cf->cycle->log, __func__, "Opentelemetry Module init completed!");
803+
ngx_writeTrace(cf->cycle->log, __func__, "Opentelemetry Module init completed!");// Log only with tracing
804804

805805
return NGX_OK;
806806
}
@@ -813,7 +813,7 @@ static ngx_int_t ngx_http_opentelemetry_init_worker(ngx_cycle_t *cycle)
813813
int p = getpid();
814814
char * s = (char *)ngx_pcalloc(cycle->pool, 6);
815815
sprintf(s, "%d", p);
816-
ngx_log_error(NGX_LOG_ERR, cycle->log, 0, "mod_opentelemetry: ngx_http_opentelemetry_init_worker: Initializing Nginx Worker for process with PID: %s", s);
816+
ngx_writeTrace(NGX_LOG_ERR, cycle->log, 0, "mod_opentelemetry: ngx_http_opentelemetry_init_worker: Initializing Nginx Worker for process with PID: %s", s); // Log only with tracing
817817

818818
/* Allocate memory for worker configuration */
819819
worker_conf = ngx_pcalloc(cycle->pool, sizeof(ngx_http_opentelemetry_worker_conf_t));

0 commit comments

Comments
 (0)