-
Notifications
You must be signed in to change notification settings - Fork 194
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
Feature/wait reopen channel state #533
Conversation
886b18b
to
e3d0144
Compare
e3d0144
to
fccdefd
Compare
0f116f8
to
ffc8435
Compare
661938c
to
9a27311
Compare
@mosquito question about this with the removed In the aio_pika OpenTelemetry instrumentation located here there are a few fallbacks to getting the active URL from the channel. The connection url is being retrieved from the channel since that's all that is really available at publish time, which otel decorates here. I'm wondering if you have some advice on what the correct thing to do in this case would be to support the changes in 9.1 while still supporting 7.x, 8.x and 9.1+? I would hate to drop down to use async def set_channel(self, channel: AbstractChannel):
# aio_rmq 9.1 removed the connection attribute from the abstract listings
if hasattr(channel, "get_underlay_channel"):
connection = (await channel.get_underlay_channel()).connection
else:
connection = channel.connection
if getattr(connection, "connection", None):
# aio_rmq 7
url = connection.connection.url
else:
# aio_rmq 8
url = connection.url
self._attributes.update(
{
SpanAttributes.NET_PEER_NAME: url.host,
SpanAttributes.NET_PEER_PORT: url.port,
}
) Or would it be better in your opinion to keep this sync and check for async def set_channel(self, channel: AbstractChannel):
# aio_rmq 9.1 removed the connection attribute from the abstract listings
if hasattr(channel, "_connection"):
connection = channel._connection
else:
connection = channel.connection
if getattr(connection, "connection", None):
# aio_rmq 7
url = connection.connection.url
else:
# aio_rmq 8
url = connection.url
self._attributes.update(
{
SpanAttributes.NET_PEER_NAME: url.host,
SpanAttributes.NET_PEER_PORT: url.port,
}
) |
Fixes #505