Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename "host.port" attribute to "net.host.port" #242

Merged
merged 7 commits into from
Dec 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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": "/",
Expand Down Expand Up @@ -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/",
}
)
Expand Down Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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/",
Expand Down Expand Up @@ -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",
Expand All @@ -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:
Expand Down Expand Up @@ -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(),
Expand Down