diff --git a/faststream/nats/opentelemetry/provider.py b/faststream/nats/opentelemetry/provider.py index 3c8d00854e..7c33a7d76b 100644 --- a/faststream/nats/opentelemetry/provider.py +++ b/faststream/nats/opentelemetry/provider.py @@ -110,7 +110,7 @@ def telemetry_attributes_provider_factory( ]: if isinstance(msg, Sequence): return NatsBatchTelemetrySettingsProvider() - elif isinstance(msg, Msg): + elif isinstance(msg, Msg) or msg is None: return NatsTelemetrySettingsProvider() else: # KeyValue and Object Storage watch cases diff --git a/tests/brokers/nats/test_kv_declarer_cache.py b/tests/brokers/nats/test_kv_declarer_cache.py index e7caf072bb..1c85be3a5a 100644 --- a/tests/brokers/nats/test_kv_declarer_cache.py +++ b/tests/brokers/nats/test_kv_declarer_cache.py @@ -8,6 +8,7 @@ @pytest.mark.asyncio() +@pytest.mark.nats() async def test_kv_storage_cache(): broker = NatsBroker() await broker.connect() diff --git a/tests/brokers/nats/test_os_declarer_cache.py b/tests/brokers/nats/test_os_declarer_cache.py index 9a3778105b..d7107e27e0 100644 --- a/tests/brokers/nats/test_os_declarer_cache.py +++ b/tests/brokers/nats/test_os_declarer_cache.py @@ -8,6 +8,7 @@ @pytest.mark.asyncio() +@pytest.mark.nats() async def test_object_storage_cache(): broker = NatsBroker() await broker.connect()