Skip to content

Commit 11a06db

Browse files
author
Sergei Malafeev
authored
Rename "host.port" attribute to "net.host.port" (#242)
1 parent a7aa662 commit 11a06db

File tree

8 files changed

+17
-14
lines changed

8 files changed

+17
-14
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3333
([#1374](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/233))
3434
- `opentelemetry-instrumentation-grpc` Comply with updated spec, rework tests
3535
([#236](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/236))
36+
- `opentelemetry-instrumentation-asgi`, `opentelemetry-instrumentation-falcon`, `opentelemetry-instrumentation-flask`, `opentelemetry-instrumentation-pyramid`, `opentelemetry-instrumentation-wsgi` Renamed `host.port` attribute to `net.host.port`
37+
([#242](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/242))
3638

3739
## [0.16b1](https://github.com/open-telemetry/opentelemetry-python-contrib/releases/tag/v0.16b1) - 2020-11-26
3840

instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def collect_request_attributes(scope):
7575
"component": scope["type"],
7676
"http.scheme": scope.get("scheme"),
7777
"http.host": server_host,
78-
"host.port": port,
78+
"net.host.port": port,
7979
"http.flavor": scope.get("http_version"),
8080
"http.target": scope.get("path"),
8181
"http.url": http_url,

instrumentation/opentelemetry-instrumentation-asgi/tests/test_asgi_middleware.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def validate_outputs(self, outputs, error=None, modifiers=None):
137137
"component": "http",
138138
"http.method": "GET",
139139
"http.scheme": "http",
140-
"host.port": 80,
140+
"net.host.port": 80,
141141
"http.host": "127.0.0.1",
142142
"http.flavor": "1.0",
143143
"http.target": "/",
@@ -218,7 +218,7 @@ def update_expected_server(expected):
218218
expected[3]["attributes"].update(
219219
{
220220
"http.host": "0.0.0.0",
221-
"host.port": 80,
221+
"net.host.port": 80,
222222
"http.url": "http://0.0.0.0/",
223223
}
224224
)
@@ -326,7 +326,7 @@ def test_request_attributes(self):
326326
"http.host": "127.0.0.1",
327327
"http.target": "/",
328328
"http.url": "http://127.0.0.1/?foo=bar",
329-
"host.port": 80,
329+
"net.host.port": 80,
330330
"http.scheme": "http",
331331
"http.server_name": "test",
332332
"http.flavor": "1.0",

instrumentation/opentelemetry-instrumentation-falcon/tests/test_falcon.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def _test_method(self, method):
9999
"http.method": method,
100100
"http.server_name": "falconframework.org",
101101
"http.scheme": "http",
102-
"host.port": 80,
102+
"net.host.port": 80,
103103
"http.host": "falconframework.org",
104104
"http.target": "/",
105105
"net.peer.ip": "127.0.0.1",
@@ -126,7 +126,7 @@ def test_404(self):
126126
"http.method": "GET",
127127
"http.server_name": "falconframework.org",
128128
"http.scheme": "http",
129-
"host.port": 80,
129+
"net.host.port": 80,
130130
"http.host": "falconframework.org",
131131
"http.target": "/",
132132
"net.peer.ip": "127.0.0.1",
@@ -159,7 +159,7 @@ def test_500(self):
159159
"http.method": "GET",
160160
"http.server_name": "falconframework.org",
161161
"http.scheme": "http",
162-
"host.port": 80,
162+
"net.host.port": 80,
163163
"http.host": "falconframework.org",
164164
"http.target": "/",
165165
"net.peer.ip": "127.0.0.1",

instrumentation/opentelemetry-instrumentation-flask/tests/test_programmatic.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def expected_attributes(override_attributes):
3232
"http.method": "GET",
3333
"http.server_name": "localhost",
3434
"http.scheme": "http",
35-
"host.port": 80,
35+
"net.host.port": 80,
3636
"http.host": "localhost",
3737
"http.target": "/",
3838
"http.flavor": "1.1",

instrumentation/opentelemetry-instrumentation-pyramid/tests/test_programmatic.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def expected_attributes(override_attributes):
3232
"http.method": "GET",
3333
"http.server_name": "localhost",
3434
"http.scheme": "http",
35-
"host.port": 80,
35+
"net.host.port": 80,
3636
"http.host": "localhost",
3737
"http.target": "/",
3838
"http.flavor": "1.1",

instrumentation/opentelemetry-instrumentation-wsgi/src/opentelemetry/instrumentation/wsgi/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def collect_request_attributes(environ):
112112

113113
host_port = environ.get("SERVER_PORT")
114114
if host_port is not None:
115-
result.update({"host.port": int(host_port)})
115+
result.update({"net.host.port": int(host_port)})
116116

117117
setifnotnone(result, "http.host", environ.get("HTTP_HOST"))
118118
target = environ.get("RAW_URI")

instrumentation/opentelemetry-instrumentation-wsgi/tests/test_wsgi_middleware.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def validate_response(
109109
"component": "http",
110110
"http.server_name": "127.0.0.1",
111111
"http.scheme": "http",
112-
"host.port": 80,
112+
"net.host.port": 80,
113113
"http.host": "127.0.0.1",
114114
"http.flavor": "1.0",
115115
"http.url": "http://127.0.0.1/",
@@ -219,7 +219,7 @@ def test_request_attributes(self):
219219
"http.method": "GET",
220220
"http.host": "127.0.0.1",
221221
"http.url": "http://127.0.0.1/?foo=bar",
222-
"host.port": 80,
222+
"net.host.port": 80,
223223
"http.scheme": "http",
224224
"http.server_name": "127.0.0.1",
225225
"http.flavor": "1.0",
@@ -230,7 +230,8 @@ def validate_url(self, expected_url, raw=False, has_host=True):
230230
parts = urlsplit(expected_url)
231231
expected = {
232232
"http.scheme": parts.scheme,
233-
"host.port": parts.port or (80 if parts.scheme == "http" else 443),
233+
"net.host.port": parts.port
234+
or (80 if parts.scheme == "http" else 443),
234235
"http.server_name": parts.hostname, # Not true in the general case, but for all tests.
235236
}
236237
if raw:
@@ -296,7 +297,7 @@ def test_request_attributes_with_conflicting_nonstandard_port(self):
296297
expected = {
297298
"http.host": "127.0.0.1:8080",
298299
"http.url": "http://127.0.0.1:8080/",
299-
"host.port": 80,
300+
"net.host.port": 80,
300301
}
301302
self.assertGreaterEqual(
302303
otel_wsgi.collect_request_attributes(self.environ).items(),

0 commit comments

Comments
 (0)