Skip to content
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

[ServiceBus] update amqpLink/Session/Connection network trace to comply with otel spec #34237

Closed

Conversation

swathipil
Copy link
Member

@swathipil swathipil commented Feb 8, 2024

Fixing #32190

Currently, the network trace values amqpLink/Session/Connection IDs are set to None by default, which results in errors when used with otel. As per the OpenTelemetry spec, attribute values should not be None but CAN BE empty strings. Fixing to comply with the otel spec.

Adding a snippet to the README logging section to be used for formatting/logging this extra network trace info.

TODO:

  • sync changes with EH pyamqp + README

@azure-sdk
Copy link
Collaborator

API change check

API changes are not detected in this pull request.


def format(self, record: logging.LogRecord) -> str:
if not "amqpConnection" in record.__dict__:
record.__dict__["amqpConnection"] = None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the values are not supposed to be None, why are they being set so here?

Copy link
Member Author

@swathipil swathipil Feb 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they aren't supposed to be None for Otel, but if we're just printing them out/logging to other places, this should be fine. However, you're right in that I'm not sure how exactly this will affect otel, since the same extra params won't be present everywhere.

@@ -135,7 +135,7 @@ def __init__( # pylint:disable=too-many-locals,too-many-statements
custom_endpoint = f"{custom_parsed_url.hostname}:{custom_port}{custom_parsed_url.path}"
self._container_id = container_id or str(uuid.uuid4())
self._network_trace = network_trace
self._network_trace_params = {"amqpConnection": self._container_id, "amqpSession": None, "amqpLink": None}
self._network_trace_params = {"amqpConnection": self._container_id}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

didn't we add this to fix another bug in our set up ? Would this cause it to resurface those errors?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so?

@swathipil
Copy link
Member Author

closing in favor of #34365

@swathipil swathipil closed this Feb 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants