Skip to content

Commit 9e04228

Browse files
majorgreysflorimondmancacodeboten
authored
Apply suggestions from code review
Co-authored-by: Florimond Manca <florimond.manca@gmail.com> Co-authored-by: alrex <alrex.boten@gmail.com>
1 parent 553969c commit 9e04228

7 files changed

Lines changed: 12 additions & 12 deletions

File tree

ext/opentelemetry-ext-asgi/README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ OpenTelemetry ASGI Middleware
88

99

1010
This library provides a ASGI middleware that can be used on any ASGI framework
11-
(such as Django / Flask) to track requests timing through OpenTelemetry.
11+
(such as Django, Starlette, FastAPI or Quart) to track requests timing through OpenTelemetry.
1212

1313
Installation
1414
------------

ext/opentelemetry-ext-asgi/setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ url = https://github.com/open-telemetry/opentelemetry-python/ext/opentelemetry-e
2323
platforms = any
2424
license = Apache-2.0
2525
classifiers =
26-
Development Status :: 3 - Alpha
26+
Development Status :: 4 - Beta
2727
Intended Audience :: Developers
2828
License :: OSI Approved :: Apache Software License
2929
Programming Language :: Python

ext/opentelemetry-ext-asgi/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2019, OpenTelemetry Authors
1+
# Copyright The OpenTelemetry Authors
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2019, OpenTelemetry Authors
1+
# Copyright The OpenTelemetry Authors
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -81,15 +81,15 @@ def collect_request_attributes(scope):
8181
port = server[1]
8282
server_host = server[0] + (":" + str(port) if port != 80 else "")
8383
http_url = (
84-
scope.get("scheme") + "://" + server_host + scope.get("path", "")
84+
scope.get("scheme", "http") + "://" + server_host + scope.get("path", "")
8585
if scope.get("scheme") and server_host and scope.get("path")
8686
else None
8787
)
8888
if scope.get("query_string") and http_url:
8989
http_url = http_url + ("?" + scope.get("query_string").decode("utf8"))
9090

9191
result = {
92-
"component": scope.get("type"),
92+
"component": scope["type"]
9393
"http.scheme": scope.get("scheme"),
9494
"http.host": server_host,
9595
"host.port": port,
@@ -186,14 +186,14 @@ async def wrapped_receive():
186186
with self.tracer.start_as_current_span(
187187
span_name + " asgi." + scope["type"] + ".receive"
188188
) as receive_span:
189-
payload = await receive()
189+
message = await receive()
190190
if payload["type"] == "websocket.receive":
191191
set_status_code(receive_span, 200)
192192
receive_span.set_attribute("type", payload["type"])
193193
return payload
194194

195195
@wraps(send)
196-
async def wrapped_send(payload):
196+
async def wrapped_send(message):
197197
with self.tracer.start_as_current_span(
198198
span_name + " asgi." + scope["type"] + ".send"
199199
) as send_span:

ext/opentelemetry-ext-asgi/src/opentelemetry/ext/asgi/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2019, OpenTelemetry Authors
1+
# Copyright The OpenTelemetry Authors
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2019, OpenTelemetry Authors
1+
# Copyright The OpenTelemetry Authors
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

tests/util/src/opentelemetry/test/asgitestutil.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ def tearDown(self):
3838
def seed_app(self, app):
3939
self.communicator = ApplicationCommunicator(app, self.scope)
4040

41-
def send_input(self, payload):
41+
def send(self, message):
4242
asyncio.get_event_loop().run_until_complete(
43-
self.communicator.send_input(payload)
43+
self.communicator.send_input(message)
4444
)
4545

4646
def send_default_request(self):

0 commit comments

Comments
 (0)