diff --git a/CHANGELOG.md b/CHANGELOG.md index c1b98b072bba..fcc43db99b16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ([#1374](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/233)) - `opentelemetry-instrumentation-grpc` Comply with updated spec, rework tests ([#236](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/236)) +- `opentelemetry-instrumentation-asgi`, `opentelemetry-instrumentation-falcon`, `opentelemetry-instrumentation-flask`, `opentelemetry-instrumentation-pyramid`, `opentelemetry-instrumentation-wsgi` Renamed `host.port` attribute to `net.host.port` + ([#242](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/242)) ## [0.16b1](https://github.com/open-telemetry/opentelemetry-python-contrib/releases/tag/v0.16b1) - 2020-11-26 diff --git a/instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/__init__.py b/instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/__init__.py index 44f07586aa36..0947eadf084b 100644 --- a/instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/__init__.py @@ -75,7 +75,7 @@ def collect_request_attributes(scope): "component": scope["type"], "http.scheme": scope.get("scheme"), "http.host": server_host, - "host.port": port, + "net.host.port": port, "http.flavor": scope.get("http_version"), "http.target": scope.get("path"), "http.url": http_url, diff --git a/instrumentation/opentelemetry-instrumentation-asgi/tests/test_asgi_middleware.py b/instrumentation/opentelemetry-instrumentation-asgi/tests/test_asgi_middleware.py index 298d8ca45829..aecc06b082a6 100644 --- a/instrumentation/opentelemetry-instrumentation-asgi/tests/test_asgi_middleware.py +++ b/instrumentation/opentelemetry-instrumentation-asgi/tests/test_asgi_middleware.py @@ -137,7 +137,7 @@ def validate_outputs(self, outputs, error=None, modifiers=None): "component": "http", "http.method": "GET", "http.scheme": "http", - "host.port": 80, + "net.host.port": 80, "http.host": "127.0.0.1", "http.flavor": "1.0", "http.target": "/", @@ -218,7 +218,7 @@ def update_expected_server(expected): expected[3]["attributes"].update( { "http.host": "0.0.0.0", - "host.port": 80, + "net.host.port": 80, "http.url": "http://0.0.0.0/", } ) @@ -326,7 +326,7 @@ def test_request_attributes(self): "http.host": "127.0.0.1", "http.target": "/", "http.url": "http://127.0.0.1/?foo=bar", - "host.port": 80, + "net.host.port": 80, "http.scheme": "http", "http.server_name": "test", "http.flavor": "1.0", diff --git a/instrumentation/opentelemetry-instrumentation-falcon/tests/test_falcon.py b/instrumentation/opentelemetry-instrumentation-falcon/tests/test_falcon.py index 464f0d8f5c18..616db2837fc8 100644 --- a/instrumentation/opentelemetry-instrumentation-falcon/tests/test_falcon.py +++ b/instrumentation/opentelemetry-instrumentation-falcon/tests/test_falcon.py @@ -99,7 +99,7 @@ def _test_method(self, method): "http.method": method, "http.server_name": "falconframework.org", "http.scheme": "http", - "host.port": 80, + "net.host.port": 80, "http.host": "falconframework.org", "http.target": "/", "net.peer.ip": "127.0.0.1", @@ -126,7 +126,7 @@ def test_404(self): "http.method": "GET", "http.server_name": "falconframework.org", "http.scheme": "http", - "host.port": 80, + "net.host.port": 80, "http.host": "falconframework.org", "http.target": "/", "net.peer.ip": "127.0.0.1", @@ -159,7 +159,7 @@ def test_500(self): "http.method": "GET", "http.server_name": "falconframework.org", "http.scheme": "http", - "host.port": 80, + "net.host.port": 80, "http.host": "falconframework.org", "http.target": "/", "net.peer.ip": "127.0.0.1", diff --git a/instrumentation/opentelemetry-instrumentation-flask/tests/test_programmatic.py b/instrumentation/opentelemetry-instrumentation-flask/tests/test_programmatic.py index 57aab8905811..495b4a739a64 100644 --- a/instrumentation/opentelemetry-instrumentation-flask/tests/test_programmatic.py +++ b/instrumentation/opentelemetry-instrumentation-flask/tests/test_programmatic.py @@ -32,7 +32,7 @@ def expected_attributes(override_attributes): "http.method": "GET", "http.server_name": "localhost", "http.scheme": "http", - "host.port": 80, + "net.host.port": 80, "http.host": "localhost", "http.target": "/", "http.flavor": "1.1", diff --git a/instrumentation/opentelemetry-instrumentation-pyramid/tests/test_programmatic.py b/instrumentation/opentelemetry-instrumentation-pyramid/tests/test_programmatic.py index f5c8b3ba02d3..e5bbcb056bcc 100644 --- a/instrumentation/opentelemetry-instrumentation-pyramid/tests/test_programmatic.py +++ b/instrumentation/opentelemetry-instrumentation-pyramid/tests/test_programmatic.py @@ -32,7 +32,7 @@ def expected_attributes(override_attributes): "http.method": "GET", "http.server_name": "localhost", "http.scheme": "http", - "host.port": 80, + "net.host.port": 80, "http.host": "localhost", "http.target": "/", "http.flavor": "1.1", diff --git a/instrumentation/opentelemetry-instrumentation-wsgi/src/opentelemetry/instrumentation/wsgi/__init__.py b/instrumentation/opentelemetry-instrumentation-wsgi/src/opentelemetry/instrumentation/wsgi/__init__.py index b8de5c182088..dd83203fe13d 100644 --- a/instrumentation/opentelemetry-instrumentation-wsgi/src/opentelemetry/instrumentation/wsgi/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-wsgi/src/opentelemetry/instrumentation/wsgi/__init__.py @@ -112,7 +112,7 @@ def collect_request_attributes(environ): host_port = environ.get("SERVER_PORT") if host_port is not None: - result.update({"host.port": int(host_port)}) + result.update({"net.host.port": int(host_port)}) setifnotnone(result, "http.host", environ.get("HTTP_HOST")) target = environ.get("RAW_URI") diff --git a/instrumentation/opentelemetry-instrumentation-wsgi/tests/test_wsgi_middleware.py b/instrumentation/opentelemetry-instrumentation-wsgi/tests/test_wsgi_middleware.py index 144b4cf06926..d563ee673def 100644 --- a/instrumentation/opentelemetry-instrumentation-wsgi/tests/test_wsgi_middleware.py +++ b/instrumentation/opentelemetry-instrumentation-wsgi/tests/test_wsgi_middleware.py @@ -109,7 +109,7 @@ def validate_response( "component": "http", "http.server_name": "127.0.0.1", "http.scheme": "http", - "host.port": 80, + "net.host.port": 80, "http.host": "127.0.0.1", "http.flavor": "1.0", "http.url": "http://127.0.0.1/", @@ -219,7 +219,7 @@ def test_request_attributes(self): "http.method": "GET", "http.host": "127.0.0.1", "http.url": "http://127.0.0.1/?foo=bar", - "host.port": 80, + "net.host.port": 80, "http.scheme": "http", "http.server_name": "127.0.0.1", "http.flavor": "1.0", @@ -230,7 +230,8 @@ def validate_url(self, expected_url, raw=False, has_host=True): parts = urlsplit(expected_url) expected = { "http.scheme": parts.scheme, - "host.port": parts.port or (80 if parts.scheme == "http" else 443), + "net.host.port": parts.port + or (80 if parts.scheme == "http" else 443), "http.server_name": parts.hostname, # Not true in the general case, but for all tests. } if raw: @@ -296,7 +297,7 @@ def test_request_attributes_with_conflicting_nonstandard_port(self): expected = { "http.host": "127.0.0.1:8080", "http.url": "http://127.0.0.1:8080/", - "host.port": 80, + "net.host.port": 80, } self.assertGreaterEqual( otel_wsgi.collect_request_attributes(self.environ).items(),