Skip to content

_sentry_monitoring.py seems unnecessary #75

Open

Description

@brettcs

It looks like the main point of this module is to make sentry_sdk a noop if there is no DSN configured (for testing etc.). But as far as I can tell, that functionality is already built into the module:

>>> import os, sentry_sdk
>>> os.environ  # Note: no config
environ({'HOME': '/root', 'HOSTNAME': '7b1a35fdabd7', 'PATH': '/workspace/.venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 'TERM': 'xterm', 'UV': '/usr/local/bin/uv', 'UV_RUN_RECURSION_DEPTH': '1', 'UV_TOOL_BIN_DIR': '/usr/local/bin', 'VIRTUAL_ENV': '/workspace/.venv', 'container': 'podman', 'LC_CTYPE': 'C.UTF-8'})
>>> sentry_sdk.init()  # Ditto
<sentry_sdk._init_implementation._InitGuard object at 0x7eff4a44c050>
>>> sentry_sdk.logger.error("no config")
>>> try:
...     1 / 0
... except ZeroDivisionError:
...     sentry_sdk.capture_exception()
...     print("capture OK")
...     
capture OK

I think we could rely on this behavior, use sentry_sdk directly, and remove this layer of indirection.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions