diff --git a/lite_bootstrap/instruments/logging_instrument.py b/lite_bootstrap/instruments/logging_instrument.py index d12c216..a830520 100644 --- a/lite_bootstrap/instruments/logging_instrument.py +++ b/lite_bootstrap/instruments/logging_instrument.py @@ -137,7 +137,7 @@ def structlog_pre_chain_processors(self) -> list[typing.Any]: ] def is_ready(self) -> bool: - return self.bootstrap_config.logging_enabled and import_checker.is_structlog_installed + return self.bootstrap_config.logging_enabled @staticmethod def check_dependencies() -> bool: diff --git a/lite_bootstrap/instruments/opentelemetry_instrument.py b/lite_bootstrap/instruments/opentelemetry_instrument.py index bcad0ee..bf80150 100644 --- a/lite_bootstrap/instruments/opentelemetry_instrument.py +++ b/lite_bootstrap/instruments/opentelemetry_instrument.py @@ -83,10 +83,7 @@ class OpenTelemetryInstrument(BaseInstrument): ) def is_ready(self) -> bool: - return ( - bool(self.bootstrap_config.opentelemetry_endpoint or self.bootstrap_config.opentelemetry_log_traces) - and import_checker.is_opentelemetry_installed - ) + return bool(self.bootstrap_config.opentelemetry_endpoint or self.bootstrap_config.opentelemetry_log_traces) @staticmethod def check_dependencies() -> bool: diff --git a/lite_bootstrap/instruments/pyroscope_instrument.py b/lite_bootstrap/instruments/pyroscope_instrument.py index d6bf89e..a5f293a 100644 --- a/lite_bootstrap/instruments/pyroscope_instrument.py +++ b/lite_bootstrap/instruments/pyroscope_instrument.py @@ -26,7 +26,7 @@ class PyroscopeInstrument(BaseInstrument): missing_dependency_message = "pyroscope is not installed" def is_ready(self) -> bool: - return bool(self.bootstrap_config.pyroscope_endpoint) and import_checker.is_pyroscope_installed + return bool(self.bootstrap_config.pyroscope_endpoint) @staticmethod def check_dependencies() -> bool: diff --git a/lite_bootstrap/instruments/sentry_instrument.py b/lite_bootstrap/instruments/sentry_instrument.py index 5badb17..370e86f 100644 --- a/lite_bootstrap/instruments/sentry_instrument.py +++ b/lite_bootstrap/instruments/sentry_instrument.py @@ -17,7 +17,7 @@ IGNORED_STRUCTLOG_ATTRIBUTES: typing.Final = frozenset( - {"event", "level", "logger", "tracing", "timestamp", "exception"} + {"event", "level", "logger", "tracing", "timestamp", "exception", "skip_sentry"} ) @@ -98,7 +98,7 @@ class SentryInstrument(BaseInstrument): missing_dependency_message = "sentry_sdk is not installed" def is_ready(self) -> bool: - return bool(self.bootstrap_config.sentry_dsn) and import_checker.is_sentry_installed + return bool(self.bootstrap_config.sentry_dsn) @staticmethod def check_dependencies() -> bool: diff --git a/tests/instruments/test_sentry_instrument.py b/tests/instruments/test_sentry_instrument.py index 0473744..38edf4d 100644 --- a/tests/instruments/test_sentry_instrument.py +++ b/tests/instruments/test_sentry_instrument.py @@ -108,6 +108,16 @@ def test_skip(self, event: "sentry_types.Event") -> None: "contexts": {"structlog": {"foo": "bar"}}, }, ), + ( + { + "logentry": {"formatted": '{"event": "event name", "skip_sentry": false, "foo": "bar"}'}, + "contexts": {}, + }, + { + "logentry": {"formatted": "event name"}, + "contexts": {"structlog": {"foo": "bar"}}, + }, + ), ], ) def test_modify(self, event_before: "sentry_types.Event", event_after: "sentry_types.Event") -> None: