feat: Add server.address to transformed spans when stream_gen_ai_spans=True#6307
feat: Add server.address to transformed spans when stream_gen_ai_spans=True#6307alexander-alderman-webb wants to merge 4 commits into
server.address to transformed spans when stream_gen_ai_spans=True#6307Conversation
server.name to transformed spans when stream_gen_ai_spans=Trueserver.address to transformed spans when stream_gen_ai_spans=True
Codecov Results 📊✅ 13 passed | Total: 13 | Pass Rate: 100% | Execution Time: 3.99s All tests are passing successfully. ❌ Patch coverage is 0.00%. Project has 15811 uncovered lines. Files with missing lines (1)
Generated by Codecov Action |
| if "server_name" in event: | ||
| attributes["server.address"] = event["server_name"] |
There was a problem hiding this comment.
server.address from span data silently overwritten by event server_name
When span.data already contains a server.address attribute (e.g. set by the WSGI integration from SERVER_NAME), this unconditional assignment overwrites it with the event-level server_name (the machine hostname), losing the more specific per-request value.
Evidence
attributes.update(span_data)at line 207 merges all span data intoattributes, which may include aserver.addresskey (e.g.wsgi.py:402setsattributes["server.address"] = server_namefromenviron["SERVER_NAME"]).- The new code at line 228-229 then unconditionally does
attributes["server.address"] = event["server_name"], overwriting the span-level value with the machine hostname. - OTel semantic convention
server.addressrefers to the logical server address the client is connecting to (not the machine hostname), so the overwrite introduces semantically incorrect data. - The fix is to only set the fallback when
server.addressis not already present:if "server_name" in event and "server.address" not in attributes:.
Identified by Warden find-bugs · YPW-2W9
There was a problem hiding this comment.
Fix attempt detected (commit ed3fc20)
The commit added the exact line at issue (attributes['server.address'] = event['server_name']) unconditionally without the suggested and 'server.address' not in attributes guard, so the overwrite issue persists.
The original issue appears unresolved. Please review and try again.
Evaluated by Warden
Description
Issues
Reminders
tox -e linters.feat:,fix:,ref:,meta:)