open-telemetry / open-telemetry/opentelemetry-cpp-contrib
Unused parameter warning when compiling the Nginx module
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 153
- Forks
- 184
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 26
Description
Describe your environment
I'm compiling inside a k8s.gcr.io/ingress-nginx/controller:v0.46.0 Docker image but the same thing can be seen in the output of the GitHub Actions so I don't think it's environment-specific here.
Steps to reproduce
$ mkdir build
$ cd build
$ cmake -DCMAKE_TYPE=RELEASE -DNGINX_BIN=/etc/nginx/nginx \
-DCMAKE_PREFIX_PATH=/install -DCMAKE_INSTALL_PREFIX=/etc/nginx/modules \
-DNGINX_VERSION=1.18.0 \
-DCURL_LIBRARY=/usr/lib/libcurl.so.4 ..
$ make -j2
- Follow the build instructions and build the library.
- You'll see warnings about an unused parameter.
/opentelemetry-cpp-contrib/instrumentation/nginx/src/otel_ngx_module.cpp: In function 'ngx_int_t OtelGetTraceId(ngx_http_request_t*, ngx_http_variable_value_t*, uintptr_t)':
/opentelemetry-cpp-contrib/instrumentation/nginx/src/otel_ngx_module.cpp:229:81: warning: unused parameter 'data' [-Wunused-parameter]
229 | OtelGetTraceId(ngx_http_request_t* req, ngx_http_variable_value_t* v, uintptr_t data) {
| ~~~~~~~~~~^~~~
/opentelemetry-cpp-contrib/instrumentation/nginx/src/otel_ngx_module.cpp: In function 'ngx_int_t OtelGetSpanId(ngx_http_request_t*, ngx_http_variable_value_t*, uintptr_t)':
/opentelemetry-cpp-contrib/instrumentation/nginx/src/otel_ngx_module.cpp:278:80: warning: unused parameter 'data' [-Wunused-parameter]
278 | OtelGetSpanId(ngx_http_request_t* req, ngx_http_variable_value_t* v, uintptr_t data) {
| ~~~~~~~~~~^~~~
What is the expected behavior?
Compilation should be smooth without any warnings. Whenever the compiler prints something it raises alarms that there may be something wrong or misconfigured in the compilation process.
What is the actual behavior?
I see two warnings about some unused parameter.
Additional context
This can be seen in the build nginx docker step in a GitHub Action build output
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in instrumentation/nginx/src/otel_ngx_module.cpp at OtelGetTraceId and OtelGetSpanId, then run the provided CMake and make build or the GitHub Actions build nginx docker step to confirm the warnings. Done means the Nginx module compiles without the two -Wunused-parameter warnings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, docker, nginx
- Domain
- backend, build-system
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100