Skip to content

Fix FastStream & OTEL deprecations #126

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions packages/faststream-stomp/faststream_stomp/broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ def __init__(
# Logging args
logger: LoggerProto | None = EMPTY,
log_level: int = logging.INFO,
log_fmt: str | None = None,
# FastDepends args
apply_types: bool = True,
validate: bool = True,
Expand All @@ -77,7 +76,6 @@ def __init__(
graceful_timeout=graceful_timeout,
logger=logger,
log_level=log_level,
log_fmt=log_fmt,
apply_types=apply_types,
validate=validate,
_get_dependant=_get_dependant,
Expand Down
13 changes: 7 additions & 6 deletions packages/faststream-stomp/faststream_stomp/opentelemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from faststream.opentelemetry.middleware import TelemetryMiddleware
from faststream.types import AnyDict
from opentelemetry.metrics import Meter, MeterProvider
from opentelemetry.semconv._incubating.attributes import messaging_attributes # noqa: PLC2701
from opentelemetry.semconv.trace import SpanAttributes
from opentelemetry.trace import TracerProvider

Expand All @@ -16,9 +17,9 @@ class StompTelemetrySettingsProvider(TelemetrySettingsProvider[stompman.MessageF

def get_consume_attrs_from_message(self, msg: StreamMessage[stompman.MessageFrame]) -> "AnyDict":
return {
SpanAttributes.MESSAGING_SYSTEM: self.messaging_system,
SpanAttributes.MESSAGING_MESSAGE_ID: msg.message_id,
SpanAttributes.MESSAGING_MESSAGE_CONVERSATION_ID: msg.correlation_id,
messaging_attributes.MESSAGING_SYSTEM: self.messaging_system,
messaging_attributes.MESSAGING_MESSAGE_ID: msg.message_id,
messaging_attributes.MESSAGING_MESSAGE_CONVERSATION_ID: msg.correlation_id,
SpanAttributes.MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES: len(msg.body),
MESSAGING_DESTINATION_PUBLISH_NAME: msg.raw_message.headers["destination"],
}
Expand All @@ -28,11 +29,11 @@ def get_consume_destination_name(self, msg: StreamMessage[stompman.MessageFrame]

def get_publish_attrs_from_kwargs(self, kwargs: StompProducerPublishKwargs) -> AnyDict: # type: ignore[override]
publish_attrs = {
SpanAttributes.MESSAGING_SYSTEM: self.messaging_system,
SpanAttributes.MESSAGING_DESTINATION_NAME: kwargs["destination"],
messaging_attributes.MESSAGING_SYSTEM: self.messaging_system,
messaging_attributes.MESSAGING_DESTINATION_NAME: kwargs["destination"],
}
if kwargs["correlation_id"]:
publish_attrs[SpanAttributes.MESSAGING_MESSAGE_CONVERSATION_ID] = kwargs["correlation_id"]
publish_attrs[messaging_attributes.MESSAGING_MESSAGE_CONVERSATION_ID] = kwargs["correlation_id"]
return publish_attrs

def get_publish_destination_name(self, kwargs: StompProducerPublishKwargs) -> str: # type: ignore[override] # noqa: PLR6301
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ async def test_subscriber_lifespan(faker: faker.Faker, broker: faststream_stomp.
def _() -> None: ...

await broker.start()
await broker.close()
await broker.stop()


class TestPing:
Expand Down