Skip to content

Expose the scope getters to top level API and use them everywhere #3357

New issue

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

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

Already on GitHub? # to your account

Merged
merged 6 commits into from
Jul 29, 2024

Conversation

sl0thentr0py
Copy link
Member

@sl0thentr0py sl0thentr0py commented Jul 26, 2024

Going forward, we might have 2 different scope implementations for otel so we
can't have the Scope class being called everywhere directly since this
will be abstracted away.

The refactor had 2 main goals

  • get rid of import Scope outside of the main init/api files
  • get rid of all Scope.* calls outside the actual current Scope impl and replace them with top level api everywhere
  • I also did some cleanup of the __init__ and api files since some methods should've been in api

@sl0thentr0py sl0thentr0py force-pushed the neel/prepare-scope-management branch from 4b39048 to c9598b1 Compare July 26, 2024 14:09
Copy link

codecov bot commented Jul 26, 2024

Test Failures Detected: Due to failing tests, we cannot provide coverage reports at this time.

❌ Failed Test Results:

Completed 14758 tests with 20 failed, 12789 passed and 1949 skipped.

View the full list of failed tests

py3.6-boto3-v1.12

  • Class name: tests.integrations.boto3.test_s3
    Test name: test_omit_url_data_if_parsing_fails

    sentry_sdk/integrations/boto3.py:77: in _sentry_request_created
    parsed_url = parse_url(request.url, sanitize=False)
    .../hostedtoolcache/Python/3.6.15....../x64/lib/python3.6/unittest/mock.py:939: in __call__
    return _mock_self._mock_call(*args, **kwargs)
    .../hostedtoolcache/Python/3.6.15....../x64/lib/python3.6/unittest/mock.py:999: in _mock_call
    raise effect
    E ValueError

    During handling of the above exception, another exception occurred:
    .../integrations/boto3/test_s3.py:118: in test_omit_url_data_if_parsing_fails
    items = [obj for obj in bucket.objects.all()]
    .../integrations/boto3/test_s3.py:118: in <listcomp>
    items = [obj for obj in bucket.objects.all()]
    .tox/py3.6-boto3-v1.12/lib/python3.6.../boto3/resources/collection.py:83: in __iter__
    for page in self.pages():
    .tox/py3.6-boto3-v1.12/lib/python3.6.../boto3/resources/collection.py:166: in pages
    for page in pages:
    .tox/py3.6-boto3-v1.12/lib/python3.6....../site-packages/botocore/paginate.py:255: in __iter__
    response = self._make_request(current_kwargs)
    .tox/py3.6-boto3-v1.12/lib/python3.6....../site-packages/botocore/paginate.py:332: in _make_request
    return self._method(**current_kwargs)
    .tox/py3.6-boto3-v1.12/lib/python3.6........./site-packages/botocore/client.py:316: in _api_call
    return self._make_api_call(operation_name, kwargs)
    .tox/py3.6-boto3-v1.12/lib/python3.6........./site-packages/botocore/client.py:613: in _make_api_call
    operation_model, request_dict, request_context)
    .tox/py3.6-boto3-v1.12/lib/python3.6........./site-packages/botocore/client.py:632: in _make_request
    return self._endpoint.make_request(operation_model, request_dict)
    .tox/py3.6-boto3-v1.12/lib/python3.6........./site-packages/botocore/endpoint.py:102: in make_request
    return self._send_request(request_dict, operation_model)
    .tox/py3.6-boto3-v1.12/lib/python3.6........./site-packages/botocore/endpoint.py:132: in _send_request
    request = self.create_request(request_dict, operation_model)
    .tox/py3.6-boto3-v1.12/lib/python3.6........./site-packages/botocore/endpoint.py:116: in create_request
    operation_name=operation_model.name)
    .tox/py3.6-boto3-v1.12/lib/python3.6........./site-packages/botocore/hooks.py:356: in emit
    return self._emitter.emit(aliased_event_name, **kwargs)
    .tox/py3.6-boto3-v1.12/lib/python3.6........./site-packages/botocore/hooks.py:228: in emit
    return self._emit(event_name, kwargs)
    .tox/py3.6-boto3-v1.12/lib/python3.6........./site-packages/botocore/hooks.py:211: in _emit
    response = handler(**kwargs)
    sentry_sdk/utils.py:1721: in runner
    return sentry_patched_function(*args, **kwargs)
    sentry_sdk/integrations/boto3.py:77: in _sentry_request_created
    parsed_url = parse_url(request.url, sanitize=False)
    sentry_sdk/utils.py:178: in __exit__
    capture_internal_exception((ty, value, tb))
    E TypeError: 'staticmethod' object is not callable

py3.6-common

  • Class name: tests.integrations.requests.test_requests
    Test name: test_omit_url_data_if_parsing_fails

    sentry_sdk/integrations/stdlib.py:88: in putrequest
    parsed_url = parse_url(real_url, sanitize=False)
    .../hostedtoolcache/Python/3.6.15............/x64/lib/python3.6/unittest/mock.py:939: in __call__
    return _mock_self._mock_call(*args, **kwargs)
    .../hostedtoolcache/Python/3.6.15............/x64/lib/python3.6/unittest/mock.py:999: in _mock_call
    raise effect
    E ValueError

    During handling of the above exception, another exception occurred:
    .../integrations/requests/test_requests.py:53: in test_omit_url_data_if_parsing_fails
    response = requests.get(url)
    .tox/py3.6-common/lib/python3.6....../site-packages/requests/api.py:75: in get
    return request('get', url, params=params, **kwargs)
    .tox/py3.6-common/lib/python3.6....../site-packages/requests/api.py:61: in request
    return session.request(method=method, url=url, **kwargs)
    .tox/py3.6-common/lib/python3.6....../site-packages/requests/sessions.py:529: in request
    resp = self.send(prep, **send_kwargs)
    .tox/py3.6-common/lib/python3.6....../site-packages/requests/sessions.py:645: in send
    r = adapter.send(request, **kwargs)
    .tox/py3.6-common/lib/python3.6.../site-packages/requests/adapters.py:450: in send
    timeout=timeout
    .tox/py3.6-common/lib/python3.6....../site-packages/urllib3/connectionpool.py:722: in urlopen
    chunked=chunked,
    .tox/py3.6-common/lib/python3.6....../site-packages/urllib3/connectionpool.py:416: in _make_request
    conn.request(method, url, **httplib_request_kw)
    .tox/py3.6-common/lib/python3.6....../site-packages/urllib3/connection.py:244: in request
    super(HTTPConnection, self).request(method, url, body=body, headers=headers)
    .../hostedtoolcache/Python/3.6.15............/x64/lib/python3.6/http/client.py:1291: in request
    self._send_request(method, url, body, headers, encode_chunked)
    .../hostedtoolcache/Python/3.6.15............/x64/lib/python3.6/http/client.py:1302: in _send_request
    self.putrequest(method, url, **skips)
    .tox/py3.6-common/lib/python3.6....../site-packages/urllib3/connection.py:219: in putrequest
    return _HTTPConnection.putrequest(self, method, url, *args, **kwargs)
    sentry_sdk/integrations/stdlib.py:88: in putrequest
    parsed_url = parse_url(real_url, sanitize=False)
    sentry_sdk/utils.py:178: in __exit__
    capture_internal_exception((ty, value, tb))
    E TypeError: 'staticmethod' object is not callable
  • Class name: tests.test_basics
    Test name: test_attachments_graceful_failure

    sentry_sdk/envelope.py:188: in get_bytes
    with open(self.path, "rb") as f:
    E FileNotFoundError: [Errno 2] No such file or directory: 'non_existent'

    During handling of the above exception, another exception occurred:
    tests/test_basics.py:473: in test_attachments_graceful_failure
    assert envelope.items[1].payload.get_bytes() == b""
    sentry_sdk/envelope.py:188: in get_bytes
    with open(self.path, "rb") as f:
    sentry_sdk/utils.py:178: in __exit__
    capture_internal_exception((ty, value, tb))
    E TypeError: 'staticmethod' object is not callable

py3.6-gevent

  • Class name: tests.integrations.requests.test_requests
    Test name: test_omit_url_data_if_parsing_fails

    sentry_sdk/integrations/stdlib.py:88: in putrequest
    parsed_url = parse_url(real_url, sanitize=False)
    .../hostedtoolcache/Python/3.6.15............/x64/lib/python3.6/unittest/mock.py:939: in __call__
    return _mock_self._mock_call(*args, **kwargs)
    .../hostedtoolcache/Python/3.6.15............/x64/lib/python3.6/unittest/mock.py:999: in _mock_call
    raise effect
    E ValueError

    During handling of the above exception, another exception occurred:
    .../integrations/requests/test_requests.py:53: in test_omit_url_data_if_parsing_fails
    response = requests.get(url)
    .tox/py3.6-gevent/lib/python3.6....../site-packages/requests/api.py:75: in get
    return request('get', url, params=params, **kwargs)
    .tox/py3.6-gevent/lib/python3.6....../site-packages/requests/api.py:61: in request
    return session.request(method=method, url=url, **kwargs)
    .tox/py3.6-gevent/lib/python3.6....../site-packages/requests/sessions.py:529: in request
    resp = self.send(prep, **send_kwargs)
    .tox/py3.6-gevent/lib/python3.6....../site-packages/requests/sessions.py:645: in send
    r = adapter.send(request, **kwargs)
    .tox/py3.6-gevent/lib/python3.6.../site-packages/requests/adapters.py:450: in send
    timeout=timeout
    .tox/py3.6-gevent/lib/python3.6....../site-packages/urllib3/connectionpool.py:722: in urlopen
    chunked=chunked,
    .tox/py3.6-gevent/lib/python3.6....../site-packages/urllib3/connectionpool.py:416: in _make_request
    conn.request(method, url, **httplib_request_kw)
    .tox/py3.6-gevent/lib/python3.6....../site-packages/urllib3/connection.py:244: in request
    super(HTTPConnection, self).request(method, url, body=body, headers=headers)
    .../hostedtoolcache/Python/3.6.15............/x64/lib/python3.6/http/client.py:1291: in request
    self._send_request(method, url, body, headers, encode_chunked)
    .../hostedtoolcache/Python/3.6.15............/x64/lib/python3.6/http/client.py:1302: in _send_request
    self.putrequest(method, url, **skips)
    .tox/py3.6-gevent/lib/python3.6....../site-packages/urllib3/connection.py:219: in putrequest
    return _HTTPConnection.putrequest(self, method, url, *args, **kwargs)
    sentry_sdk/integrations/stdlib.py:88: in putrequest
    parsed_url = parse_url(real_url, sanitize=False)
    sentry_sdk/utils.py:178: in __exit__
    capture_internal_exception((ty, value, tb))
    E TypeError: 'staticmethod' object is not callable
  • Class name: tests.test_basics
    Test name: test_attachments_graceful_failure

    sentry_sdk/envelope.py:188: in get_bytes
    with open(self.path, "rb") as f:
    E FileNotFoundError: [Errno 2] No such file or directory: 'non_existent'

    During handling of the above exception, another exception occurred:
    tests/test_basics.py:473: in test_attachments_graceful_failure
    assert envelope.items[1].payload.get_bytes() == b""
    sentry_sdk/envelope.py:188: in get_bytes
    with open(self.path, "rb") as f:
    sentry_sdk/utils.py:178: in __exit__
    capture_internal_exception((ty, value, tb))
    E TypeError: 'staticmethod' object is not callable

