open-telemetry / open-telemetry/opentelemetry-cpp-contrib
nginx module produces wrong peer address
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 153
- Forks
- 184
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 26
Description
Describe your environment
nginx installed as a forward or reverse proxy with the otel instrumentation module installed.
Steps to reproduce
Hit the proxy and inspect the attributes of the generated span.
What is the expected behavior?
The span created by the module when nginx is acting as a proxy should have:
network.peer.addressset to$upstream_addrclient.addressset to$remote_addr
What is the actual behavior?
The span created by the module has the attribute:
net.peer.ipset to$remote_addr
Additional context
- OTel Sem Conv for Networking Attributes: https://opentelemetry.io/docs/specs/semconv/attributes-registry/network/#network-attributes
- $upstream_addr docs: https://nginx.org/en/docs/http/ngx_http_upstream_module.html#var_upstream_addr
- $remote_addr docs: https://nginx.org/en/docs/http/ngx_http_core_module.html#var_remote_addr
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 at instrumentation/nginx/src/otel_ngx_module.cpp around line 50 and compare the current span attributes with the networking semantic conventions. The change is complete when proxied spans use $upstream_addr for network.peer.address and $remote_addr for client.address instead of the current net.peer.ip mapping.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, nginx
- Domain
- observability-sre
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100