From 58b5e616bf1fbc6396a65cb3b6f8deac53c45ca3 Mon Sep 17 00:00:00 2001 From: Nimrod Shlagman Date: Mon, 26 Dec 2022 16:15:34 +0200 Subject: [PATCH 1/9] add docs component owner --- docs-requirements.txt | 1 + .../instrumentation/boto3sqs/__init__.py | 11 ++++------- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/docs-requirements.txt b/docs-requirements.txt index e745057a7e..1cfe1fa193 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -23,6 +23,7 @@ aiopg>=0.13.0,<1.3.0 asyncpg>=0.12.0 boto~=2.0 botocore~=1.0 +boto3~=1.0 celery>=4.0 flask~=2.0 falcon~=2.0 diff --git a/instrumentation/opentelemetry-instrumentation-boto3sqs/src/opentelemetry/instrumentation/boto3sqs/__init__.py b/instrumentation/opentelemetry-instrumentation-boto3sqs/src/opentelemetry/instrumentation/boto3sqs/__init__.py index dacb931db6..ee567ea1c2 100644 --- a/instrumentation/opentelemetry-instrumentation-boto3sqs/src/opentelemetry/instrumentation/boto3sqs/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-boto3sqs/src/opentelemetry/instrumentation/boto3sqs/__init__.py @@ -12,21 +12,18 @@ # See the License for the specific language governing permissions and # limitations under the License. """ -Instrument `boto3sqs`_ to trace SQS applications. - -.. _boto3sqs: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/sqs.html - +Instrument boto3sqs to trace SQS applications. Usage ----- -.. code:: python +.. code-block:: python - import boto3 from opentelemetry.instrumentation.boto3sqs import Boto3SQSInstrumentor - Boto3SQSInstrumentor().instrument() + +--- """ import logging from typing import Any, Collection, Dict, Generator, List, Mapping, Optional From 817d179297c16e123cbcae3cabc84cb230013d52 Mon Sep 17 00:00:00 2001 From: Nimrod Shlagman Date: Mon, 26 Dec 2022 16:16:00 +0200 Subject: [PATCH 2/9] add docs component owner --- docs/instrumentation/boto3sqs/boto3sqs.rst | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 docs/instrumentation/boto3sqs/boto3sqs.rst diff --git a/docs/instrumentation/boto3sqs/boto3sqs.rst b/docs/instrumentation/boto3sqs/boto3sqs.rst new file mode 100644 index 0000000000..75bf46d2d1 --- /dev/null +++ b/docs/instrumentation/boto3sqs/boto3sqs.rst @@ -0,0 +1,6 @@ +.. include:: ../../../instrumentation/opentelemetry-instrumentation-boto3sqs/README.rst + +.. automodule:: opentelemetry.instrumentation.boto3sqs + :members: + :undoc-members: + :show-inheritance: From ad9b1568bb52957a642d6eac83dbb0e572e56536 Mon Sep 17 00:00:00 2001 From: Nimrod Shlagman Date: Mon, 13 Feb 2023 21:17:06 +0200 Subject: [PATCH 3/9] nitpick ignore obj carrierT --- docs/conf.py | 10 ++++++++++ docs/nitpick-exceptions.ini | 3 +++ .../opentelemetry/instrumentation/boto3sqs/__init__.py | 6 +++--- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 93d5b7cdca..98d82388c1 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -146,6 +146,16 @@ def getlistcfg(strval): ) ) +if "obj" in mcfg: + objs = getlistcfg(mcfg["obj"]) + for _obj in objs: + nitpick_ignore.append( + ( + "py:obj", + _obj, + ) + ) + # Add any paths that contain templates here, relative to this directory. templates_path = ["_templates"] diff --git a/docs/nitpick-exceptions.ini b/docs/nitpick-exceptions.ini index fa8de32519..d3bba5fdb4 100644 --- a/docs/nitpick-exceptions.ini +++ b/docs/nitpick-exceptions.ini @@ -44,3 +44,6 @@ anys= ; - instrumentation.* Setter httpx + +obj= + opentelemetry.propagators.textmap.CarrierT \ No newline at end of file diff --git a/instrumentation/opentelemetry-instrumentation-boto3sqs/src/opentelemetry/instrumentation/boto3sqs/__init__.py b/instrumentation/opentelemetry-instrumentation-boto3sqs/src/opentelemetry/instrumentation/boto3sqs/__init__.py index ee567ea1c2..935000d31d 100644 --- a/instrumentation/opentelemetry-instrumentation-boto3sqs/src/opentelemetry/instrumentation/boto3sqs/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-boto3sqs/src/opentelemetry/instrumentation/boto3sqs/__init__.py @@ -99,9 +99,9 @@ class ContextableList(list): """ Since the classic way to process SQS messages is using a `for` loop, without a well defined scope like a callback - we are doing something similar to the instrumentaiton of Kafka-python and instrumenting the - `__iter__` functions and the `__getitem__` functions to set the span context of the addressed message. Since - the return value from an `SQS.ReceiveMessage` returns a builtin list, we cannot wrap it and change all of the - calls for `list.__iter__` and `list.__getitem__` - therefore we use ContextableList. It is bound to the + '__iter__' functions and the '__getitem__' functions to set the span context of the addressed message. Since + the return value from an 'SQS.ReceiveMessage' returns a builtin list, we cannot wrap it and change all of the + calls for 'list.__iter__' and 'list.__getitem__' - therefore we use ContextableList. It is bound to the received_messages_spans dict """ From 4656ad4dba9710f4b52f711f92eb4a7469594f72 Mon Sep 17 00:00:00 2001 From: Nimrod Shlagman Date: Mon, 13 Feb 2023 21:21:01 +0200 Subject: [PATCH 4/9] cleanup --- docs/nitpick-exceptions.ini | 2 +- .../src/opentelemetry/instrumentation/boto3sqs/__init__.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/nitpick-exceptions.ini b/docs/nitpick-exceptions.ini index d3bba5fdb4..89269c4335 100644 --- a/docs/nitpick-exceptions.ini +++ b/docs/nitpick-exceptions.ini @@ -46,4 +46,4 @@ anys= httpx obj= - opentelemetry.propagators.textmap.CarrierT \ No newline at end of file + opentelemetry.propagators.textmap.CarrierT diff --git a/instrumentation/opentelemetry-instrumentation-boto3sqs/src/opentelemetry/instrumentation/boto3sqs/__init__.py b/instrumentation/opentelemetry-instrumentation-boto3sqs/src/opentelemetry/instrumentation/boto3sqs/__init__.py index 935000d31d..347800cbbe 100644 --- a/instrumentation/opentelemetry-instrumentation-boto3sqs/src/opentelemetry/instrumentation/boto3sqs/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-boto3sqs/src/opentelemetry/instrumentation/boto3sqs/__init__.py @@ -14,11 +14,14 @@ """ Instrument boto3sqs to trace SQS applications. +.. _boto3sqs: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/sqs.html + Usage ----- .. code-block:: python + import boto3 from opentelemetry.instrumentation.boto3sqs import Boto3SQSInstrumentor Boto3SQSInstrumentor().instrument() From 25124946ea3c3c2f233e6d90bd6e859d0fc7101a Mon Sep 17 00:00:00 2001 From: Nimrod Shlagman Date: Wed, 15 Feb 2023 14:20:17 +0200 Subject: [PATCH 5/9] Update conf.py merge --- docs/conf.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index c5ceb861d4..7c628b7cd8 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -135,16 +135,6 @@ def getlistcfg(strval): nitpick_ignore.append((category.replace("-", ":"), item)) -if "obj" in mcfg: - objs = getlistcfg(mcfg["obj"]) - for _obj in objs: - nitpick_ignore.append( - ( - "py:obj", - _obj, - ) - ) - # Add any paths that contain templates here, relative to this directory. templates_path = ["_templates"] From 37da43a1afdb7ca80712add7276ee6053ebc6aff Mon Sep 17 00:00:00 2001 From: Nimrod Shlagman Date: Wed, 15 Feb 2023 14:34:33 +0200 Subject: [PATCH 6/9] add py:obj to nitpick docs list --- docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 7c628b7cd8..23918eb331 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -126,7 +126,7 @@ def getlistcfg(strval): ] -ignore_categories = ["py-class", "py-func", "py-exc", "any"] +ignore_categories = ["py-class", "py-func", "py-exc", "py-obj", "any"] for category in ignore_categories: if category in mcfg: From 0bb8eff97c87903502c5ce3d5689d95d4e6465fd Mon Sep 17 00:00:00 2001 From: Nimrod Shlagman Date: Sun, 19 Feb 2023 10:24:02 +0200 Subject: [PATCH 7/9] ret boto3sqs link and err fix --- docs/nitpick-exceptions.ini | 6 ++++++ .../src/opentelemetry/instrumentation/boto3sqs/__init__.py | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/nitpick-exceptions.ini b/docs/nitpick-exceptions.ini index a201f5233d..cd9e8fe974 100644 --- a/docs/nitpick-exceptions.ini +++ b/docs/nitpick-exceptions.ini @@ -13,6 +13,7 @@ py-class= opentelemetry.sdk.trace.id_generator.IdGenerator opentelemetry.instrumentation.confluent_kafka.ProxiedProducer opentelemetry.instrumentation.confluent_kafka.ProxiedConsumer + opentelemetry.instrumentation.instrumentor.BaseInstrumentor ; - AwsXRayIdGenerator TextMapPropagator CarrierT @@ -54,6 +55,11 @@ any= ; - instrumentation.* Setter httpx + instrument + __iter__ + list.__iter__ + __getitem__ + list.__getitem__ py-obj= opentelemetry.propagators.textmap.CarrierT diff --git a/instrumentation/opentelemetry-instrumentation-boto3sqs/src/opentelemetry/instrumentation/boto3sqs/__init__.py b/instrumentation/opentelemetry-instrumentation-boto3sqs/src/opentelemetry/instrumentation/boto3sqs/__init__.py index 347800cbbe..3d24ec5e45 100644 --- a/instrumentation/opentelemetry-instrumentation-boto3sqs/src/opentelemetry/instrumentation/boto3sqs/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-boto3sqs/src/opentelemetry/instrumentation/boto3sqs/__init__.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. """ -Instrument boto3sqs to trace SQS applications. +Instrument `boto3sqs`_ to trace SQS applications. .. _boto3sqs: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/sqs.html @@ -102,9 +102,9 @@ class ContextableList(list): """ Since the classic way to process SQS messages is using a `for` loop, without a well defined scope like a callback - we are doing something similar to the instrumentaiton of Kafka-python and instrumenting the - '__iter__' functions and the '__getitem__' functions to set the span context of the addressed message. Since + `__iter__` functions and the `__getitem__` functions to set the span context of the addressed message. Since the return value from an 'SQS.ReceiveMessage' returns a builtin list, we cannot wrap it and change all of the - calls for 'list.__iter__' and 'list.__getitem__' - therefore we use ContextableList. It is bound to the + calls for `list.__iter__` and `list.__getitem__` - therefore we use ContextableList. It is bound to the received_messages_spans dict """ From 01faf4176dd8b7d08ebccce45580d26e77672083 Mon Sep 17 00:00:00 2001 From: Nimrod Shlagman Date: Sun, 19 Feb 2023 10:28:33 +0200 Subject: [PATCH 8/9] Update __init__.py --- .../src/opentelemetry/instrumentation/boto3sqs/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instrumentation/opentelemetry-instrumentation-boto3sqs/src/opentelemetry/instrumentation/boto3sqs/__init__.py b/instrumentation/opentelemetry-instrumentation-boto3sqs/src/opentelemetry/instrumentation/boto3sqs/__init__.py index 3d24ec5e45..9f4ede9c35 100644 --- a/instrumentation/opentelemetry-instrumentation-boto3sqs/src/opentelemetry/instrumentation/boto3sqs/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-boto3sqs/src/opentelemetry/instrumentation/boto3sqs/__init__.py @@ -103,7 +103,7 @@ class ContextableList(list): Since the classic way to process SQS messages is using a `for` loop, without a well defined scope like a callback - we are doing something similar to the instrumentaiton of Kafka-python and instrumenting the `__iter__` functions and the `__getitem__` functions to set the span context of the addressed message. Since - the return value from an 'SQS.ReceiveMessage' returns a builtin list, we cannot wrap it and change all of the + the return value from an `SQS.ReceiveMessage` returns a builtin list, we cannot wrap it and change all of the calls for `list.__iter__` and `list.__getitem__` - therefore we use ContextableList. It is bound to the received_messages_spans dict """ From 40e64abdb54ad3396b06f46a0ac7a12d5509003c Mon Sep 17 00:00:00 2001 From: Nimrod Shlagman Date: Sun, 19 Feb 2023 10:29:06 +0200 Subject: [PATCH 9/9] Update nitpick-exceptions.ini --- docs/nitpick-exceptions.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/nitpick-exceptions.ini b/docs/nitpick-exceptions.ini index cd9e8fe974..9dc379cf93 100644 --- a/docs/nitpick-exceptions.ini +++ b/docs/nitpick-exceptions.ini @@ -60,6 +60,7 @@ any= list.__iter__ __getitem__ list.__getitem__ + SQS.ReceiveMessage py-obj= opentelemetry.propagators.textmap.CarrierT