py3.7-aiohttp-v3.4

  • Class name: tests.integrations.aiohttp.test_aiohttp
    Test name: test_tracing_unparseable_url[pyloop]

    sentry_sdk/integrations/aiohttp.py:204: in on_request_start
    parsed_url = parse_url(str(params.url), sanitize=False)
    .../hostedtoolcache/Python/3.7.17....../x64/lib/python3.7/unittest/mock.py:1016: in __call__
    return _mock_self._mock_call(*args, **kwargs)
    .../hostedtoolcache/Python/3.7.17....../x64/lib/python3.7/unittest/mock.py:1076: in _mock_call
    raise effect
    E ValueError

    During handling of the above exception, another exception occurred:
    .../integrations/aiohttp/test_aiohttp.py:273: in test_tracing_unparseable_url
    resp = await client.get("/")
    .tox/py3.7-aiohttp-v3.4/lib/python3.7.../site-packages/aiohttp/test_utils.py:217: in request
    method, self.make_url(path), *args, **kwargs
    .tox/py3.7-aiohttp-v3.4/lib/python3.7.../site-packages/aiohttp/client.py:316: in _request
    headers
    .tox/py3.7-aiohttp-v3.4/lib/python3.7.../site-packages/aiohttp/tracing.py:238: in send_request_start
    TraceRequestStartParams(method, url, headers)
    .tox/py3.7-aiohttp-v3.4/lib/python3.7.../site-packages/aiohttp/signals.py:35: in send
    await receiver(*args, **kwargs) # type: ignore
    sentry_sdk/integrations/aiohttp.py:204: in on_request_start
    parsed_url = parse_url(str(params.url), sanitize=False)
    sentry_sdk/utils.py:178: in __exit__
    capture_internal_exception((ty, value, tb))
    E TypeError: 'staticmethod' object is not callable

py3.7-boto3-v1.23

  • Class name: tests.integrations.boto3.test_s3
    Test name: test_omit_url_data_if_parsing_fails

    sentry_sdk/integrations/boto3.py:77: in _sentry_request_created
    parsed_url = parse_url(request.url, sanitize=False)
    .../hostedtoolcache/Python/3.7.17....../x64/lib/python3.7/unittest/mock.py:1016: in __call__
    return _mock_self._mock_call(*args, **kwargs)
    .../hostedtoolcache/Python/3.7.17....../x64/lib/python3.7/unittest/mock.py:1076: in _mock_call
    raise effect
    E ValueError

    During handling of the above exception, another exception occurred:
    .../integrations/boto3/test_s3.py:118: in test_omit_url_data_if_parsing_fails
    items = [obj for obj in bucket.objects.all()]
    .../integrations/boto3/test_s3.py:118: in <listcomp>
    items = [obj for obj in bucket.objects.all()]
    .tox/py3.7-boto3-v1.23/lib/python3.7.../boto3/resources/collection.py:81: in __iter__
    for page in self.pages():
    .tox/py3.7-boto3-v1.23/lib/python3.7.../boto3/resources/collection.py:171: in pages
    for page in pages:
    .tox/py3.7-boto3-v1.23/lib/python3.7....../site-packages/botocore/paginate.py:264: in __iter__
    response = self._make_request(current_kwargs)
    .tox/py3.7-boto3-v1.23/lib/python3.7....../site-packages/botocore/paginate.py:352: in _make_request
    return self._method(**current_kwargs)
    .tox/py3.7-boto3-v1.23/lib/python3.7........./site-packages/botocore/client.py:508: in _api_call
    return self._make_api_call(operation_name, kwargs)
    .tox/py3.7-boto3-v1.23/lib/python3.7........./site-packages/botocore/client.py:895: in _make_api_call
    operation_model, request_dict, request_context
    .tox/py3.7-boto3-v1.23/lib/python3.7........./site-packages/botocore/client.py:917: in _make_request
    return self._endpoint.make_request(operation_model, request_dict)
    .tox/py3.7-boto3-v1.23/lib/python3.7........./site-packages/botocore/endpoint.py:116: in make_request
    return self._send_request(request_dict, operation_model)
    .tox/py3.7-boto3-v1.23/lib/python3.7........./site-packages/botocore/endpoint.py:195: in _send_request
    request = self.create_request(request_dict, operation_model)
    .tox/py3.7-boto3-v1.23/lib/python3.7........./site-packages/botocore/endpoint.py:134: in create_request
    operation_name=operation_model.name,
    .tox/py3.7-boto3-v1.23/lib/python3.7........./site-packages/botocore/hooks.py:412: in emit
    return self._emitter.emit(aliased_event_name, **kwargs)
    .tox/py3.7-boto3-v1.23/lib/python3.7........./site-packages/botocore/hooks.py:256: in emit
    return self._emit(event_name, kwargs)
    .tox/py3.7-boto3-v1.23/lib/python3.7........./site-packages/botocore/hooks.py:239: in _emit
    response = handler(**kwargs)
    sentry_sdk/utils.py:1721: in runner
    return sentry_patched_function(*args, **kwargs)
    sentry_sdk/integrations/boto3.py:77: in _sentry_request_created
    parsed_url = parse_url(request.url, sanitize=False)
    sentry_sdk/utils.py:178: in __exit__
    capture_internal_exception((ty, value, tb))
    E TypeError: 'staticmethod' object is not callable

