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

[Ep2024-sprints][gh-1638] - Bump aio-pika schema version from 1.11.0 to 1.26.0 #2705

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

P6rguVyrst
Copy link

@P6rguVyrst P6rguVyrst commented Jul 13, 2024

Description

Make sure aio-pika instrumentation follows semantic conventions.

Fixes #1638

Breaking Attribute Changes:

  • messaging.destination to messaging.destination.name, messaging.rabbitmq.destination.routing_key
  • messaging.conversation_id to messaging.message.conversation_id
  • messaging.temp_destination to messaging.destination.temporary

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • tox -f py312-aio-pika -- -ra
===================================================================== 9 passed, 7 skipped, 1 warning in 1.45s =====================================================================
  py312-test-instrumentation-aio-pika-0: OK (44.09=setup[0.20]+cmd[9.33,11.51,15.68,6.36,1.01] seconds)
  py312-test-instrumentation-aio-pika-1: OK (40.34=setup[0.05]+cmd[10.33,12.96,9.89,6.28,0.83] seconds)
  py312-test-instrumentation-aio-pika-2: OK (41.36=setup[0.07]+cmd[12.15,10.66,10.60,7.05,0.83] seconds)
  py312-test-instrumentation-aio-pika-3: OK (50.91=setup[0.05]+cmd[13.01,11.57,10.96,12.74,2.59] seconds)
  congratulations :) (176.91 seconds)

Does This PR Require a Core Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

Copy link

linux-foundation-easycla bot commented Jul 13, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

Copy link
Contributor

@xrmx xrmx left a comment

Choose a reason for hiding this comment

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

Question is: should be keep some kind of compat for current users or not? Messaging is still experimental so it's not required but still.

@P6rguVyrst P6rguVyrst requested a review from a team July 13, 2024 13:45
@emdneto
Copy link
Member

emdneto commented Jul 13, 2024

Question is: should be keep some kind of compat for current users or not? Messaging is still experimental so it's not required but still.

@xrmx From my understanding here: #2351, it is up to us to decide whether to include an opt-in mode for instrumentation, but I think this case is different since the attributes are in _incubating (experimental)

@P6rguVyrst
Copy link
Author

P6rguVyrst commented Jul 13, 2024

Pushed a bigger change that should ideally be reviewed by someone with more intimate knowledge of RabbitMQ.

Previously, the messaging.destination.name span attribute was flawed, as when using callback_decorator it needed both message.exchange AND message.routing_key to exist, BUT only used the latter as the “destination” - if it was present...

We can validate this via:

(venv) ➜  opentelemetry-instrumentation-aio-pika git:(main) ✗ python
>>> class Message:
...   def __init__(self):
...     self.routing_key = 1
... 
>>> message = Message()
>>> message.exchange or message.routing_key
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'Message' object has no attribute 'exchange'

This PR, in addition to updating the instrumentation to follow the spec more closely, also follows the zen of python “Explicit is better than implicit.” - what is “destination”? The destination has multiple dimensions, and both exchange & routing_key carry identifying information.

MessagingOperationValues,
SpanAttributes,
from opentelemetry.semconv._incubating.attributes import (
messaging_attributes as SpanAttributes,
Copy link
Contributor

Choose a reason for hiding this comment

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

After the new semconv package reorganization people are just importing the variables straight from their module, I guess for the long names. In this case something like:

from opentelemetry.semconv._incubating.attributes.messaging_attributes import MESSAGING_DESTINATION_NAME, MESSAGING_RABBITMQ_DESTINATION_ROUTING_KEY, MESSAGING_MESSAGE_ID, MESSAGING_MESSAGE_CONVERSATION_ID, SpanAttributes.MESSAGING_OPERATION_TYPE, SpanAttributes.MESSAGING_OPERATION_TYPE]
from opentelemetry.semconv._incubating.attributes.net_attributes import NET_PEER_NAME, NET_PEER_PORT

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.

Make sure aio-pika instrumentation follows semantic conventions
3 participants