open-telemetry / open-telemetry/opentelemetry-cpp-contrib

nginx module produces wrong peer address

Open
#483 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

instrumentation:nginx
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.address set to $upstream_addr
  • client.address set to $remote_addr

What is the actual behavior?

The span created by the module has the attribute:

  • net.peer.ip set to $remote_addr

https://github.com/open-telemetry/opentelemetry-cpp-contrib/blob/22e7fe29f82f2da73b166d7fb7950b56af390a75/instrumentation/nginx/src/otel_ngx_module.cpp#L50

Additional context

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.