py3.7-common

  • Class name: tests.integrations.requests.test_requests
    Test name: test_omit_url_data_if_parsing_fails

    sentry_sdk/integrations/stdlib.py:88: in putrequest
    parsed_url = parse_url(real_url, sanitize=False)
    .../hostedtoolcache/Python/3.7.17....../x64/lib/python3.7/unittest/mock.py:1016: in __call__
    return _mock_self._mock_call(*args, **kwargs)
    .../hostedtoolcache/Python/3.7.17....../x64/lib/python3.7/unittest/mock.py:1076: in _mock_call
    raise effect
    E ValueError

    During handling of the above exception, another exception occurred:
    .../integrations/requests/test_requests.py:53: in test_omit_url_data_if_parsing_fails
    response = requests.get(url)
    .tox/py3.7-common/lib/python3.7....../site-packages/requests/api.py:73: in get
    return request("get", url, params=params, **kwargs)
    .tox/py3.7-common/lib/python3.7....../site-packages/requests/api.py:59: in request
    return session.request(method=method, url=url, **kwargs)
    .tox/py3.7-common/lib/python3.7....../site-packages/requests/sessions.py:589: in request
    resp = self.send(prep, **send_kwargs)
    .tox/py3.7-common/lib/python3.7....../site-packages/requests/sessions.py:703: in send
    r = adapter.send(request, **kwargs)
    .tox/py3.7-common/lib/python3.7.../site-packages/requests/adapters.py:497: in send
    chunked=chunked,
    .tox/py3.7-common/lib/python3.7....../site-packages/urllib3/connectionpool.py:803: in urlopen
    **response_kw,
    .tox/py3.7-common/lib/python3.7....../site-packages/urllib3/connectionpool.py:505: in _make_request
    enforce_content_length=enforce_content_length,
    .tox/py3.7-common/lib/python3.7....../site-packages/urllib3/connection.py:358: in request
    method, url, skip_accept_encoding=skip_accept_encoding, skip_host=skip_host
    .tox/py3.7-common/lib/python3.7....../site-packages/urllib3/connection.py:302: in putrequest
    method, url, skip_host=skip_host, skip_accept_encoding=skip_accept_encoding
    sentry_sdk/integrations/stdlib.py:88: in putrequest
    parsed_url = parse_url(real_url, sanitize=False)
    sentry_sdk/utils.py:178: in __exit__
    capture_internal_exception((ty, value, tb))
    E TypeError: 'staticmethod' object is not callable
  • Class name: tests.test_basics
    Test name: test_attachments_graceful_failure

    sentry_sdk/envelope.py:188: in get_bytes
    with open(self.path, "rb") as f:
    E FileNotFoundError: [Errno 2] No such file or directory: 'non_existent'

    During handling of the above exception, another exception occurred:
    tests/test_basics.py:473: in test_attachments_graceful_failure
    assert envelope.items[1].payload.get_bytes() == b""
    sentry_sdk/envelope.py:188: in get_bytes
    with open(self.path, "rb") as f:
    sentry_sdk/utils.py:178: in __exit__
    capture_internal_exception((ty, value, tb))
    E TypeError: 'staticmethod' object is not callable

py3.7-httpx-v0.23

  • Class name: tests.integrations.httpx.test_httpx
    Test name: test_omit_url_data_if_parsing_fails

    sentry_sdk/integrations/httpx.py:52: in send
    parsed_url = parse_url(str(request.url), sanitize=False)
    .../hostedtoolcache/Python/3.7.17....../x64/lib/python3.7/unittest/mock.py:1016: in __call__
    return _mock_self._mock_call(*args, **kwargs)
    .../hostedtoolcache/Python/3.7.17....../x64/lib/python3.7/unittest/mock.py:1076: in _mock_call
    raise effect
    E ValueError

    During handling of the above exception, another exception occurred:
    .../integrations/httpx/test_httpx.py:305: in test_omit_url_data_if_parsing_fails
    response = httpx_client.get(url)
    .tox/py3.7-httpx-v0.23/lib/python3.7....../site-packages/httpx/_client.py:1054: in get
    extensions=extensions,
    .tox/py3.7-httpx-v0.23/lib/python3.7....../site-packages/httpx/_client.py:821: in request
    return self.send(request, auth=auth, follow_redirects=follow_redirects)
    sentry_sdk/utils.py:1721: in runner
    return sentry_patched_function(*args, **kwargs)
    sentry_sdk/integrations/httpx.py:52: in send
    parsed_url = parse_url(str(request.url), sanitize=False)
    sentry_sdk/utils.py:178: in __exit__
    capture_internal_exception((ty, value, tb))
    E TypeError: 'staticmethod' object is not callable

py3.8-aiohttp-latest

  • Class name: tests.integrations.aiohttp.test_aiohttp
    Test name: test_tracing_unparseable_url

    sentry_sdk/integrations/aiohttp.py:204: in on_request_start
    parsed_url = parse_url(str(params.url), sanitize=False)
    .../hostedtoolcache/Python/3.8.18........./x64/lib/python3.8/unittest/mock.py:1081: in __call__
    return self._mock_call(*args, **kwargs)
    .../hostedtoolcache/Python/3.8.18........./x64/lib/python3.8/unittest/mock.py:1085: in _mock_call
    return self._execute_mock_call(*args, **kwargs)
    .../hostedtoolcache/Python/3.8.18........./x64/lib/python3.8/unittest/mock.py:1140: in _execute_mock_call
    raise effect
    E ValueError

    During handling of the above exception, another exception occurred:
    .../integrations/aiohttp/test_aiohttp.py:273: in test_tracing_unparseable_url
    resp = await client.get("/")
    .tox/py3.8-aiohttp-latest/lib/python3.8.../site-packages/aiohttp/test_utils.py:322: in _request
    resp = await self._session.request(method, self.make_url(path), **kwargs)
    .tox/py3.8-aiohttp-latest/lib/python3.8.../site-packages/aiohttp/client.py:503: in _request
    await trace.send_request_start(method, url.update_query(params), headers)
    .tox/py3.8-aiohttp-latest/lib/python3.8.../site-packages/aiohttp/tracing.py:356: in send_request_start
    return await self._trace_config.on_request_start.send(
    .tox/py3.8-aiohttp-latest/lib/python3.8.../site-packages/aiosignal/__init__.py:36: in send
    await receiver(*args, **kwargs) # type: ignore
    sentry_sdk/integrations/aiohttp.py:204: in on_request_start
    parsed_url = parse_url(str(params.url), sanitize=False)
    sentry_sdk/utils.py:178: in __exit__
    capture_internal_exception((ty, value, tb))
    E TypeError: 'staticmethod' object is not callable

py3.8-common

  • Class name: tests.integrations.requests.test_requests
    Test name: test_omit_url_data_if_parsing_fails

    sentry_sdk/integrations/stdlib.py:88: in putrequest
    parsed_url = parse_url(real_url, sanitize=False)
    .../hostedtoolcache/Python/3.8.18........./x64/lib/python3.8/unittest/mock.py:1081: in __call__
    return self._mock_call(*args, **kwargs)
    .../hostedtoolcache/Python/3.8.18........./x64/lib/python3.8/unittest/mock.py:1085: in _mock_call
    return self._execute_mock_call(*args, **kwargs)
    .../hostedtoolcache/Python/3.8.18........./x64/lib/python3.8/unittest/mock.py:1140: in _execute_mock_call
    raise effect
    E ValueError

    During handling of the above exception, another exception occurred:
    .../integrations/requests/test_requests.py:53: in test_omit_url_data_if_parsing_fails
    response = requests.get(url)
    .tox/py3.8-common/lib/python3.8....../site-packages/requests/api.py:73: in get
    return request("get", url, params=params, **kwargs)
    .tox/py3.8-common/lib/python3.8....../site-packages/requests/api.py:59: in request
    return session.request(method=method, url=url, **kwargs)
    .tox/py3.8-common/lib/python3.8....../site-packages/requests/sessions.py:589: in request
    resp = self.send(prep, **send_kwargs)
    .tox/py3.8-common/lib/python3.8....../site-packages/requests/sessions.py:703: in send
    r = adapter.send(request, **kwargs)
    .tox/py3.8-common/lib/python3.8.../site-packages/requests/adapters.py:667: in send
    resp = conn.urlopen(
    .tox/py3.8-common/lib/python3.8....../site-packages/urllib3/connectionpool.py:789: in urlopen
    response = self._make_request(
    .tox/py3.8-common/lib/python3.8....../site-packages/urllib3/connectionpool.py:495: in _make_request
    conn.request(
    .tox/py3.8-common/lib/python3.8....../site-packages/urllib3/connection.py:360: in request
    self.putrequest(
    .tox/py3.8-common/lib/python3.8....../site-packages/urllib3/connection.py:304: in putrequest
    return super().putrequest(
    sentry_sdk/integrations/stdlib.py:88: in putrequest
    parsed_url = parse_url(real_url, sanitize=False)
    sentry_sdk/utils.py:178: in __exit__
    capture_internal_exception((ty, value, tb))
    E TypeError: 'staticmethod' object is not callable
  • Class name: tests.test_basics
    Test name: test_attachments_graceful_failure

    sentry_sdk/envelope.py:188: in get_bytes
    with open(self.path, "rb") as f:
    E FileNotFoundError: [Errno 2] No such file or directory: 'non_existent'

    During handling of the above exception, another exception occurred:
    tests/test_basics.py:473: in test_attachments_graceful_failure
    assert envelope.items[1].payload.get_bytes() == b""
    sentry_sdk/envelope.py:188: in get_bytes
    with open(self.path, "rb") as f:
    sentry_sdk/utils.py:178: in __exit__
    capture_internal_exception((ty, value, tb))
    E TypeError: 'staticmethod' object is not callable

py3.8-gevent

  • Class name: tests.integrations.requests.test_requests
    Test name: test_omit_url_data_if_parsing_fails

    sentry_sdk/integrations/stdlib.py:88: in putrequest
    parsed_url = parse_url(real_url, sanitize=False)
    .../hostedtoolcache/Python/3.8.18........./x64/lib/python3.8/unittest/mock.py:1081: in __call__
    return self._mock_call(*args, **kwargs)
    .../hostedtoolcache/Python/3.8.18........./x64/lib/python3.8/unittest/mock.py:1085: in _mock_call
    return self._execute_mock_call(*args, **kwargs)
    .../hostedtoolcache/Python/3.8.18........./x64/lib/python3.8/unittest/mock.py:1140: in _execute_mock_call
    raise effect
    E ValueError

    During handling of the above exception, another exception occurred:
    .../integrations/requests/test_requests.py:53: in test_omit_url_data_if_parsing_fails
    response = requests.get(url)
    .tox/py3.8-gevent/lib/python3.8....../site-packages/requests/api.py:73: in get
    return request("get", url, params=params, **kwargs)
    .tox/py3.8-gevent/lib/python3.8....../site-packages/requests/api.py:59: in request
    return session.request(method=method, url=url, **kwargs)
    .tox/py3.8-gevent/lib/python3.8....../site-packages/requests/sessions.py:589: in request
    resp = self.send(prep, **send_kwargs)
    .tox/py3.8-gevent/lib/python3.8....../site-packages/requests/sessions.py:703: in send
    r = adapter.send(request, **kwargs)
    .tox/py3.8-gevent/lib/python3.8.../site-packages/requests/adapters.py:667: in send
    resp = conn.urlopen(
    .tox/py3.8-gevent/lib/python3.8....../site-packages/urllib3/connectionpool.py:789: in urlopen
    response = self._make_request(
    .tox/py3.8-gevent/lib/python3.8....../site-packages/urllib3/connectionpool.py:495: in _make_request
    conn.request(
    .tox/py3.8-gevent/lib/python3.8....../site-packages/urllib3/connection.py:360: in request
    self.putrequest(
    .tox/py3.8-gevent/lib/python3.8....../site-packages/urllib3/connection.py:304: in putrequest
    return super().putrequest(
    sentry_sdk/integrations/stdlib.py:88: in putrequest
    parsed_url = parse_url(real_url, sanitize=False)
    sentry_sdk/utils.py:178: in __exit__
    capture_internal_exception((ty, value, tb))
    E TypeError: 'staticmethod' object is not callable
  • Class name: tests.test_basics
    Test name: test_attachments_graceful_failure

    sentry_sdk/envelope.py:188: in get_bytes
    with open(self.path, "rb") as f:
    E FileNotFoundError: [Errno 2] No such file or directory: 'non_existent'

    During handling of the above exception, another exception occurred:
    tests/test_basics.py:473: in test_attachments_graceful_failure
    assert envelope.items[1].payload.get_bytes() == b""
    sentry_sdk/envelope.py:188: in get_bytes
    with open(self.path, "rb") as f:
    sentry_sdk/utils.py:178: in __exit__
    capture_internal_exception((ty, value, tb))
    E TypeError: 'staticmethod' object is not callable

py3.9-aiohttp-v3.8

  • Class name: tests.integrations.aiohttp.test_aiohttp
    Test name: test_tracing_unparseable_url

    sentry_sdk/integrations/aiohttp.py:204: in on_request_start
    parsed_url = parse_url(str(params.url), sanitize=False)
    .../hostedtoolcache/Python/3.9.19........./x64/lib/python3.9/unittest/mock.py:1092: in __call__
    return self._mock_call(*args, **kwargs)
    .../hostedtoolcache/Python/3.9.19........./x64/lib/python3.9/unittest/mock.py:1096: in _mock_call
    return self._execute_mock_call(*args, **kwargs)
    .../hostedtoolcache/Python/3.9.19........./x64/lib/python3.9/unittest/mock.py:1151: in _execute_mock_call
    raise effect
    E ValueError

    During handling of the above exception, another exception occurred:
    .../integrations/aiohttp/test_aiohttp.py:273: in test_tracing_unparseable_url
    resp = await client.get("/")
    .tox/py3.9-aiohttp-v3.8/lib/python3.9.../site-packages/aiohttp/test_utils.py:324: in _request
    resp = await self._session.request(method, self.make_url(path), **kwargs)
    .tox/py3.9-aiohttp-v3.8/lib/python3.9.../site-packages/aiohttp/client.py:489: in _request
    await trace.send_request_start(method, url.update_query(params), headers)
    .tox/py3.9-aiohttp-v3.8/lib/python3.9.../site-packages/aiohttp/tracing.py:357: in send_request_start
    return await self._trace_config.on_request_start.send(
    .tox/py3.9-aiohttp-v3.8/lib/python3.9.../site-packages/aiosignal/__init__.py:36: in send
    await receiver(*args, **kwargs) # type: ignore
    sentry_sdk/integrations/aiohttp.py:204: in on_request_start
    parsed_url = parse_url(str(params.url), sanitize=False)
    sentry_sdk/utils.py:178: in __exit__
    capture_internal_exception((ty, value, tb))
    E TypeError: 'staticmethod' object is not callable

py3.9-common

  • Class name: tests.integrations.requests.test_requests
    Test name: test_omit_url_data_if_parsing_fails

    sentry_sdk/integrations/stdlib.py:88: in putrequest
    parsed_url = parse_url(real_url, sanitize=False)
    .../hostedtoolcache/Python/3.9.19........./x64/lib/python3.9/unittest/mock.py:1092: in __call__
    return self._mock_call(*args, **kwargs)
    .../hostedtoolcache/Python/3.9.19........./x64/lib/python3.9/unittest/mock.py:1096: in _mock_call
    return self._execute_mock_call(*args, **kwargs)
    .../hostedtoolcache/Python/3.9.19........./x64/lib/python3.9/unittest/mock.py:1151: in _execute_mock_call
    raise effect
    E ValueError

    During handling of the above exception, another exception occurred:
    .../integrations/requests/test_requests.py:53: in test_omit_url_data_if_parsing_fails
    response = requests.get(url)
    .tox/py3.9-common/lib/python3.9....../site-packages/requests/api.py:73: in get
    return request("get", url, params=params, **kwargs)
    .tox/py3.9-common/lib/python3.9....../site-packages/requests/api.py:59: in request
    return session.request(method=method, url=url, **kwargs)
    .tox/py3.9-common/lib/python3.9....../site-packages/requests/sessions.py:589: in request
    resp = self.send(prep, **send_kwargs)
    .tox/py3.9-common/lib/python3.9....../site-packages/requests/sessions.py:703: in send
    r = adapter.send(request, **kwargs)
    .tox/py3.9-common/lib/python3.9.../site-packages/requests/adapters.py:667: in send
    resp = conn.urlopen(
    .tox/py3.9-common/lib/python3.9....../site-packages/urllib3/connectionpool.py:789: in urlopen
    response = self._make_request(
    .tox/py3.9-common/lib/python3.9....../site-packages/urllib3/connectionpool.py:495: in _make_request
    conn.request(
    .tox/py3.9-common/lib/python3.9....../site-packages/urllib3/connection.py:360: in request
    self.putrequest(
    .tox/py3.9-common/lib/python3.9....../site-packages/urllib3/connection.py:304: in putrequest
    return super().putrequest(
    sentry_sdk/integrations/stdlib.py:88: in putrequest
    parsed_url = parse_url(real_url, sanitize=False)
    sentry_sdk/utils.py:178: in __exit__
    capture_internal_exception((ty, value, tb))
    E TypeError: 'staticmethod' object is not callable
  • Class name: tests.test_basics
    Test name: test_attachments_graceful_failure

    sentry_sdk/envelope.py:188: in get_bytes
    with open(self.path, "rb") as f:
    E FileNotFoundError: [Errno 2] No such file or directory: 'non_existent'

    During handling of the above exception, another exception occurred:
    tests/test_basics.py:473: in test_attachments_graceful_failure
    assert envelope.items[1].payload.get_bytes() == b""
    sentry_sdk/envelope.py:189: in get_bytes
    self.bytes = f.read()
    sentry_sdk/utils.py:178: in __exit__
    capture_internal_exception((ty, value, tb))
    E TypeError: 'staticmethod' object is not callable

py3.9-httpx-latest

  • Class name: tests.integrations.httpx.test_httpx
    Test name: test_omit_url_data_if_parsing_fails

    sentry_sdk/integrations/httpx.py:52: in send
    parsed_url = parse_url(str(request.url), sanitize=False)
    .../hostedtoolcache/Python/3.9.19........./x64/lib/python3.9/unittest/mock.py:1092: in __call__
    return self._mock_call(*args, **kwargs)
    .../hostedtoolcache/Python/3.9.19........./x64/lib/python3.9/unittest/mock.py:1096: in _mock_call
    return self._execute_mock_call(*args, **kwargs)
    .../hostedtoolcache/Python/3.9.19........./x64/lib/python3.9/unittest/mock.py:1151: in _execute_mock_call
    raise effect
    E ValueError

    During handling of the above exception, another exception occurred:
    .../integrations/httpx/test_httpx.py:305: in test_omit_url_data_if_parsing_fails
    response = httpx_client.get(url)
    .tox/py3.9-httpx-latest/lib/python3.9....../site-packages/httpx/_client.py:1054: in get
    return self.request(
    .tox/py3.9-httpx-latest/lib/python3.9....../site-packages/httpx/_client.py:827: in request
    return self.send(request, auth=auth, follow_redirects=follow_redirects)
    sentry_sdk/utils.py:1721: in runner
    return sentry_patched_function(*args, **kwargs)
    sentry_sdk/integrations/httpx.py:52: in send
    parsed_url = parse_url(str(request.url), sanitize=False)
    sentry_sdk/utils.py:178: in __exit__
    capture_internal_exception((ty, value, tb))
    E TypeError: 'staticmethod' object is not callable

py3.9-httpx-v0.27

  • Class name: tests.integrations.httpx.test_httpx
    Test name: test_omit_url_data_if_parsing_fails

    sentry_sdk/integrations/httpx.py:52: in send
    parsed_url = parse_url(str(request.url), sanitize=False)
    .../hostedtoolcache/Python/3.9.19........./x64/lib/python3.9/unittest/mock.py:1092: in __call__
    return self._mock_call(*args, **kwargs)
    .../hostedtoolcache/Python/3.9.19........./x64/lib/python3.9/unittest/mock.py:1096: in _mock_call
    return self._execute_mock_call(*args, **kwargs)
    .../hostedtoolcache/Python/3.9.19........./x64/lib/python3.9/unittest/mock.py:1151: in _execute_mock_call
    raise effect
    E ValueError

    During handling of the above exception, another exception occurred:
    .../integrations/httpx/test_httpx.py:305: in test_omit_url_data_if_parsing_fails
    response = httpx_client.get(url)
    .tox/py3.9-httpx-v0.27/lib/python3.9....../site-packages/httpx/_client.py:1054: in get
    return self.request(
    .tox/py3.9-httpx-v0.27/lib/python3.9....../site-packages/httpx/_client.py:827: in request
    return self.send(request, auth=auth, follow_redirects=follow_redirects)
    sentry_sdk/utils.py:1721: in runner
    return sentry_patched_function(*args, **kwargs)
    sentry_sdk/integrations/httpx.py:52: in send
    parsed_url = parse_url(str(request.url), sanitize=False)
    sentry_sdk/utils.py:178: in __exit__
    capture_internal_exception((ty, value, tb))
    E TypeError: 'staticmethod' object is not callable

@sl0thentr0py sl0thentr0py force-pushed the neel/prepare-scope-management branch from c9598b1 to 1fb1170 Compare July 26, 2024 14:25
@sl0thentr0py sl0thentr0py changed the title WIP Expose top level scope apis Expose the scope getters to top level API and use them everywhere Jul 26, 2024
@sl0thentr0py sl0thentr0py force-pushed the neel/prepare-scope-management branch 2 times, most recently from 88eaf8a to e67291c Compare July 26, 2024 14:32
Copy link
Contributor

@sentrivana sentrivana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, see small comments

Copy link
Member

@antonpirker antonpirker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Just a few nitpicks

@@ -512,15 +512,15 @@ def get_traceparent(self, *args, **kwargs):
return traceparent

# Fall back to isolation scope's traceparent. It always has one
return Scope.get_isolation_scope().get_traceparent()
return self.get_isolation_scope().get_traceparent()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In scope.py here we use self.get_x() because in the future we will have a check in api.get_x() for otel or sentry and we do not want to call the check all the time?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, there will be a PotelScope class that will inherit from Scope but the internal getters/setters will be different

sl0thentr0py and others added 6 commits July 29, 2024 14:17
* Going forward, we might have 2 different scope implementations so we
can't have the `Scope` class being called everywhere directly since this
will be abstracted away.
Co-authored-by: Ivana Kellyer <ivana.kellyer@sentry.io>
@sl0thentr0py sl0thentr0py force-pushed the neel/prepare-scope-management branch from c577b31 to 1d6420c Compare July 29, 2024 12:17
@sl0thentr0py sl0thentr0py marked this pull request as ready for review July 29, 2024 12:17
@sl0thentr0py sl0thentr0py merged commit bd293e5 into master Jul 29, 2024
124 checks passed
@sl0thentr0py sl0thentr0py deleted the neel/prepare-scope-management branch July 29, 2024 12:31
szokeasaurusrex added a commit that referenced this pull request Aug 8, 2024
We removed this line in #3354 since it is no longer needed, but it was apparently accidentally added back in #3357.
szokeasaurusrex added a commit that referenced this pull request Aug 8, 2024
We removed this line in #3354 since it is no longer needed, but it was apparently accidentally added back in #3357.
sentrivana pushed a commit that referenced this pull request Aug 12, 2024
We removed this line in #3354 since it is no longer needed, but it was apparently accidentally added back in #3357.
arjennienhuis pushed a commit to arjennienhuis/sentry-python that referenced this pull request Sep 30, 2024
…tsentry#3357)

* Expose the scope getters to top level API and use them everywhere

* Going forward, we might have 2 different scope implementations so we
can't have the `Scope` class being called everywhere directly since this
will be abstracted away.

* Update CHANGELOG.md

Co-authored-by: Ivana Kellyer <ivana.kellyer@sentry.io>

* remove Scope._capture_internal_exception

* review fixes

* remove staticmethod

* Fix sphinx circular import bs

---------

Co-authored-by: Ivana Kellyer <ivana.kellyer@sentry.io>
arjennienhuis pushed a commit to arjennienhuis/sentry-python that referenced this pull request Sep 30, 2024
We removed this line in getsentry#3354 since it is no longer needed, but it was apparently accidentally added back in getsentry#3357.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants