Fix compatibility issue aio-pika instrumentation (#2450)
* - fixed compatibility issue in set_channel of span_builder.py - changed test-requirements-2.txt to use aio-pika==9.0.5 - added test-requirements-3.txt to use aio-pika==9.4.1 (latest atm) - tox.ini: fixed incorrect commands_pre which would always install test-requirements-2.txt and cause dep installation conflict - tox.ini: added aio-pika-3 commands * Add version comment for aio-pika --------- Co-authored-by: Diego Hurtado <ocelotl@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									5cb4dab364
								
							
						
					
					
						commit
						0980486f2f
					
				|  | @ -47,8 +47,13 @@ class SpanBuilder: | |||
|         self._attributes[SpanAttributes.MESSAGING_DESTINATION] = destination | ||||
| 
 | ||||
|     def set_channel(self, channel: AbstractChannel): | ||||
|         connection = channel.connection | ||||
|         if getattr(connection, "connection", None): | ||||
|         if hasattr(channel, "_connection"): | ||||
|             # aio_rmq 9.1 and above removed the connection attribute from the abstract listings | ||||
|             connection = channel._connection | ||||
|         else: | ||||
|             # aio_rmq 9.0.5 and below | ||||
|             connection = channel.connection | ||||
|         if hasattr(connection, "connection"): | ||||
|             # aio_rmq 7 | ||||
|             url = connection.connection.url | ||||
|         else: | ||||
|  | @ -57,7 +62,7 @@ class SpanBuilder: | |||
|         self._attributes.update( | ||||
|             { | ||||
|                 SpanAttributes.NET_PEER_NAME: url.host, | ||||
|                 SpanAttributes.NET_PEER_PORT: url.port, | ||||
|                 SpanAttributes.NET_PEER_PORT: url.port or 5672, | ||||
|             } | ||||
|         ) | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,5 +1,5 @@ | |||
| aio-pika==9.4.0 | ||||
| aiormq==6.8.0 | ||||
| aio-pika==9.0.5 | ||||
| aiormq==6.7.1 | ||||
| asgiref==3.7.2 | ||||
| attrs==23.2.0 | ||||
| Deprecated==1.2.14 | ||||
|  | @ -8,7 +8,7 @@ importlib-metadata==6.11.0 | |||
| iniconfig==2.0.0 | ||||
| multidict==6.0.5 | ||||
| packaging==23.2 | ||||
| pamqp==3.3.0 | ||||
| pamqp==3.2.1 | ||||
| pluggy==1.4.0 | ||||
| py==1.11.0 | ||||
| py-cpuinfo==9.0.0 | ||||
|  |  | |||
|  | @ -0,0 +1,23 @@ | |||
| aio-pika==9.4.1 | ||||
| aiormq==6.8.0 | ||||
| asgiref==3.7.2 | ||||
| attrs==23.2.0 | ||||
| Deprecated==1.2.14 | ||||
| idna==3.6 | ||||
| importlib-metadata==6.11.0 | ||||
| iniconfig==2.0.0 | ||||
| multidict==6.0.5 | ||||
| packaging==23.2 | ||||
| pamqp==3.3.0 | ||||
| pluggy==1.4.0 | ||||
| py==1.11.0 | ||||
| py-cpuinfo==9.0.0 | ||||
| pytest==7.1.3 | ||||
| pytest-benchmark==4.0.0 | ||||
| tomli==2.0.1 | ||||
| typing_extensions==4.9.0 | ||||
| wrapt==1.16.0 | ||||
| yarl==1.9.4 | ||||
| zipp==3.17.0 | ||||
| -e opentelemetry-instrumentation | ||||
| -e instrumentation/opentelemetry-instrumentation-aio-pika | ||||
							
								
								
									
										14
									
								
								tox.ini
								
								
								
								
							
							
						
						
									
										14
									
								
								tox.ini
								
								
								
								
							|  | @ -265,11 +265,12 @@ envlist = | |||
|     ; opentelemetry-instrumentation-aio-pika | ||||
|     ; The numbers at the end of the environment names | ||||
|     ; below mean these dependencies are being used: | ||||
|     ; 0: aio_pika~=7.2.0 | ||||
|     ; 1: aio_pika>=8.0.0,<9.0.0 | ||||
|     ; 2: aio_pika>=9.0.0,<10.0.0 | ||||
|     py3{8,9,10,11}-test-instrumentation-aio-pika-{0,1,2} | ||||
|     pypy3-test-instrumentation-aio-pika-{0,1,2} | ||||
|     ; 0: aio_pika==7.2.0 | ||||
|     ; 1: aio_pika==8.3.0 | ||||
|     ; 2: aio_pika==9.0.5 | ||||
|     ; 3: aio_pika==9.4.1 | ||||
|     py3{8,9,10,11}-test-instrumentation-aio-pika-{0,1,2,3} | ||||
|     pypy3-test-instrumentation-aio-pika-{0,1,2,3} | ||||
| 
 | ||||
|     ; opentelemetry-instrumentation-kafka-python | ||||
|     py3{8,9,10,11}-test-instrumentation-kafka-python | ||||
|  | @ -338,6 +339,7 @@ commands_pre = | |||
|   aio-pika-0: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-aio-pika/test-requirements-0.txt | ||||
|   aio-pika-1: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-aio-pika/test-requirements-1.txt | ||||
|   aio-pika-2: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-aio-pika/test-requirements-2.txt | ||||
|   aio-pika-3: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-aio-pika/test-requirements-3.txt | ||||
| 
 | ||||
|   kafka-python: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-kafka-python/test-requirements.txt | ||||
| 
 | ||||
|  | @ -428,8 +430,6 @@ commands_pre = | |||
| 
 | ||||
|   logging: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-logging/test-requirements.txt | ||||
| 
 | ||||
|   aio-pika-{0,1,2}: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-aio-pika/test-requirements-2.txt | ||||
| 
 | ||||
|   aiohttp-client: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-aiohttp-client/test-requirements.txt | ||||
| 
 | ||||
|   aiohttp-server: pip install -r {toxinidir}/instrumentation/opentelemetry-instrumentation-aiohttp-server/test-requirements.txt | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue