Skip to content

Commit 4a2815d

Browse files
committed
Bunch of updates
1 parent 3a39cbb commit 4a2815d

File tree

45 files changed

+145
-142
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+145
-142
lines changed

.pylintrc

+3-10
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# A comma-separated list of package or module names from where C extensions may
44
# be loaded. Extensions are loading into the active Python interpreter and may
55
# run arbitrary code.
6-
extension-pkg-whitelist=
6+
extension-pkg-whitelist=cassandra
77

88
# Add list of files or directories to be excluded. They should be base names, not
99
# paths.
@@ -29,7 +29,7 @@ limit-inference-results=100
2929

3030
# List of plugins (as comma separated values of python modules names) to load,
3131
# usually to register additional checkers.
32-
load-plugins=
32+
load-plugins=pylint.extensions.no_self_use
3333

3434
# Pickle collected data for later comparisons.
3535
persistent=yes
@@ -69,7 +69,6 @@ disable=missing-docstring,
6969
duplicate-code,
7070
ungrouped-imports, # Leave this up to isort
7171
wrong-import-order, # Leave this up to isort
72-
bad-continuation, # Leave this up to black
7372
line-too-long, # Leave this up to black
7473
exec-used,
7574
super-with-arguments, # temp-pylint-upgrade
@@ -81,6 +80,7 @@ disable=missing-docstring,
8180
invalid-overridden-method, # temp-pylint-upgrade
8281
missing-module-docstring, # temp-pylint-upgrade
8382
import-error, # needed as a workaround as reported here: https://github.com/open-telemetry/opentelemetry-python-contrib/issues/290
83+
cyclic-import,
8484

8585
# Enable the message, report, category or checker with the given id(s). You can
8686
# either give multiple identifier separated by comma (,) or put this option
@@ -268,13 +268,6 @@ max-line-length=79
268268
# Maximum number of lines in a module.
269269
max-module-lines=1000
270270

271-
# List of optional constructs for which whitespace checking is disabled. `dict-
272-
# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}.
273-
# `trailing-comma` allows a space between comma and closing bracket: (a, ).
274-
# `empty-line` allows space-only lines.
275-
no-space-check=trailing-comma,
276-
dict-separator
277-
278271
# Allow the body of a class to be on the same line as the declaration if body
279272
# contains single statement.
280273
single-line-class-stmt=no

dev-requirements.txt

+9-11
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
1-
pylint==2.12.2
1+
pylint==3.0.2
22
flake8~=3.7
3-
isort~=5.6
4-
black>=22.1.0
3+
isort~=5.8
4+
black~=22.3.0
55
httpretty~=1.0
6-
mypy==0.790
7-
sphinx
8-
sphinx-rtd-theme~=0.4
9-
sphinx-autodoc-typehints
10-
pytest!=5.2.3
11-
pytest-cov>=2.8
6+
mypy==0.931
7+
sphinx~=7.1
8+
sphinx-rtd-theme==2.0.0rc4
9+
sphinx-autodoc-typehints~=1.25
10+
pytest==7.1.3
11+
pytest-cov~=4.1
1212
readme-renderer~=24.0
1313
bleach==4.1.0 # transient dependency for readme-renderer
14-
grpcio-tools==1.29.0
15-
mypy-protobuf>=1.23
1614
protobuf~=3.13
1715
markupsafe>=2.0.1
1816
codespell==2.1.0

docs-requirements.txt

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
sphinx==4.5.0
2-
sphinx-rtd-theme~=0.4
3-
sphinx-autodoc-typehints
1+
sphinx~=7.1
2+
sphinx-rtd-theme==2.0.0rc4
3+
sphinx-autodoc-typehints~=1.25
44

55
# Need to install the api/sdk in the venv for autodoc. Modifying sys.path
66
# doesn't work for pkg_resources.
@@ -45,7 +45,6 @@ remoulade>=0.50
4545
sqlalchemy>=1.0
4646
tornado>=5.1.1
4747
tortoise-orm>=0.17.0
48-
ddtrace>=0.34.0
4948
httpx>=0.18.0
5049

5150
# indirect dependency pins

instrumentation/opentelemetry-instrumentation-aiohttp-client/tests/test_aiohttp_client_integration.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def test_status_codes(self):
136136

137137
def test_schema_url(self):
138138
with self.subTest(status_code=200):
139-
host, port = self._http_request(
139+
self._http_request(
140140
trace_config=aiohttp_client.create_trace_config(),
141141
url="/test-path?query=param#foobar",
142142
status_code=200,
@@ -156,7 +156,7 @@ def test_not_recording(self):
156156
mock_tracer.start_span.return_value = mock_span
157157
with mock.patch("opentelemetry.trace.get_tracer"):
158158
# pylint: disable=W0612
159-
host, port = self._http_request(
159+
self._http_request(
160160
trace_config=aiohttp_client.create_trace_config(),
161161
url="/test-path?query=param#foobar",
162162
)

instrumentation/opentelemetry-instrumentation-aiohttp-server/src/opentelemetry/instrumentation/aiohttp_server/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def collect_request_attributes(request: web.Request) -> Dict:
127127
result[SpanAttributes.HTTP_METHOD] = http_method
128128

129129
http_host_value_list = (
130-
[request.host] if type(request.host) != list else request.host
130+
[request.host] if not isinstance(request.host, list) else request.host
131131
)
132132
if http_host_value_list:
133133
result[SpanAttributes.HTTP_SERVER_NAME] = ",".join(

instrumentation/opentelemetry-instrumentation-aiohttp-server/tests/test_aiohttp_server_integration.py

+22-6
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
from enum import Enum
1516
from http import HTTPStatus
1617

1718
import aiohttp
@@ -27,11 +28,26 @@
2728
from opentelemetry.test.test_base import TestBase
2829
from opentelemetry.util._importlib_metadata import entry_points
2930

30-
from .utils import HTTPMethod
3131

32+
class HTTPMethod(Enum):
33+
"""HTTP methods and descriptions"""
3234

33-
@pytest.fixture(scope="session")
34-
def tracer():
35+
def __repr__(self):
36+
return f"{self.value}"
37+
38+
CONNECT = "CONNECT"
39+
DELETE = "DELETE"
40+
GET = "GET"
41+
HEAD = "HEAD"
42+
OPTIONS = "OPTIONS"
43+
PATCH = "PATCH"
44+
POST = "POST"
45+
PUT = "PUT"
46+
TRACE = "TRACE"
47+
48+
49+
@pytest.fixture(name="tracer", scope="session")
50+
def fixture_tracer():
3551
test_base = TestBase()
3652

3753
tracer_provider, memory_exporter = test_base.create_tracer_provider()
@@ -48,8 +64,8 @@ async def default_handler(request, status=200):
4864
return aiohttp.web.Response(status=status)
4965

5066

51-
@pytest_asyncio.fixture
52-
async def server_fixture(tracer, aiohttp_server):
67+
@pytest_asyncio.fixture(name="server_fixture")
68+
async def fixture_server_fixture(tracer, aiohttp_server):
5369
_, memory_exporter = tracer
5470

5571
AioHttpServerInstrumentor().instrument()
@@ -91,7 +107,7 @@ async def test_status_code_instrumentation(
91107
expected_status_code,
92108
):
93109
_, memory_exporter = tracer
94-
server, app = server_fixture
110+
server, _ = server_fixture
95111

96112
assert len(memory_exporter.get_finished_spans()) == 0
97113

instrumentation/opentelemetry-instrumentation-aiohttp-server/tests/utils.py

-32
This file was deleted.

instrumentation/opentelemetry-instrumentation-aiopg/src/opentelemetry/instrumentation/aiopg/aiopg_integration.py

+1
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ async def __aexit__(self, exc_type, exc, tb):
215215

216216

217217
class _PoolAcquireContextManager(_ContextManager):
218+
# pylint: disable=redefined-slots-in-subclass
218219
__slots__ = ("_coro", "_obj", "_pool")
219220

220221
def __init__(self, coro, pool):

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

+1
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,7 @@ async def otel_send(message):
710710
pass
711711

712712
await send(message)
713+
# pylint: disable=too-many-boolean-expressions
713714
if (
714715
not expecting_trailers
715716
and message["type"] == "http.response.body"

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

+1
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ async def error_asgi(scope, receive, send):
227227
await send({"type": "http.response.body", "body": b"*"})
228228

229229

230+
# pylint: disable=too-many-public-methods
230231
class TestAsgiApplication(AsgiTestBase):
231232
def validate_outputs(self, outputs, error=None, modifiers=None):
232233
# Ensure modifiers is a list

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def _hydrate_span_from_args(connection, query, parameters) -> dict:
8484
span_attributes[SpanAttributes.NET_PEER_NAME] = addr
8585
span_attributes[
8686
SpanAttributes.NET_TRANSPORT
87-
] = NetTransportValues.UNIX.value
87+
] = NetTransportValues.OTHER.value
8888

8989
if query is not None:
9090
span_attributes[SpanAttributes.DB_STATEMENT] = query

instrumentation/opentelemetry-instrumentation-botocore/src/opentelemetry/instrumentation/botocore/extensions/dynamodb.py

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
from opentelemetry.trace.span import Span
2929
from opentelemetry.util.types import AttributeValue
3030

31+
# pylint: disable=invalid-name
3132
_AttributePathT = Union[str, Tuple[str]]
3233

3334

instrumentation/opentelemetry-instrumentation-celery/src/opentelemetry/instrumentation/celery/utils.py

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
import logging
1616

17-
from billiard import VERSION
1817
from celery import registry # pylint: disable=no-name-in-module
1918

2019
from opentelemetry.semconv.trace import SpanAttributes

instrumentation/opentelemetry-instrumentation-confluent-kafka/src/opentelemetry/instrumentation/confluent_kafka/__init__.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def instrument_consumer(consumer: Consumer, tracer_provider=None)
107107
from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
108108
from opentelemetry.instrumentation.utils import unwrap
109109
from opentelemetry.semconv.trace import MessagingOperationValues
110-
from opentelemetry.trace import Link, SpanKind, Tracer
110+
from opentelemetry.trace import Tracer
111111

112112
from .package import _instruments
113113
from .utils import (
@@ -116,7 +116,6 @@ def instrument_consumer(consumer: Consumer, tracer_provider=None)
116116
_end_current_consume_span,
117117
_enrich_span,
118118
_get_span_name,
119-
_kafka_getter,
120119
_kafka_setter,
121120
)
122121
from .version import __version__

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

+7-7
Original file line numberDiff line numberDiff line change
@@ -427,14 +427,14 @@ def traced_execution(
427427
if args and self._commenter_enabled:
428428
try:
429429
args_list = list(args)
430-
commenter_data = dict(
430+
commenter_data = {
431431
# Psycopg2/framework information
432-
db_driver=f"psycopg2:{self._connect_module.__version__.split(' ')[0]}",
433-
dbapi_threadsafety=self._connect_module.threadsafety,
434-
dbapi_level=self._connect_module.apilevel,
435-
libpq_version=self._connect_module.__libpq_version__,
436-
driver_paramstyle=self._connect_module.paramstyle,
437-
)
432+
"db_driver": f"psycopg2:{self._connect_module.__version__.split(' ')[0]}",
433+
"dbapi_threadsafety": self._connect_module.threadsafety,
434+
"dbapi_level": self._connect_module.apilevel,
435+
"libpq_version": self._connect_module.__libpq_version__,
436+
"driver_paramstyle": self._connect_module.paramstyle,
437+
}
438438
if self._commenter_options.get(
439439
"opentelemetry_values", True
440440
):

instrumentation/opentelemetry-instrumentation-elasticsearch/tests/test_elasticsearch.py

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14+
# pylint: disable=unexpected-keyword-arg,missing-kwoa,no-value-for-parameter
1415

1516
import json
1617
import os

0 commit comments

Comments
 (0)