diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml index da0714ae1f..f308c5757b 100644 --- a/.github/workflows/backport.yml +++ b/.github/workflows/backport.yml @@ -28,7 +28,7 @@ jobs: env: NUMBER: ${{ github.event.inputs.number }} # not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows - GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} + GITHUB_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }} run: | commit=$(gh pr view $NUMBER --json mergeCommit --jq .mergeCommit.oid) title=$(gh pr view $NUMBER --json title --jq .title) diff --git a/.github/workflows/prepare-patch-release.yml b/.github/workflows/prepare-patch-release.yml index 93c4fc74fd..42e287f981 100644 --- a/.github/workflows/prepare-patch-release.yml +++ b/.github/workflows/prepare-patch-release.yml @@ -69,7 +69,7 @@ jobs: - name: Create pull request env: # not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows - GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} + GITHUB_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }} run: | message="Prepare release ${STABLE_VERSION}/${UNSTABLE_VERSION}" branch="opentelemetrybot/prepare-release-${STABLE_VERSION}-${UNSTABLE_VERSION}" diff --git a/.github/workflows/prepare-release-branch.yml b/.github/workflows/prepare-release-branch.yml index f8edb3bef7..229c8ac7e6 100644 --- a/.github/workflows/prepare-release-branch.yml +++ b/.github/workflows/prepare-release-branch.yml @@ -96,7 +96,7 @@ jobs: - name: Create pull request against the release branch env: # not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows - GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} + GITHUB_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }} run: | message="Prepare release ${STABLE_VERSION}/${UNSTABLE_VERSION}" branch="opentelemetrybot/prepare-release-${STABLE_VERSION}-${UNSTABLE_VERSION}" @@ -181,7 +181,7 @@ jobs: - name: Create pull request against main env: # not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows - GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} + GITHUB_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }} run: | message="Update version to ${STABLE_NEXT_VERSION}/${UNSTABLE_NEXT_VERSION}" body="Update version to \`${STABLE_NEXT_VERSION}/${UNSTABLE_NEXT_VERSION}\`." diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 818ccdc68a..710514df19 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -184,7 +184,7 @@ jobs: - name: Create pull request against main env: # not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows - GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} + GITHUB_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }} run: | message="Copy change log updates from $GITHUB_REF_NAME" body="Copy log updates from \`$GITHUB_REF_NAME\`." diff --git a/CHANGELOG.md b/CHANGELOG.md index 4331bb599c..242dd4935c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,8 +9,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- Add connection attributes to sqlalchemy connect span + ([#1608](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1608)) + +### Fixed + +- Fix Flask instrumentation to only close the span if it was created by the same thread. + ([#1654](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1654)) + +## Version 1.16.0/0.37b0 (2023-02-17) + +### Added + +- Support `aio_pika` 9.x (([#1670](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1670]) - `opentelemetry-instrumentation-redis` Add `sanitize_query` config option to allow query sanitization. ([#1572](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1572)) -- `opentelemetry-instrumentation-elasticsearch` Add optional db.statement query sanitization. +- `opentelemetry-instrumentation-elasticsearch` Add optional db.statement query sanitization. ([#1598](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1598)) - `opentelemetry-instrumentation-celery` Record exceptions as events on the span. ([#1573](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1573)) @@ -46,6 +59,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ([#1435](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1435)) - mongo db - fix db statement capturing ([#1512](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1512)) +- Add commit method for ConfluentKafkaInstrumentor's ProxiedConsumer + ([#1656](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1656)) ## Version 1.15.0/0.36b0 (2022-12-10) diff --git a/_template/version.py b/_template/version.py index 0a47df4f5a..8778b43b17 100644 --- a/_template/version.py +++ b/_template/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/docs-requirements.txt b/docs-requirements.txt index 7fb89a9bda..6d11d20198 100644 --- a/docs-requirements.txt +++ b/docs-requirements.txt @@ -24,7 +24,9 @@ aiopg>=0.13.0,<1.3.0 asyncpg>=0.12.0 boto~=2.0 botocore~=1.0 +boto3~=1.0 celery>=4.0 +confluent-kafka>= 1.8.2,< 2.0.0 elasticsearch>=2.0,<9.0 flask~=2.0 falcon~=2.0 diff --git a/docs/conf.py b/docs/conf.py index 93d5b7cdca..23918eb331 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -126,25 +126,14 @@ def getlistcfg(strval): ] -if "class_references" in mcfg: - class_references = getlistcfg(mcfg["class_references"]) - for class_reference in class_references: - nitpick_ignore.append( - ( - "py:class", - class_reference, - ) - ) - -if "anys" in mcfg: - anys = getlistcfg(mcfg["anys"]) - for _any in anys: - nitpick_ignore.append( - ( - "any", - _any, - ) - ) +ignore_categories = ["py-class", "py-func", "py-exc", "py-obj", "any"] + +for category in ignore_categories: + if category in mcfg: + items = getlistcfg(mcfg[category]) + for item in items: + nitpick_ignore.append((category.replace("-", ":"), item)) + # Add any paths that contain templates here, relative to this directory. templates_path = ["_templates"] 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: diff --git a/docs/instrumentation/confluent_kafka/confluent_kafka.rst b/docs/instrumentation/confluent_kafka/confluent_kafka.rst new file mode 100644 index 0000000000..8f8794bb17 --- /dev/null +++ b/docs/instrumentation/confluent_kafka/confluent_kafka.rst @@ -0,0 +1,7 @@ +.. include:: ../../../instrumentation/opentelemetry-instrumentation-confluent-kafka/README.rst + +.. automodule:: opentelemetry.instrumentation.confluent_kafka + :members: + :undoc-members: + :show-inheritance: + :noindex: diff --git a/docs/nitpick-exceptions.ini b/docs/nitpick-exceptions.ini index fa8de32519..9dc379cf93 100644 --- a/docs/nitpick-exceptions.ini +++ b/docs/nitpick-exceptions.ini @@ -1,5 +1,5 @@ [default] -class_references= +py-class= ; TODO: Understand why sphinx is not able to find this local class opentelemetry.propagators.textmap.CarrierT opentelemetry.propagators.textmap.Setter @@ -11,6 +11,9 @@ class_references= opentelemetry.propagators.textmap.Getter ; - AWSXRayPropagator opentelemetry.sdk.trace.id_generator.IdGenerator + opentelemetry.instrumentation.confluent_kafka.ProxiedProducer + opentelemetry.instrumentation.confluent_kafka.ProxiedConsumer + opentelemetry.instrumentation.instrumentor.BaseInstrumentor ; - AwsXRayIdGenerator TextMapPropagator CarrierT @@ -26,8 +29,16 @@ class_references= httpx.AsyncByteStream httpx.Response yarl.URL + cimpl.Producer + cimpl.Consumer + func + Message + TopicPartition + callable + Consumer + confluent_kafka.Message -anys= +any= ; API opentelemetry.propagators.textmap.TextMapPropagator.fields ; - AWSXRayPropagator @@ -44,3 +55,21 @@ anys= ; - instrumentation.* Setter httpx + instrument + __iter__ + list.__iter__ + __getitem__ + list.__getitem__ + SQS.ReceiveMessage + +py-obj= + opentelemetry.propagators.textmap.CarrierT + +py-func= + poll + flush + Message.error + +py-exc= + KafkaException + KafkaError diff --git a/eachdist.ini b/eachdist.ini index 5f8316b193..d07da4812a 100644 --- a/eachdist.ini +++ b/eachdist.ini @@ -16,7 +16,7 @@ sortfirst= ext/* [stable] -version=1.16.0.dev +version=1.17.0.dev packages= opentelemetry-sdk @@ -34,7 +34,7 @@ packages= opentelemetry-api [prerelease] -version=0.37b0.dev +version=0.38b0.dev packages= all diff --git a/exporter/opentelemetry-exporter-prometheus-remote-write/src/opentelemetry/exporter/prometheus_remote_write/version.py b/exporter/opentelemetry-exporter-prometheus-remote-write/src/opentelemetry/exporter/prometheus_remote_write/version.py index 0a47df4f5a..8778b43b17 100644 --- a/exporter/opentelemetry-exporter-prometheus-remote-write/src/opentelemetry/exporter/prometheus_remote_write/version.py +++ b/exporter/opentelemetry-exporter-prometheus-remote-write/src/opentelemetry/exporter/prometheus_remote_write/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/exporter/opentelemetry-exporter-richconsole/pyproject.toml b/exporter/opentelemetry-exporter-richconsole/pyproject.toml index d6baae8053..26f3aa35c0 100644 --- a/exporter/opentelemetry-exporter-richconsole/pyproject.toml +++ b/exporter/opentelemetry-exporter-richconsole/pyproject.toml @@ -27,7 +27,7 @@ classifiers = [ dependencies = [ "opentelemetry-api ~= 1.12", "opentelemetry-sdk ~= 1.12", - "opentelemetry-semantic-conventions == 0.37b0.dev", + "opentelemetry-semantic-conventions == 0.38b0.dev", "rich>=10.0.0", ] diff --git a/exporter/opentelemetry-exporter-richconsole/src/opentelemetry/exporter/richconsole/version.py b/exporter/opentelemetry-exporter-richconsole/src/opentelemetry/exporter/richconsole/version.py index 0a47df4f5a..8778b43b17 100644 --- a/exporter/opentelemetry-exporter-richconsole/src/opentelemetry/exporter/richconsole/version.py +++ b/exporter/opentelemetry-exporter-richconsole/src/opentelemetry/exporter/richconsole/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/instrumentation/README.md b/instrumentation/README.md index 052d2ba67d..aa71744761 100644 --- a/instrumentation/README.md +++ b/instrumentation/README.md @@ -1,7 +1,7 @@ | Instrumentation | Supported Packages | Metrics support | | --------------- | ------------------ | --------------- | -| [opentelemetry-instrumentation-aio-pika](./opentelemetry-instrumentation-aio-pika) | aio_pika >= 7.2.0, < 9.0.0 | No +| [opentelemetry-instrumentation-aio-pika](./opentelemetry-instrumentation-aio-pika) | aio_pika >= 7.2.0, < 10.0.0 | No | [opentelemetry-instrumentation-aiohttp-client](./opentelemetry-instrumentation-aiohttp-client) | aiohttp ~= 3.0 | No | [opentelemetry-instrumentation-aiopg](./opentelemetry-instrumentation-aiopg) | aiopg >= 0.13.0, < 2.0.0 | No | [opentelemetry-instrumentation-asgi](./opentelemetry-instrumentation-asgi) | asgiref ~= 3.0 | No diff --git a/instrumentation/opentelemetry-instrumentation-aio-pika/pyproject.toml b/instrumentation/opentelemetry-instrumentation-aio-pika/pyproject.toml index 994642e22a..49c6d0a20c 100644 --- a/instrumentation/opentelemetry-instrumentation-aio-pika/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-aio-pika/pyproject.toml @@ -31,11 +31,11 @@ dependencies = [ [project.optional-dependencies] instruments = [ - "aio_pika >= 7.2.0, < 9.0.0", + "aio_pika >= 7.2.0, < 10.0.0", ] test = [ "opentelemetry-instrumentation-aio-pika[instruments]", - "opentelemetry-test-utils == 0.37b0.dev", + "opentelemetry-test-utils == 0.38b0.dev", "pytest", "wrapt >= 1.0.0, < 2.0.0", ] diff --git a/instrumentation/opentelemetry-instrumentation-aio-pika/src/opentelemetry/instrumentation/aio_pika/package.py b/instrumentation/opentelemetry-instrumentation-aio-pika/src/opentelemetry/instrumentation/aio_pika/package.py index 285e9f99cb..8069323f7c 100644 --- a/instrumentation/opentelemetry-instrumentation-aio-pika/src/opentelemetry/instrumentation/aio_pika/package.py +++ b/instrumentation/opentelemetry-instrumentation-aio-pika/src/opentelemetry/instrumentation/aio_pika/package.py @@ -13,4 +13,4 @@ # limitations under the License. from typing import Collection -_instruments: Collection[str] = ("aio_pika >= 7.2.0, < 9.0.0",) +_instruments: Collection[str] = ("aio_pika >= 7.2.0, < 10.0.0",) diff --git a/instrumentation/opentelemetry-instrumentation-aio-pika/src/opentelemetry/instrumentation/aio_pika/version.py b/instrumentation/opentelemetry-instrumentation-aio-pika/src/opentelemetry/instrumentation/aio_pika/version.py index 0a47df4f5a..8778b43b17 100644 --- a/instrumentation/opentelemetry-instrumentation-aio-pika/src/opentelemetry/instrumentation/aio_pika/version.py +++ b/instrumentation/opentelemetry-instrumentation-aio-pika/src/opentelemetry/instrumentation/aio_pika/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/instrumentation/opentelemetry-instrumentation-aio-pika/tests/consts.py b/instrumentation/opentelemetry-instrumentation-aio-pika/tests/consts.py index 7e34c73c63..431780ae7b 100644 --- a/instrumentation/opentelemetry-instrumentation-aio-pika/tests/consts.py +++ b/instrumentation/opentelemetry-instrumentation-aio-pika/tests/consts.py @@ -1,7 +1,9 @@ from argparse import Namespace +from aio_pika import __version__ as aiopika_version from yarl import URL +AIOPIKA_VERSION_INFO = tuple(int(v) for v in aiopika_version.split(".")) MESSAGE_ID = "meesage_id" CORRELATION_ID = "correlation_id" MESSAGING_SYSTEM = "rabbitmq" diff --git a/instrumentation/opentelemetry-instrumentation-aio-pika/tests/test_callback_decorator.py b/instrumentation/opentelemetry-instrumentation-aio-pika/tests/test_callback_decorator.py index 7c9288a657..39a7724bfa 100644 --- a/instrumentation/opentelemetry-instrumentation-aio-pika/tests/test_callback_decorator.py +++ b/instrumentation/opentelemetry-instrumentation-aio-pika/tests/test_callback_decorator.py @@ -14,7 +14,7 @@ import asyncio from unittest import TestCase, mock, skipIf -from aio_pika import Queue, version_info +from aio_pika import Queue from opentelemetry.instrumentation.aio_pika.callback_decorator import ( CallbackDecorator, @@ -23,6 +23,7 @@ from opentelemetry.trace import SpanKind, get_tracer from .consts import ( + AIOPIKA_VERSION_INFO, CHANNEL_7, CHANNEL_8, CORRELATION_ID, @@ -36,7 +37,7 @@ ) -@skipIf(version_info >= (8, 0), "Only for aio_pika 7") +@skipIf(AIOPIKA_VERSION_INFO >= (8, 0), "Only for aio_pika 7") class TestInstrumentedQueueAioRmq7(TestCase): EXPECTED_ATTRIBUTES = { SpanAttributes.MESSAGING_SYSTEM: MESSAGING_SYSTEM, @@ -76,7 +77,7 @@ def test_decorate_callback(self): callback.assert_called_once_with(MESSAGE) -@skipIf(version_info <= (8, 0), "Only for aio_pika 8") +@skipIf(AIOPIKA_VERSION_INFO <= (8, 0), "Only for aio_pika 8") class TestInstrumentedQueueAioRmq8(TestCase): EXPECTED_ATTRIBUTES = { SpanAttributes.MESSAGING_SYSTEM: MESSAGING_SYSTEM, diff --git a/instrumentation/opentelemetry-instrumentation-aio-pika/tests/test_publish_decorator.py b/instrumentation/opentelemetry-instrumentation-aio-pika/tests/test_publish_decorator.py index e5586b9a00..d5291e07d9 100644 --- a/instrumentation/opentelemetry-instrumentation-aio-pika/tests/test_publish_decorator.py +++ b/instrumentation/opentelemetry-instrumentation-aio-pika/tests/test_publish_decorator.py @@ -15,7 +15,7 @@ from typing import Type from unittest import TestCase, mock, skipIf -from aio_pika import Exchange, RobustExchange, version_info +from aio_pika import Exchange, RobustExchange from opentelemetry.instrumentation.aio_pika.publish_decorator import ( PublishDecorator, @@ -24,6 +24,7 @@ from opentelemetry.trace import SpanKind, get_tracer from .consts import ( + AIOPIKA_VERSION_INFO, CHANNEL_7, CHANNEL_8, CONNECTION_7, @@ -39,7 +40,7 @@ ) -@skipIf(version_info >= (8, 0), "Only for aio_pika 7") +@skipIf(AIOPIKA_VERSION_INFO >= (8, 0), "Only for aio_pika 7") class TestInstrumentedExchangeAioRmq7(TestCase): EXPECTED_ATTRIBUTES = { SpanAttributes.MESSAGING_SYSTEM: MESSAGING_SYSTEM, @@ -92,7 +93,7 @@ def test_robust_publish(self): self._test_publish(RobustExchange) -@skipIf(version_info <= (8, 0), "Only for aio_pika 8") +@skipIf(AIOPIKA_VERSION_INFO <= (8, 0), "Only for aio_pika 8") class TestInstrumentedExchangeAioRmq8(TestCase): EXPECTED_ATTRIBUTES = { SpanAttributes.MESSAGING_SYSTEM: MESSAGING_SYSTEM, diff --git a/instrumentation/opentelemetry-instrumentation-aiohttp-client/pyproject.toml b/instrumentation/opentelemetry-instrumentation-aiohttp-client/pyproject.toml index cfe1decc5a..674fa27d6c 100644 --- a/instrumentation/opentelemetry-instrumentation-aiohttp-client/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-aiohttp-client/pyproject.toml @@ -26,9 +26,9 @@ classifiers = [ ] dependencies = [ "opentelemetry-api ~= 1.12", - "opentelemetry-instrumentation == 0.37b0.dev", - "opentelemetry-semantic-conventions == 0.37b0.dev", - "opentelemetry-util-http == 0.37b0.dev", + "opentelemetry-instrumentation == 0.38b0.dev", + "opentelemetry-semantic-conventions == 0.38b0.dev", + "opentelemetry-util-http == 0.38b0.dev", "wrapt >= 1.0.0, < 2.0.0", ] diff --git a/instrumentation/opentelemetry-instrumentation-aiohttp-client/src/opentelemetry/instrumentation/aiohttp_client/version.py b/instrumentation/opentelemetry-instrumentation-aiohttp-client/src/opentelemetry/instrumentation/aiohttp_client/version.py index 12c944d283..782d00d60c 100644 --- a/instrumentation/opentelemetry-instrumentation-aiohttp-client/src/opentelemetry/instrumentation/aiohttp_client/version.py +++ b/instrumentation/opentelemetry-instrumentation-aiohttp-client/src/opentelemetry/instrumentation/aiohttp_client/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/instrumentation/opentelemetry-instrumentation-aiohttp-client/tests/test_aiohttp_client_integration.py b/instrumentation/opentelemetry-instrumentation-aiohttp-client/tests/test_aiohttp_client_integration.py index 524b93faeb..9210dae702 100644 --- a/instrumentation/opentelemetry-instrumentation-aiohttp-client/tests/test_aiohttp_client_integration.py +++ b/instrumentation/opentelemetry-instrumentation-aiohttp-client/tests/test_aiohttp_client_integration.py @@ -26,6 +26,7 @@ from pkg_resources import iter_entry_points from opentelemetry import context +from opentelemetry import trace as trace_api from opentelemetry.instrumentation import aiohttp_client from opentelemetry.instrumentation.aiohttp_client import ( AioHttpClientInstrumentor, @@ -434,6 +435,18 @@ async def create_session(server: aiohttp.test_utils.TestServer): run_with_test_server(create_session, self.URL, self.default_handler) self.assert_spans(1) + def test_no_op_tracer_provider(self): + AioHttpClientInstrumentor().uninstrument() + AioHttpClientInstrumentor().instrument( + tracer_provider=trace_api.NoOpTracerProvider() + ) + + run_with_test_server( + self.get_default_request(), self.URL, self.default_handler + ) + spans_list = self.memory_exporter.get_finished_spans() + self.assertEqual(len(spans_list), 0) + def test_uninstrument(self): AioHttpClientInstrumentor().uninstrument() run_with_test_server( diff --git a/instrumentation/opentelemetry-instrumentation-aiopg/pyproject.toml b/instrumentation/opentelemetry-instrumentation-aiopg/pyproject.toml index b2326d8586..af5a09f716 100644 --- a/instrumentation/opentelemetry-instrumentation-aiopg/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-aiopg/pyproject.toml @@ -26,8 +26,8 @@ classifiers = [ ] dependencies = [ "opentelemetry-api ~= 1.12", - "opentelemetry-instrumentation == 0.37b0.dev", - "opentelemetry-instrumentation-dbapi == 0.37b0.dev", + "opentelemetry-instrumentation == 0.38b0.dev", + "opentelemetry-instrumentation-dbapi == 0.38b0.dev", "wrapt >= 1.0.0, < 2.0.0", ] @@ -37,8 +37,8 @@ instruments = [ ] test = [ "opentelemetry-instrumentation-aiopg[instruments]", - "opentelemetry-semantic-conventions == 0.37b0.dev", - "opentelemetry-test-utils == 0.37b0.dev", + "opentelemetry-semantic-conventions == 0.38b0.dev", + "opentelemetry-test-utils == 0.38b0.dev", ] [project.entry-points.opentelemetry_instrumentor] diff --git a/instrumentation/opentelemetry-instrumentation-aiopg/src/opentelemetry/instrumentation/aiopg/version.py b/instrumentation/opentelemetry-instrumentation-aiopg/src/opentelemetry/instrumentation/aiopg/version.py index 0a47df4f5a..8778b43b17 100644 --- a/instrumentation/opentelemetry-instrumentation-aiopg/src/opentelemetry/instrumentation/aiopg/version.py +++ b/instrumentation/opentelemetry-instrumentation-aiopg/src/opentelemetry/instrumentation/aiopg/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/instrumentation/opentelemetry-instrumentation-asgi/pyproject.toml b/instrumentation/opentelemetry-instrumentation-asgi/pyproject.toml index c90b874e7e..b4f0f72cae 100644 --- a/instrumentation/opentelemetry-instrumentation-asgi/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-asgi/pyproject.toml @@ -27,9 +27,9 @@ classifiers = [ dependencies = [ "asgiref ~= 3.0", "opentelemetry-api ~= 1.12", - "opentelemetry-instrumentation == 0.37b0.dev", - "opentelemetry-semantic-conventions == 0.37b0.dev", - "opentelemetry-util-http == 0.37b0.dev", + "opentelemetry-instrumentation == 0.38b0.dev", + "opentelemetry-semantic-conventions == 0.38b0.dev", + "opentelemetry-util-http == 0.38b0.dev", ] [project.optional-dependencies] @@ -38,7 +38,7 @@ instruments = [ ] test = [ "opentelemetry-instrumentation-asgi[instruments]", - "opentelemetry-test-utils == 0.37b0.dev", + "opentelemetry-test-utils == 0.38b0.dev", ] [project.urls] diff --git a/instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/version.py b/instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/version.py index 0a47df4f5a..8778b43b17 100644 --- a/instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/version.py +++ b/instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/instrumentation/opentelemetry-instrumentation-asyncpg/pyproject.toml b/instrumentation/opentelemetry-instrumentation-asyncpg/pyproject.toml index ee14d0b0c9..cc57169828 100644 --- a/instrumentation/opentelemetry-instrumentation-asyncpg/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-asyncpg/pyproject.toml @@ -26,8 +26,8 @@ classifiers = [ ] dependencies = [ "opentelemetry-api ~= 1.12", - "opentelemetry-instrumentation == 0.37b0.dev", - "opentelemetry-semantic-conventions == 0.37b0.dev", + "opentelemetry-instrumentation == 0.38b0.dev", + "opentelemetry-semantic-conventions == 0.38b0.dev", ] [project.optional-dependencies] @@ -36,7 +36,7 @@ instruments = [ ] test = [ "opentelemetry-instrumentation-asyncpg[instruments]", - "opentelemetry-test-utils == 0.37b0.dev", + "opentelemetry-test-utils == 0.38b0.dev", ] [project.entry-points.opentelemetry_instrumentor] diff --git a/instrumentation/opentelemetry-instrumentation-asyncpg/src/opentelemetry/instrumentation/asyncpg/version.py b/instrumentation/opentelemetry-instrumentation-asyncpg/src/opentelemetry/instrumentation/asyncpg/version.py index 0a47df4f5a..8778b43b17 100644 --- a/instrumentation/opentelemetry-instrumentation-asyncpg/src/opentelemetry/instrumentation/asyncpg/version.py +++ b/instrumentation/opentelemetry-instrumentation-asyncpg/src/opentelemetry/instrumentation/asyncpg/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/instrumentation/opentelemetry-instrumentation-aws-lambda/pyproject.toml b/instrumentation/opentelemetry-instrumentation-aws-lambda/pyproject.toml index 74f7b20112..6c74d7aa81 100644 --- a/instrumentation/opentelemetry-instrumentation-aws-lambda/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-aws-lambda/pyproject.toml @@ -22,15 +22,15 @@ classifiers = [ "Programming Language :: Python :: 3.8", ] dependencies = [ - "opentelemetry-instrumentation == 0.37b0.dev", + "opentelemetry-instrumentation == 0.38b0.dev", "opentelemetry-propagator-aws-xray == 1.0.1", - "opentelemetry-semantic-conventions == 0.37b0.dev", + "opentelemetry-semantic-conventions == 0.38b0.dev", ] [project.optional-dependencies] instruments = [] test = [ - "opentelemetry-test-utils == 0.37b0.dev", + "opentelemetry-test-utils == 0.38b0.dev", ] [project.urls] diff --git a/instrumentation/opentelemetry-instrumentation-aws-lambda/src/opentelemetry/instrumentation/aws_lambda/version.py b/instrumentation/opentelemetry-instrumentation-aws-lambda/src/opentelemetry/instrumentation/aws_lambda/version.py index 0a47df4f5a..8778b43b17 100644 --- a/instrumentation/opentelemetry-instrumentation-aws-lambda/src/opentelemetry/instrumentation/aws_lambda/version.py +++ b/instrumentation/opentelemetry-instrumentation-aws-lambda/src/opentelemetry/instrumentation/aws_lambda/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/instrumentation/opentelemetry-instrumentation-boto/pyproject.toml b/instrumentation/opentelemetry-instrumentation-boto/pyproject.toml index 0e5f78bad2..faeb50bda6 100644 --- a/instrumentation/opentelemetry-instrumentation-boto/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-boto/pyproject.toml @@ -26,8 +26,8 @@ classifiers = [ ] dependencies = [ "opentelemetry-api ~= 1.12", - "opentelemetry-instrumentation == 0.37b0.dev", - "opentelemetry-semantic-conventions == 0.37b0.dev", + "opentelemetry-instrumentation == 0.38b0.dev", + "opentelemetry-semantic-conventions == 0.38b0.dev", ] [project.optional-dependencies] @@ -38,7 +38,7 @@ test = [ "opentelemetry-instrumentation-boto[instruments]", "markupsafe==2.0.1", "moto~=2.0", - "opentelemetry-test-utils == 0.37b0.dev", + "opentelemetry-test-utils == 0.38b0.dev", ] [project.entry-points.opentelemetry_instrumentor] diff --git a/instrumentation/opentelemetry-instrumentation-boto/src/opentelemetry/instrumentation/boto/version.py b/instrumentation/opentelemetry-instrumentation-boto/src/opentelemetry/instrumentation/boto/version.py index 0a47df4f5a..8778b43b17 100644 --- a/instrumentation/opentelemetry-instrumentation-boto/src/opentelemetry/instrumentation/boto/version.py +++ b/instrumentation/opentelemetry-instrumentation-boto/src/opentelemetry/instrumentation/boto/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/instrumentation/opentelemetry-instrumentation-boto3sqs/pyproject.toml b/instrumentation/opentelemetry-instrumentation-boto3sqs/pyproject.toml index 282a3863a4..f80975e20f 100644 --- a/instrumentation/opentelemetry-instrumentation-boto3sqs/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-boto3sqs/pyproject.toml @@ -26,8 +26,8 @@ classifiers = [ ] dependencies = [ "opentelemetry-api ~= 1.12", - "opentelemetry-instrumentation == 0.37b0.dev", - "opentelemetry-semantic-conventions == 0.37b0.dev", + "opentelemetry-instrumentation == 0.38b0.dev", + "opentelemetry-semantic-conventions == 0.38b0.dev", "wrapt >= 1.0.0, < 2.0.0", ] @@ -37,7 +37,7 @@ instruments = [ ] test = [ "opentelemetry-instrumentation-boto3sqs[instruments]", - "opentelemetry-test-utils == 0.37b0.dev", + "opentelemetry-test-utils == 0.38b0.dev", ] [project.entry-points.opentelemetry_instrumentor] 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..9f4ede9c35 100644 --- a/instrumentation/opentelemetry-instrumentation-boto3sqs/src/opentelemetry/instrumentation/boto3sqs/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-boto3sqs/src/opentelemetry/instrumentation/boto3sqs/__init__.py @@ -16,17 +16,17 @@ .. _boto3sqs: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/sqs.html - 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 diff --git a/instrumentation/opentelemetry-instrumentation-boto3sqs/src/opentelemetry/instrumentation/boto3sqs/version.py b/instrumentation/opentelemetry-instrumentation-boto3sqs/src/opentelemetry/instrumentation/boto3sqs/version.py index 0a47df4f5a..8778b43b17 100644 --- a/instrumentation/opentelemetry-instrumentation-boto3sqs/src/opentelemetry/instrumentation/boto3sqs/version.py +++ b/instrumentation/opentelemetry-instrumentation-boto3sqs/src/opentelemetry/instrumentation/boto3sqs/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/instrumentation/opentelemetry-instrumentation-botocore/pyproject.toml b/instrumentation/opentelemetry-instrumentation-botocore/pyproject.toml index 95878f1434..d870df8d87 100644 --- a/instrumentation/opentelemetry-instrumentation-botocore/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-botocore/pyproject.toml @@ -26,8 +26,8 @@ classifiers = [ ] dependencies = [ "opentelemetry-api ~= 1.12", - "opentelemetry-instrumentation == 0.37b0.dev", - "opentelemetry-semantic-conventions == 0.37b0.dev", + "opentelemetry-instrumentation == 0.38b0.dev", + "opentelemetry-semantic-conventions == 0.38b0.dev", ] [project.optional-dependencies] @@ -38,7 +38,7 @@ test = [ "opentelemetry-instrumentation-botocore[instruments]", "markupsafe==2.0.1", "moto[all] ~= 2.2.6", - "opentelemetry-test-utils == 0.37b0.dev", + "opentelemetry-test-utils == 0.38b0.dev", ] [project.entry-points.opentelemetry_instrumentor] diff --git a/instrumentation/opentelemetry-instrumentation-botocore/src/opentelemetry/instrumentation/botocore/version.py b/instrumentation/opentelemetry-instrumentation-botocore/src/opentelemetry/instrumentation/botocore/version.py index 0a47df4f5a..8778b43b17 100644 --- a/instrumentation/opentelemetry-instrumentation-botocore/src/opentelemetry/instrumentation/botocore/version.py +++ b/instrumentation/opentelemetry-instrumentation-botocore/src/opentelemetry/instrumentation/botocore/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/instrumentation/opentelemetry-instrumentation-celery/pyproject.toml b/instrumentation/opentelemetry-instrumentation-celery/pyproject.toml index 8113c9906b..fcd6dbd143 100644 --- a/instrumentation/opentelemetry-instrumentation-celery/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-celery/pyproject.toml @@ -26,8 +26,8 @@ classifiers = [ ] dependencies = [ "opentelemetry-api ~= 1.12", - "opentelemetry-instrumentation == 0.37b0.dev", - "opentelemetry-semantic-conventions == 0.37b0.dev", + "opentelemetry-instrumentation == 0.38b0.dev", + "opentelemetry-semantic-conventions == 0.38b0.dev", ] [project.optional-dependencies] @@ -36,7 +36,7 @@ instruments = [ ] test = [ "opentelemetry-instrumentation-celery[instruments]", - "opentelemetry-test-utils == 0.37b0.dev", + "opentelemetry-test-utils == 0.38b0.dev", "importlib-metadata==4.13.0", "pytest", ] diff --git a/instrumentation/opentelemetry-instrumentation-celery/src/opentelemetry/instrumentation/celery/version.py b/instrumentation/opentelemetry-instrumentation-celery/src/opentelemetry/instrumentation/celery/version.py index 0a47df4f5a..8778b43b17 100644 --- a/instrumentation/opentelemetry-instrumentation-celery/src/opentelemetry/instrumentation/celery/version.py +++ b/instrumentation/opentelemetry-instrumentation-celery/src/opentelemetry/instrumentation/celery/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/instrumentation/opentelemetry-instrumentation-confluent-kafka/src/opentelemetry/instrumentation/confluent_kafka/__init__.py b/instrumentation/opentelemetry-instrumentation-confluent-kafka/src/opentelemetry/instrumentation/confluent_kafka/__init__.py index 5d77e1c8e6..12cb363219 100644 --- a/instrumentation/opentelemetry-instrumentation-confluent-kafka/src/opentelemetry/instrumentation/confluent_kafka/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-confluent-kafka/src/opentelemetry/instrumentation/confluent_kafka/__init__.py @@ -13,12 +13,12 @@ # limitations under the License. """ -Instrument `confluent-kafka-python` to report instrumentation-confluent-kafka produced and consumed messages +Instrument confluent-kafka-python to report instrumentation-confluent-kafka produced and consumed messages Usage ----- -..code:: python +.. code-block:: python from opentelemetry.instrumentation.confluent_kafka import ConfluentKafkaInstrumentor from confluent_kafka import Producer, Consumer @@ -30,12 +30,10 @@ conf1 = {'bootstrap.servers': "localhost:9092"} producer = Producer(conf1) producer.produce('my-topic',b'raw_bytes') - - conf2 = {'bootstrap.servers': "localhost:9092", - 'group.id': "foo", - 'auto.offset.reset': 'smallest'} + conf2 = {'bootstrap.servers': "localhost:9092", 'group.id': "foo", 'auto.offset.reset': 'smallest'} # report a span of type consumer with the default settings consumer = Consumer(conf2) + def basic_consume_loop(consumer, topics): try: consumer.subscribe(topics) @@ -43,11 +41,10 @@ def basic_consume_loop(consumer, topics): while running: msg = consumer.poll(timeout=1.0) if msg is None: continue - if msg.error(): if msg.error().code() == KafkaError._PARTITION_EOF: # End of partition event - sys.stderr.write(f"{msg.topic()} [{msg.partition()}] reached end at offset {msg.offset()}}\n") + sys.stderr.write(f"{msg.topic() [{msg.partition()}] reached end at offset {msg.offset()}}") elif msg.error(): raise KafkaException(msg.error()) else: @@ -57,19 +54,26 @@ def basic_consume_loop(consumer, topics): consumer.close() basic_consume_loop(consumer, "my-topic") + --- + +The _instrument method accepts the following keyword args: + tracer_provider (TracerProvider) - an optional tracer provider + + instrument_producer (Callable) - a function with extra user-defined logic to be performed before sending the message + this function signature is: + + def instrument_producer(producer: Producer, tracer_provider=None) + instrument_consumer (Callable) - a function with extra user-defined logic to be performed after consuming a message + this function signature is: + + def instrument_consumer(consumer: Consumer, tracer_provider=None) + for example: + +.. code:: python -The `_instrument` method accepts the following keyword args: -tracer_provider (TracerProvider) - an optional tracer provider -instrument_producer (Callable) - a function with extra user-defined logic to be performed before sending the message - this function signature is: - def instrument_producer(producer: Producer, tracer_provider=None) -instrument_consumer (Callable) - a function with extra user-defined logic to be performed after consuming a message - this function signature is: - def instrument_consumer(consumer: Consumer, tracer_provider=None) -for example: -.. code: python from opentelemetry.instrumentation.confluent_kafka import ConfluentKafkaInstrumentor + from confluent_kafka import Producer, Consumer inst = ConfluentKafkaInstrumentor() @@ -85,15 +89,12 @@ def instrument_consumer(consumer: Consumer, tracer_provider=None) p = inst.instrument_producer(p, tracer_provider) c = inst.instrument_consumer(c, tracer_provider=tracer_provider) - # Using kafka as normal now will automatically generate spans, # including user custom attributes added from the hooks conf = {'bootstrap.servers': "localhost:9092"} p.produce('my-topic',b'raw_bytes') msg = c.poll() - -API ___ """ from typing import Collection @@ -173,6 +174,9 @@ def __init__(self, consumer: Consumer, tracer: Tracer): def committed(self, partitions, timeout=-1): return self._consumer.committed(partitions, timeout) + def commit(self, *args, **kwargs): + return self._consumer.commit(*args, **kwargs) + def consume( self, num_messages=1, *args, **kwargs ): # pylint: disable=keyword-arg-before-vararg diff --git a/instrumentation/opentelemetry-instrumentation-confluent-kafka/src/opentelemetry/instrumentation/confluent_kafka/version.py b/instrumentation/opentelemetry-instrumentation-confluent-kafka/src/opentelemetry/instrumentation/confluent_kafka/version.py index 0a47df4f5a..8778b43b17 100644 --- a/instrumentation/opentelemetry-instrumentation-confluent-kafka/src/opentelemetry/instrumentation/confluent_kafka/version.py +++ b/instrumentation/opentelemetry-instrumentation-confluent-kafka/src/opentelemetry/instrumentation/confluent_kafka/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/instrumentation/opentelemetry-instrumentation-confluent-kafka/tests/test_instrumentation.py b/instrumentation/opentelemetry-instrumentation-confluent-kafka/tests/test_instrumentation.py index e9462d7898..d78d128760 100644 --- a/instrumentation/opentelemetry-instrumentation-confluent-kafka/tests/test_instrumentation.py +++ b/instrumentation/opentelemetry-instrumentation-confluent-kafka/tests/test_instrumentation.py @@ -58,3 +58,18 @@ def test_instrument_api(self) -> None: consumer = instrumentation.uninstrument_consumer(consumer) self.assertEqual(consumer.__class__, Consumer) + + def test_consumer_commit_method_exists(self) -> None: + instrumentation = ConfluentKafkaInstrumentor() + + consumer = Consumer( + { + "bootstrap.servers": "localhost:29092", + "group.id": "mygroup", + "auto.offset.reset": "earliest", + } + ) + + consumer = instrumentation.instrument_consumer(consumer) + self.assertEqual(consumer.__class__, ProxiedConsumer) + self.assertTrue(hasattr(consumer, "commit")) diff --git a/instrumentation/opentelemetry-instrumentation-dbapi/pyproject.toml b/instrumentation/opentelemetry-instrumentation-dbapi/pyproject.toml index ae16d1abc2..dc2a6effff 100644 --- a/instrumentation/opentelemetry-instrumentation-dbapi/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-dbapi/pyproject.toml @@ -26,15 +26,15 @@ classifiers = [ ] dependencies = [ "opentelemetry-api ~= 1.12", - "opentelemetry-instrumentation == 0.37b0.dev", - "opentelemetry-semantic-conventions == 0.37b0.dev", + "opentelemetry-instrumentation == 0.38b0.dev", + "opentelemetry-semantic-conventions == 0.38b0.dev", "wrapt >= 1.0.0, < 2.0.0", ] [project.optional-dependencies] instruments = [] test = [ - "opentelemetry-test-utils == 0.37b0.dev", + "opentelemetry-test-utils == 0.38b0.dev", ] [project.urls] diff --git a/instrumentation/opentelemetry-instrumentation-dbapi/src/opentelemetry/instrumentation/dbapi/__init__.py b/instrumentation/opentelemetry-instrumentation-dbapi/src/opentelemetry/instrumentation/dbapi/__init__.py index d2bb76061a..6d7e37a45f 100644 --- a/instrumentation/opentelemetry-instrumentation-dbapi/src/opentelemetry/instrumentation/dbapi/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-dbapi/src/opentelemetry/instrumentation/dbapi/__init__.py @@ -203,7 +203,7 @@ def instrument_connection( Returns: An instrumented connection. """ - if isinstance(connection, _TracedConnectionProxy): + if isinstance(connection, wrapt.ObjectProxy): _logger.warning("Connection already instrumented") return connection @@ -230,8 +230,8 @@ def uninstrument_connection(connection): Returns: An uninstrumented connection. """ - if isinstance(connection, _TracedConnectionProxy): - return connection._connection + if isinstance(connection, wrapt.ObjectProxy): + return connection.__wrapped__ _logger.warning("Connection is not instrumented") return connection @@ -320,22 +320,14 @@ def get_connection_attributes(self, connection): self.span_attributes[SpanAttributes.NET_PEER_PORT] = port -class _TracedConnectionProxy: - pass - - def get_traced_connection_proxy( connection, db_api_integration, *args, **kwargs ): # pylint: disable=abstract-method - class TracedConnectionProxy(type(connection), _TracedConnectionProxy): - def __init__(self, connection): - self._connection = connection - - def __getattr__(self, name): - return object.__getattribute__( - object.__getattribute__(self, "_connection"), name - ) + class TracedConnectionProxy(wrapt.ObjectProxy): + # pylint: disable=unused-argument + def __init__(self, connection, *args, **kwargs): + wrapt.ObjectProxy.__init__(self, connection) def __getattribute__(self, name): if object.__getattribute__(self, name): @@ -347,16 +339,17 @@ def __getattribute__(self, name): def cursor(self, *args, **kwargs): return get_traced_cursor_proxy( - self._connection.cursor(*args, **kwargs), db_api_integration + self.__wrapped__.cursor(*args, **kwargs), db_api_integration ) - # For some reason this is necessary as trying to access the close - # method of self._connection via __getattr__ leads to unexplained - # errors. - def close(self): - self._connection.close() + def __enter__(self): + self.__wrapped__.__enter__() + return self + + def __exit__(self, *args, **kwargs): + self.__wrapped__.__exit__(*args, **kwargs) - return TracedConnectionProxy(connection) + return TracedConnectionProxy(connection, *args, **kwargs) class CursorTracer: diff --git a/instrumentation/opentelemetry-instrumentation-dbapi/src/opentelemetry/instrumentation/dbapi/version.py b/instrumentation/opentelemetry-instrumentation-dbapi/src/opentelemetry/instrumentation/dbapi/version.py index eddd0b7d81..03a6e47521 100644 --- a/instrumentation/opentelemetry-instrumentation-dbapi/src/opentelemetry/instrumentation/dbapi/version.py +++ b/instrumentation/opentelemetry-instrumentation-dbapi/src/opentelemetry/instrumentation/dbapi/version.py @@ -12,6 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" _instruments = tuple() diff --git a/instrumentation/opentelemetry-instrumentation-dbapi/tests/test_dbapi_integration.py b/instrumentation/opentelemetry-instrumentation-dbapi/tests/test_dbapi_integration.py index 25ee279fe4..0d19ce8373 100644 --- a/instrumentation/opentelemetry-instrumentation-dbapi/tests/test_dbapi_integration.py +++ b/instrumentation/opentelemetry-instrumentation-dbapi/tests/test_dbapi_integration.py @@ -219,6 +219,21 @@ def test_custom_tracer_provider_dbapi(self): self.assertEqual(span.resource.attributes["db-resource-key"], "value") self.assertIs(span.status.status_code, trace_api.StatusCode.ERROR) + def test_no_op_tracer_provider(self): + db_integration = dbapi.DatabaseApiIntegration( + self.tracer, + "testcomponent", + tracer_provider=trace_api.NoOpTracerProvider(), + ) + + mock_connection = db_integration.wrapped_connection( + mock_connect, {}, {} + ) + cursor = mock_connection.cursor() + cursor.executemany("Test query") + spans_list = self.memory_exporter.get_finished_spans() + self.assertEqual(len(spans_list), 0) + def test_executemany(self): db_integration = dbapi.DatabaseApiIntegration( "testname", "testcomponent" @@ -310,14 +325,14 @@ def test_callproc(self): @mock.patch("opentelemetry.instrumentation.dbapi") def test_wrap_connect(self, mock_dbapi): - dbapi.wrap_connect(self.tracer, MockConnectionEmpty(), "connect", "-") + dbapi.wrap_connect(self.tracer, mock_dbapi, "connect", "-") connection = mock_dbapi.connect() self.assertEqual(mock_dbapi.connect.call_count, 1) - self.assertIsInstance(connection._connection, mock.Mock) + self.assertIsInstance(connection.__wrapped__, mock.Mock) @mock.patch("opentelemetry.instrumentation.dbapi") def test_unwrap_connect(self, mock_dbapi): - dbapi.wrap_connect(self.tracer, MockConnectionEmpty(), "connect", "-") + dbapi.wrap_connect(self.tracer, mock_dbapi, "connect", "-") connection = mock_dbapi.connect() self.assertEqual(mock_dbapi.connect.call_count, 1) @@ -327,21 +342,19 @@ def test_unwrap_connect(self, mock_dbapi): self.assertIsInstance(connection, mock.Mock) def test_instrument_connection(self): - connection = MockConnectionEmpty() + connection = mock.Mock() # Avoid get_attributes failing because can't concatenate mock - # pylint: disable=attribute-defined-outside-init connection.database = "-" connection2 = dbapi.instrument_connection(self.tracer, connection, "-") - self.assertIs(connection2._connection, connection) + self.assertIs(connection2.__wrapped__, connection) def test_uninstrument_connection(self): - connection = MockConnectionEmpty() + connection = mock.Mock() # Set connection.database to avoid a failure because mock can't # be concatenated - # pylint: disable=attribute-defined-outside-init connection.database = "-" connection2 = dbapi.instrument_connection(self.tracer, connection, "-") - self.assertIs(connection2._connection, connection) + self.assertIs(connection2.__wrapped__, connection) connection3 = dbapi.uninstrument_connection(connection2) self.assertIs(connection3, connection) @@ -357,12 +370,10 @@ def mock_connect(*args, **kwargs): server_host = kwargs.get("server_host") server_port = kwargs.get("server_port") user = kwargs.get("user") - return MockConnectionWithAttributes( - database, server_port, server_host, user - ) + return MockConnection(database, server_port, server_host, user) -class MockConnectionWithAttributes: +class MockConnection: def __init__(self, database, server_port, server_host, user): self.database = database self.server_port = server_port @@ -395,7 +406,3 @@ def executemany(self, query, params=None, throw_exception=False): def callproc(self, query, params=None, throw_exception=False): if throw_exception: raise Exception("Test Exception") - - -class MockConnectionEmpty: - pass diff --git a/instrumentation/opentelemetry-instrumentation-django/pyproject.toml b/instrumentation/opentelemetry-instrumentation-django/pyproject.toml index 8e1635c8e6..4a1e460f0c 100644 --- a/instrumentation/opentelemetry-instrumentation-django/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-django/pyproject.toml @@ -26,22 +26,22 @@ classifiers = [ ] dependencies = [ "opentelemetry-api ~= 1.12", - "opentelemetry-instrumentation == 0.37b0.dev", - "opentelemetry-instrumentation-wsgi == 0.37b0.dev", - "opentelemetry-semantic-conventions == 0.37b0.dev", - "opentelemetry-util-http == 0.37b0.dev", + "opentelemetry-instrumentation == 0.38b0.dev", + "opentelemetry-instrumentation-wsgi == 0.38b0.dev", + "opentelemetry-semantic-conventions == 0.38b0.dev", + "opentelemetry-util-http == 0.38b0.dev", ] [project.optional-dependencies] asgi = [ - "opentelemetry-instrumentation-asgi == 0.37b0.dev", + "opentelemetry-instrumentation-asgi == 0.38b0.dev", ] instruments = [ "django >= 1.10", ] test = [ "opentelemetry-instrumentation-django[instruments]", - "opentelemetry-test-utils == 0.37b0.dev", + "opentelemetry-test-utils == 0.38b0.dev", ] [project.entry-points.opentelemetry_instrumentor] diff --git a/instrumentation/opentelemetry-instrumentation-django/src/opentelemetry/instrumentation/django/version.py b/instrumentation/opentelemetry-instrumentation-django/src/opentelemetry/instrumentation/django/version.py index 0a47df4f5a..8778b43b17 100644 --- a/instrumentation/opentelemetry-instrumentation-django/src/opentelemetry/instrumentation/django/version.py +++ b/instrumentation/opentelemetry-instrumentation-django/src/opentelemetry/instrumentation/django/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/instrumentation/opentelemetry-instrumentation-django/tests/test_middleware_asgi.py b/instrumentation/opentelemetry-instrumentation-django/tests/test_middleware_asgi.py index 784f8e24ec..a78501bcb8 100644 --- a/instrumentation/opentelemetry-instrumentation-django/tests/test_middleware_asgi.py +++ b/instrumentation/opentelemetry-instrumentation-django/tests/test_middleware_asgi.py @@ -23,6 +23,7 @@ from django.test import SimpleTestCase from django.test.utils import setup_test_environment, teardown_test_environment +from opentelemetry import trace as trace_api from opentelemetry.instrumentation.django import ( DjangoInstrumentor, _DjangoMiddleware, @@ -424,6 +425,16 @@ async def test_tracer_provider_traced(self): span.resource.attributes["resource-key"], "resource-value" ) + async def test_no_op_tracer_provider(self): + _django_instrumentor.uninstrument() + _django_instrumentor.instrument( + tracer_provider=trace_api.NoOpTracerProvider() + ) + + await self.async_client.post("/traced/") + spans = self.exporter.get_finished_spans() + self.assertEqual(len(spans), 0) + @patch.dict( "os.environ", diff --git a/instrumentation/opentelemetry-instrumentation-elasticsearch/pyproject.toml b/instrumentation/opentelemetry-instrumentation-elasticsearch/pyproject.toml index 385a9f88a2..589b465998 100644 --- a/instrumentation/opentelemetry-instrumentation-elasticsearch/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-elasticsearch/pyproject.toml @@ -26,8 +26,8 @@ classifiers = [ ] dependencies = [ "opentelemetry-api ~= 1.12", - "opentelemetry-instrumentation == 0.37b0.dev", - "opentelemetry-semantic-conventions == 0.37b0.dev", + "opentelemetry-instrumentation == 0.38b0.dev", + "opentelemetry-semantic-conventions == 0.38b0.dev", "wrapt >= 1.0.0, < 2.0.0", ] @@ -38,7 +38,7 @@ instruments = [ test = [ "opentelemetry-instrumentation-elasticsearch[instruments]", "elasticsearch-dsl >= 2.0", - "opentelemetry-test-utils == 0.37b0.dev", + "opentelemetry-test-utils == 0.38b0.dev", ] [project.entry-points.opentelemetry_instrumentor] diff --git a/instrumentation/opentelemetry-instrumentation-elasticsearch/src/opentelemetry/instrumentation/elasticsearch/version.py b/instrumentation/opentelemetry-instrumentation-elasticsearch/src/opentelemetry/instrumentation/elasticsearch/version.py index 0a47df4f5a..8778b43b17 100644 --- a/instrumentation/opentelemetry-instrumentation-elasticsearch/src/opentelemetry/instrumentation/elasticsearch/version.py +++ b/instrumentation/opentelemetry-instrumentation-elasticsearch/src/opentelemetry/instrumentation/elasticsearch/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/instrumentation/opentelemetry-instrumentation-elasticsearch/tests/test_elasticsearch.py b/instrumentation/opentelemetry-instrumentation-elasticsearch/tests/test_elasticsearch.py index f7168b39d2..c69ba70fdd 100644 --- a/instrumentation/opentelemetry-instrumentation-elasticsearch/tests/test_elasticsearch.py +++ b/instrumentation/opentelemetry-instrumentation-elasticsearch/tests/test_elasticsearch.py @@ -463,6 +463,26 @@ def response_hook(span, response): spans[0].attributes[response_attribute_name], ) + def test_no_op_tracer_provider(self, request_mock): + ElasticsearchInstrumentor().uninstrument() + ElasticsearchInstrumentor().instrument( + tracer_provider=trace.NoOpTracerProvider() + ) + response_payload = '{"found": false, "timed_out": true, "took": 7}' + request_mock.return_value = ( + 1, + {}, + response_payload, + ) + es = Elasticsearch() + res = es.get(index="test-index", doc_type="_doc", id=1) + self.assertEqual( + res.get("found"), json.loads(response_payload).get("found") + ) + + spans_list = self.get_finished_spans() + self.assertEqual(len(spans_list), 0) + def test_body_sanitization(self, _): self.assertEqual( sanitize_body(sanitization_queries.interval_query), diff --git a/instrumentation/opentelemetry-instrumentation-falcon/pyproject.toml b/instrumentation/opentelemetry-instrumentation-falcon/pyproject.toml index 202ea4218c..dd3369dd3d 100644 --- a/instrumentation/opentelemetry-instrumentation-falcon/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-falcon/pyproject.toml @@ -26,10 +26,10 @@ classifiers = [ ] dependencies = [ "opentelemetry-api ~= 1.12", - "opentelemetry-instrumentation == 0.37b0.dev", - "opentelemetry-instrumentation-wsgi == 0.37b0.dev", - "opentelemetry-semantic-conventions == 0.37b0.dev", - "opentelemetry-util-http == 0.37b0.dev", + "opentelemetry-instrumentation == 0.38b0.dev", + "opentelemetry-instrumentation-wsgi == 0.38b0.dev", + "opentelemetry-semantic-conventions == 0.38b0.dev", + "opentelemetry-util-http == 0.38b0.dev", "packaging >= 20.0", ] @@ -39,7 +39,7 @@ instruments = [ ] test = [ "opentelemetry-instrumentation-falcon[instruments]", - "opentelemetry-test-utils == 0.37b0.dev", + "opentelemetry-test-utils == 0.38b0.dev", "parameterized == 0.7.4", ] diff --git a/instrumentation/opentelemetry-instrumentation-falcon/src/opentelemetry/instrumentation/falcon/version.py b/instrumentation/opentelemetry-instrumentation-falcon/src/opentelemetry/instrumentation/falcon/version.py index 0a47df4f5a..8778b43b17 100644 --- a/instrumentation/opentelemetry-instrumentation-falcon/src/opentelemetry/instrumentation/falcon/version.py +++ b/instrumentation/opentelemetry-instrumentation-falcon/src/opentelemetry/instrumentation/falcon/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/instrumentation/opentelemetry-instrumentation-fastapi/pyproject.toml b/instrumentation/opentelemetry-instrumentation-fastapi/pyproject.toml index e5ad586802..9ab03f3b79 100644 --- a/instrumentation/opentelemetry-instrumentation-fastapi/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-fastapi/pyproject.toml @@ -26,10 +26,10 @@ classifiers = [ ] dependencies = [ "opentelemetry-api ~= 1.12", - "opentelemetry-instrumentation == 0.37b0.dev", - "opentelemetry-instrumentation-asgi == 0.37b0.dev", - "opentelemetry-semantic-conventions == 0.37b0.dev", - "opentelemetry-util-http == 0.37b0.dev", + "opentelemetry-instrumentation == 0.38b0.dev", + "opentelemetry-instrumentation-asgi == 0.38b0.dev", + "opentelemetry-semantic-conventions == 0.38b0.dev", + "opentelemetry-util-http == 0.38b0.dev", ] [project.optional-dependencies] @@ -38,7 +38,7 @@ instruments = [ ] test = [ "opentelemetry-instrumentation-fastapi[instruments]", - "opentelemetry-test-utils == 0.37b0.dev", + "opentelemetry-test-utils == 0.38b0.dev", "requests ~= 2.23", # needed for testclient "httpx ~= 0.22", # needed for testclient ] diff --git a/instrumentation/opentelemetry-instrumentation-fastapi/src/opentelemetry/instrumentation/fastapi/version.py b/instrumentation/opentelemetry-instrumentation-fastapi/src/opentelemetry/instrumentation/fastapi/version.py index 0a47df4f5a..8778b43b17 100644 --- a/instrumentation/opentelemetry-instrumentation-fastapi/src/opentelemetry/instrumentation/fastapi/version.py +++ b/instrumentation/opentelemetry-instrumentation-fastapi/src/opentelemetry/instrumentation/fastapi/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/instrumentation/opentelemetry-instrumentation-flask/pyproject.toml b/instrumentation/opentelemetry-instrumentation-flask/pyproject.toml index f5ef3e20fc..7bd08da5c3 100644 --- a/instrumentation/opentelemetry-instrumentation-flask/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-flask/pyproject.toml @@ -26,10 +26,10 @@ classifiers = [ ] dependencies = [ "opentelemetry-api ~= 1.12", - "opentelemetry-instrumentation == 0.37b0.dev", - "opentelemetry-instrumentation-wsgi == 0.37b0.dev", - "opentelemetry-semantic-conventions == 0.37b0.dev", - "opentelemetry-util-http == 0.37b0.dev", + "opentelemetry-instrumentation == 0.38b0.dev", + "opentelemetry-instrumentation-wsgi == 0.38b0.dev", + "opentelemetry-semantic-conventions == 0.38b0.dev", + "opentelemetry-util-http == 0.38b0.dev", ] [project.optional-dependencies] @@ -39,7 +39,7 @@ instruments = [ test = [ "opentelemetry-instrumentation-flask[instruments]", "markupsafe==2.0.1", - "opentelemetry-test-utils == 0.37b0.dev", + "opentelemetry-test-utils == 0.38b0.dev", ] [project.entry-points.opentelemetry_instrumentor] diff --git a/instrumentation/opentelemetry-instrumentation-flask/src/opentelemetry/instrumentation/flask/__init__.py b/instrumentation/opentelemetry-instrumentation-flask/src/opentelemetry/instrumentation/flask/__init__.py index 922c5e0b41..fd3c40aab3 100644 --- a/instrumentation/opentelemetry-instrumentation-flask/src/opentelemetry/instrumentation/flask/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-flask/src/opentelemetry/instrumentation/flask/__init__.py @@ -238,8 +238,8 @@ def response_hook(span: Span, status: str, response_headers: List): API --- """ - from logging import getLogger +from threading import get_ident from time import time_ns from timeit import default_timer from typing import Collection @@ -265,6 +265,7 @@ def response_hook(span: Span, status: str, response_headers: List): _ENVIRON_STARTTIME_KEY = "opentelemetry-flask.starttime_key" _ENVIRON_SPAN_KEY = "opentelemetry-flask.span_key" _ENVIRON_ACTIVATION_KEY = "opentelemetry-flask.activation_key" +_ENVIRON_THREAD_ID_KEY = "opentelemetry-flask.thread_id_key" _ENVIRON_TOKEN = "opentelemetry-flask.token" _excluded_urls_from_env = get_excluded_urls("FLASK") @@ -398,6 +399,7 @@ def _before_request(): activation = trace.use_span(span, end_on_exit=True) activation.__enter__() # pylint: disable=E1101 flask_request_environ[_ENVIRON_ACTIVATION_KEY] = activation + flask_request_environ[_ENVIRON_THREAD_ID_KEY] = get_ident() flask_request_environ[_ENVIRON_SPAN_KEY] = span flask_request_environ[_ENVIRON_TOKEN] = token @@ -437,10 +439,17 @@ def _teardown_request(exc): return activation = flask.request.environ.get(_ENVIRON_ACTIVATION_KEY) - if not activation: + thread_id = flask.request.environ.get(_ENVIRON_THREAD_ID_KEY) + if not activation or thread_id != get_ident(): # This request didn't start a span, maybe because it was created in # a way that doesn't run `before_request`, like when it is created # with `app.test_request_context`. + # + # Similarly, check the thread_id against the current thread to ensure + # tear down only happens on the original thread. This situation can + # arise if the original thread handling the request spawn children + # threads and then uses something like copy_current_request_context + # to copy the request context. return if exc is None: activation.__exit__(None, None, None) diff --git a/instrumentation/opentelemetry-instrumentation-flask/src/opentelemetry/instrumentation/flask/version.py b/instrumentation/opentelemetry-instrumentation-flask/src/opentelemetry/instrumentation/flask/version.py index 0a47df4f5a..8778b43b17 100644 --- a/instrumentation/opentelemetry-instrumentation-flask/src/opentelemetry/instrumentation/flask/version.py +++ b/instrumentation/opentelemetry-instrumentation-flask/src/opentelemetry/instrumentation/flask/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/instrumentation/opentelemetry-instrumentation-flask/tests/base_test.py b/instrumentation/opentelemetry-instrumentation-flask/tests/base_test.py index 1da8faa7fd..a9cc4e55f7 100644 --- a/instrumentation/opentelemetry-instrumentation-flask/tests/base_test.py +++ b/instrumentation/opentelemetry-instrumentation-flask/tests/base_test.py @@ -12,6 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +from concurrent.futures import ThreadPoolExecutor, as_completed +from random import randint + import flask from werkzeug.test import Client from werkzeug.wrappers import Response @@ -34,6 +37,25 @@ def _sqlcommenter_endpoint(): ) return sqlcommenter_flask_values + @staticmethod + def _multithreaded_endpoint(count): + def do_random_stuff(): + @flask.copy_current_request_context + def inner(): + return randint(0, 100) + + return inner + + executor = ThreadPoolExecutor(count) + futures = [] + for _ in range(count): + futures.append(executor.submit(do_random_stuff())) + numbers = [] + for future in as_completed(futures): + numbers.append(future.result()) + + return " ".join([str(i) for i in numbers]) + @staticmethod def _custom_response_headers(): resp = flask.Response("test response") @@ -61,6 +83,7 @@ def excluded2_endpoint(): # pylint: disable=no-member self.app.route("/hello/")(self._hello_endpoint) self.app.route("/sqlcommenter")(self._sqlcommenter_endpoint) + self.app.route("/multithreaded")(self._multithreaded_endpoint) self.app.route("/excluded/")(self._hello_endpoint) self.app.route("/excluded")(excluded_endpoint) self.app.route("/excluded2")(excluded2_endpoint) diff --git a/instrumentation/opentelemetry-instrumentation-flask/tests/test_automatic.py b/instrumentation/opentelemetry-instrumentation-flask/tests/test_automatic.py index b4ed9eb0bc..16d299085d 100644 --- a/instrumentation/opentelemetry-instrumentation-flask/tests/test_automatic.py +++ b/instrumentation/opentelemetry-instrumentation-flask/tests/test_automatic.py @@ -16,6 +16,7 @@ from werkzeug.test import Client from werkzeug.wrappers import Response +from opentelemetry import trace as trace_api from opentelemetry.instrumentation.flask import FlaskInstrumentor from opentelemetry.test.wsgitestutil import WsgiTestBase @@ -78,3 +79,18 @@ def test_exluded_urls_explicit(self): self.assertEqual([b"Hello: 456"], list(resp.response)) span_list = self.memory_exporter.get_finished_spans() self.assertEqual(len(span_list), 1) + + def test_no_op_tracer_provider(self): + FlaskInstrumentor().uninstrument() + FlaskInstrumentor().instrument( + tracer_provider=trace_api.NoOpTracerProvider() + ) + + self.app = flask.Flask(__name__) + self.app.route("/hello/")(self._hello_endpoint) + # pylint: disable=attribute-defined-outside-init + self.client = Client(self.app, Response) + self.client.get("/hello/123") + + span_list = self.memory_exporter.get_finished_spans() + self.assertEqual(len(span_list), 0) diff --git a/instrumentation/opentelemetry-instrumentation-flask/tests/test_multithreading.py b/instrumentation/opentelemetry-instrumentation-flask/tests/test_multithreading.py new file mode 100644 index 0000000000..a793b229e3 --- /dev/null +++ b/instrumentation/opentelemetry-instrumentation-flask/tests/test_multithreading.py @@ -0,0 +1,52 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import flask +from werkzeug.test import Client +from werkzeug.wrappers import Response + +from opentelemetry.instrumentation.flask import FlaskInstrumentor +from opentelemetry.test.wsgitestutil import WsgiTestBase + +# pylint: disable=import-error +from .base_test import InstrumentationTest + + +class TestMultiThreading(InstrumentationTest, WsgiTestBase): + def setUp(self): + super().setUp() + FlaskInstrumentor().instrument() + self.app = flask.Flask(__name__) + self._common_initialization() + + def tearDown(self): + super().tearDown() + with self.disable_logging(): + FlaskInstrumentor().uninstrument() + + def test_multithreaded(self): + """Test that instrumentation tear down does not blow up + when the request thread spawn children threads and the request + context is copied to the children threads + """ + self.app = flask.Flask(__name__) + self.app.route("/multithreaded/")( + self._multithreaded_endpoint + ) + client = Client(self.app, Response) + count = 5 + resp = client.get(f"/multithreaded/{count}") + self.assertEqual(200, resp.status_code) + # Should return the specified number of random integers + self.assertEqual(count, len(resp.text.split(" "))) diff --git a/instrumentation/opentelemetry-instrumentation-grpc/pyproject.toml b/instrumentation/opentelemetry-instrumentation-grpc/pyproject.toml index be010cde7d..3111a47024 100644 --- a/instrumentation/opentelemetry-instrumentation-grpc/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-grpc/pyproject.toml @@ -26,9 +26,9 @@ classifiers = [ ] dependencies = [ "opentelemetry-api ~= 1.12", - "opentelemetry-instrumentation == 0.37b0.dev", + "opentelemetry-instrumentation == 0.38b0.dev", "opentelemetry-sdk ~= 1.12", - "opentelemetry-semantic-conventions == 0.37b0.dev", + "opentelemetry-semantic-conventions == 0.38b0.dev", "wrapt >= 1.0.0, < 2.0.0", ] @@ -39,7 +39,7 @@ instruments = [ test = [ "opentelemetry-instrumentation-grpc[instruments]", "opentelemetry-sdk ~= 1.12", - "opentelemetry-test-utils == 0.37b0.dev", + "opentelemetry-test-utils == 0.38b0.dev", "protobuf ~= 3.13", ] diff --git a/instrumentation/opentelemetry-instrumentation-grpc/src/opentelemetry/instrumentation/grpc/version.py b/instrumentation/opentelemetry-instrumentation-grpc/src/opentelemetry/instrumentation/grpc/version.py index 0a47df4f5a..8778b43b17 100644 --- a/instrumentation/opentelemetry-instrumentation-grpc/src/opentelemetry/instrumentation/grpc/version.py +++ b/instrumentation/opentelemetry-instrumentation-grpc/src/opentelemetry/instrumentation/grpc/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/instrumentation/opentelemetry-instrumentation-httpx/pyproject.toml b/instrumentation/opentelemetry-instrumentation-httpx/pyproject.toml index d5cc529bde..dec55b5241 100644 --- a/instrumentation/opentelemetry-instrumentation-httpx/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-httpx/pyproject.toml @@ -26,8 +26,8 @@ classifiers = [ ] dependencies = [ "opentelemetry-api ~= 1.12", - "opentelemetry-instrumentation == 0.37b0.dev", - "opentelemetry-semantic-conventions == 0.37b0.dev", + "opentelemetry-instrumentation == 0.38b0.dev", + "opentelemetry-semantic-conventions == 0.38b0.dev", ] [project.optional-dependencies] @@ -37,7 +37,7 @@ instruments = [ test = [ "opentelemetry-instrumentation-httpx[instruments]", "opentelemetry-sdk ~= 1.12", - "opentelemetry-test-utils == 0.37b0.dev", + "opentelemetry-test-utils == 0.38b0.dev", ] [project.entry-points.opentelemetry_instrumentor] diff --git a/instrumentation/opentelemetry-instrumentation-httpx/src/opentelemetry/instrumentation/httpx/version.py b/instrumentation/opentelemetry-instrumentation-httpx/src/opentelemetry/instrumentation/httpx/version.py index 0a47df4f5a..8778b43b17 100644 --- a/instrumentation/opentelemetry-instrumentation-httpx/src/opentelemetry/instrumentation/httpx/version.py +++ b/instrumentation/opentelemetry-instrumentation-httpx/src/opentelemetry/instrumentation/httpx/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/instrumentation/opentelemetry-instrumentation-jinja2/pyproject.toml b/instrumentation/opentelemetry-instrumentation-jinja2/pyproject.toml index c41856e99f..98b9d420c6 100644 --- a/instrumentation/opentelemetry-instrumentation-jinja2/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-jinja2/pyproject.toml @@ -25,7 +25,7 @@ classifiers = [ ] dependencies = [ "opentelemetry-api ~= 1.12", - "opentelemetry-instrumentation == 0.37b0.dev", + "opentelemetry-instrumentation == 0.38b0.dev", "wrapt >= 1.0.0, < 2.0.0", ] @@ -36,7 +36,7 @@ instruments = [ test = [ "opentelemetry-instrumentation-jinja2[instruments]", "markupsafe==2.0.1", - "opentelemetry-test-utils == 0.37b0.dev", + "opentelemetry-test-utils == 0.38b0.dev", ] [project.entry-points.opentelemetry_instrumentor] diff --git a/instrumentation/opentelemetry-instrumentation-jinja2/src/opentelemetry/instrumentation/jinja2/version.py b/instrumentation/opentelemetry-instrumentation-jinja2/src/opentelemetry/instrumentation/jinja2/version.py index 0a47df4f5a..8778b43b17 100644 --- a/instrumentation/opentelemetry-instrumentation-jinja2/src/opentelemetry/instrumentation/jinja2/version.py +++ b/instrumentation/opentelemetry-instrumentation-jinja2/src/opentelemetry/instrumentation/jinja2/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/instrumentation/opentelemetry-instrumentation-kafka-python/pyproject.toml b/instrumentation/opentelemetry-instrumentation-kafka-python/pyproject.toml index 8ee0f474f2..0a8e3b8b0d 100644 --- a/instrumentation/opentelemetry-instrumentation-kafka-python/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-kafka-python/pyproject.toml @@ -26,8 +26,8 @@ classifiers = [ ] dependencies = [ "opentelemetry-api ~= 1.5", - "opentelemetry-instrumentation == 0.37b0.dev", - "opentelemetry-semantic-conventions == 0.37b0.dev", + "opentelemetry-instrumentation == 0.38b0.dev", + "opentelemetry-semantic-conventions == 0.38b0.dev", ] [project.optional-dependencies] @@ -36,7 +36,7 @@ instruments = [ ] test = [ "opentelemetry-instrumentation-kafka-python[instruments]", - "opentelemetry-test-utils == 0.37b0.dev", + "opentelemetry-test-utils == 0.38b0.dev", "wrapt >= 1.0.0, < 2.0.0", ] diff --git a/instrumentation/opentelemetry-instrumentation-kafka-python/src/opentelemetry/instrumentation/kafka/version.py b/instrumentation/opentelemetry-instrumentation-kafka-python/src/opentelemetry/instrumentation/kafka/version.py index 0a47df4f5a..8778b43b17 100644 --- a/instrumentation/opentelemetry-instrumentation-kafka-python/src/opentelemetry/instrumentation/kafka/version.py +++ b/instrumentation/opentelemetry-instrumentation-kafka-python/src/opentelemetry/instrumentation/kafka/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/instrumentation/opentelemetry-instrumentation-logging/pyproject.toml b/instrumentation/opentelemetry-instrumentation-logging/pyproject.toml index e2d3cb4d68..1cdc6981bd 100644 --- a/instrumentation/opentelemetry-instrumentation-logging/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-logging/pyproject.toml @@ -25,13 +25,13 @@ classifiers = [ ] dependencies = [ "opentelemetry-api ~= 1.12", - "opentelemetry-instrumentation == 0.37b0.dev", + "opentelemetry-instrumentation == 0.38b0.dev", ] [project.optional-dependencies] instruments = [] test = [ - "opentelemetry-test-utils == 0.37b0.dev", + "opentelemetry-test-utils == 0.38b0.dev", ] [project.entry-points.opentelemetry_instrumentor] diff --git a/instrumentation/opentelemetry-instrumentation-logging/src/opentelemetry/instrumentation/logging/version.py b/instrumentation/opentelemetry-instrumentation-logging/src/opentelemetry/instrumentation/logging/version.py index eddd0b7d81..03a6e47521 100644 --- a/instrumentation/opentelemetry-instrumentation-logging/src/opentelemetry/instrumentation/logging/version.py +++ b/instrumentation/opentelemetry-instrumentation-logging/src/opentelemetry/instrumentation/logging/version.py @@ -12,6 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" _instruments = tuple() diff --git a/instrumentation/opentelemetry-instrumentation-mysql/pyproject.toml b/instrumentation/opentelemetry-instrumentation-mysql/pyproject.toml index 8256f0565f..80b3b37f8d 100644 --- a/instrumentation/opentelemetry-instrumentation-mysql/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-mysql/pyproject.toml @@ -26,8 +26,8 @@ classifiers = [ ] dependencies = [ "opentelemetry-api ~= 1.12", - "opentelemetry-instrumentation == 0.37b0.dev", - "opentelemetry-instrumentation-dbapi == 0.37b0.dev", + "opentelemetry-instrumentation == 0.38b0.dev", + "opentelemetry-instrumentation-dbapi == 0.38b0.dev", ] [project.optional-dependencies] @@ -36,7 +36,7 @@ instruments = [ ] test = [ "opentelemetry-instrumentation-mysql[instruments]", - "opentelemetry-test-utils == 0.37b0.dev", + "opentelemetry-test-utils == 0.38b0.dev", ] [project.entry-points.opentelemetry_instrumentor] diff --git a/instrumentation/opentelemetry-instrumentation-mysql/src/opentelemetry/instrumentation/mysql/version.py b/instrumentation/opentelemetry-instrumentation-mysql/src/opentelemetry/instrumentation/mysql/version.py index 0a47df4f5a..8778b43b17 100644 --- a/instrumentation/opentelemetry-instrumentation-mysql/src/opentelemetry/instrumentation/mysql/version.py +++ b/instrumentation/opentelemetry-instrumentation-mysql/src/opentelemetry/instrumentation/mysql/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/instrumentation/opentelemetry-instrumentation-mysql/tests/test_mysql_integration.py b/instrumentation/opentelemetry-instrumentation-mysql/tests/test_mysql_integration.py index 8274851ff1..3614febffd 100644 --- a/instrumentation/opentelemetry-instrumentation-mysql/tests/test_mysql_integration.py +++ b/instrumentation/opentelemetry-instrumentation-mysql/tests/test_mysql_integration.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from unittest.mock import Mock, patch +from unittest import mock import mysql.connector @@ -23,15 +23,6 @@ from opentelemetry.test.test_base import TestBase -def mock_connect(*args, **kwargs): - class MockConnection: - def cursor(self): - # pylint: disable=no-self-use - return Mock() - - return MockConnection() - - def connect_and_execute_query(): cnx = mysql.connector.connect(database="test") cursor = cnx.cursor() @@ -47,9 +38,9 @@ def tearDown(self): with self.disable_logging(): MySQLInstrumentor().uninstrument() - @patch("mysql.connector.connect", new=mock_connect) + @mock.patch("mysql.connector.connect") # pylint: disable=unused-argument - def test_instrumentor(self): + def test_instrumentor(self, mock_connect): MySQLInstrumentor().instrument() connect_and_execute_query() @@ -71,8 +62,9 @@ def test_instrumentor(self): spans_list = self.memory_exporter.get_finished_spans() self.assertEqual(len(spans_list), 1) - @patch("mysql.connector.connect", new=mock_connect) - def test_custom_tracer_provider(self): + @mock.patch("mysql.connector.connect") + # pylint: disable=unused-argument + def test_custom_tracer_provider(self, mock_connect): resource = resources.Resource.create({}) result = self.create_tracer_provider(resource=resource) tracer_provider, exporter = result @@ -86,9 +78,9 @@ def test_custom_tracer_provider(self): self.assertIs(span.resource, resource) - @patch("mysql.connector.connect", new=mock_connect) + @mock.patch("mysql.connector.connect") # pylint: disable=unused-argument - def test_instrument_connection(self): + def test_instrument_connection(self, mock_connect): cnx, query = connect_and_execute_query() spans_list = self.memory_exporter.get_finished_spans() @@ -101,8 +93,8 @@ def test_instrument_connection(self): spans_list = self.memory_exporter.get_finished_spans() self.assertEqual(len(spans_list), 1) - @patch("mysql.connector.connect", new=mock_connect) - def test_instrument_connection_no_op_tracer_provider(self): + @mock.patch("mysql.connector.connect") + def test_instrument_connection_no_op_tracer_provider(self, mock_connect): tracer_provider = trace_api.NoOpTracerProvider() MySQLInstrumentor().instrument(tracer_provider=tracer_provider) connect_and_execute_query() @@ -110,9 +102,9 @@ def test_instrument_connection_no_op_tracer_provider(self): spans_list = self.memory_exporter.get_finished_spans() self.assertEqual(len(spans_list), 0) - @patch("mysql.connector.connect", new=mock_connect) + @mock.patch("mysql.connector.connect") # pylint: disable=unused-argument - def test_uninstrument_connection(self): + def test_uninstrument_connection(self, mock_connect): MySQLInstrumentor().instrument() cnx, query = connect_and_execute_query() diff --git a/instrumentation/opentelemetry-instrumentation-pika/pyproject.toml b/instrumentation/opentelemetry-instrumentation-pika/pyproject.toml index 034f4e6524..4995c6a466 100644 --- a/instrumentation/opentelemetry-instrumentation-pika/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-pika/pyproject.toml @@ -36,7 +36,7 @@ instruments = [ ] test = [ "opentelemetry-instrumentation-pika[instruments]", - "opentelemetry-test-utils == 0.37b0.dev", + "opentelemetry-test-utils == 0.38b0.dev", "pytest", "wrapt >= 1.0.0, < 2.0.0", ] diff --git a/instrumentation/opentelemetry-instrumentation-pika/src/opentelemetry/instrumentation/pika/version.py b/instrumentation/opentelemetry-instrumentation-pika/src/opentelemetry/instrumentation/pika/version.py index 0a47df4f5a..8778b43b17 100644 --- a/instrumentation/opentelemetry-instrumentation-pika/src/opentelemetry/instrumentation/pika/version.py +++ b/instrumentation/opentelemetry-instrumentation-pika/src/opentelemetry/instrumentation/pika/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/instrumentation/opentelemetry-instrumentation-psycopg2/pyproject.toml b/instrumentation/opentelemetry-instrumentation-psycopg2/pyproject.toml index abcb2e8f79..2e9b350511 100644 --- a/instrumentation/opentelemetry-instrumentation-psycopg2/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-psycopg2/pyproject.toml @@ -26,8 +26,8 @@ classifiers = [ ] dependencies = [ "opentelemetry-api ~= 1.12", - "opentelemetry-instrumentation == 0.37b0.dev", - "opentelemetry-instrumentation-dbapi == 0.37b0.dev", + "opentelemetry-instrumentation == 0.38b0.dev", + "opentelemetry-instrumentation-dbapi == 0.38b0.dev", ] [project.optional-dependencies] @@ -36,7 +36,7 @@ instruments = [ ] test = [ "opentelemetry-instrumentation-psycopg2[instruments]", - "opentelemetry-test-utils == 0.37b0.dev", + "opentelemetry-test-utils == 0.38b0.dev", ] [project.entry-points.opentelemetry_instrumentor] diff --git a/instrumentation/opentelemetry-instrumentation-psycopg2/src/opentelemetry/instrumentation/psycopg2/version.py b/instrumentation/opentelemetry-instrumentation-psycopg2/src/opentelemetry/instrumentation/psycopg2/version.py index 0a47df4f5a..8778b43b17 100644 --- a/instrumentation/opentelemetry-instrumentation-psycopg2/src/opentelemetry/instrumentation/psycopg2/version.py +++ b/instrumentation/opentelemetry-instrumentation-psycopg2/src/opentelemetry/instrumentation/psycopg2/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/instrumentation/opentelemetry-instrumentation-pymemcache/pyproject.toml b/instrumentation/opentelemetry-instrumentation-pymemcache/pyproject.toml index 56b842817a..2deebc216e 100644 --- a/instrumentation/opentelemetry-instrumentation-pymemcache/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-pymemcache/pyproject.toml @@ -26,8 +26,8 @@ classifiers = [ ] dependencies = [ "opentelemetry-api ~= 1.12", - "opentelemetry-instrumentation == 0.37b0.dev", - "opentelemetry-semantic-conventions == 0.37b0.dev", + "opentelemetry-instrumentation == 0.38b0.dev", + "opentelemetry-semantic-conventions == 0.38b0.dev", "wrapt >= 1.0.0, < 2.0.0", ] @@ -37,7 +37,7 @@ instruments = [ ] test = [ "opentelemetry-instrumentation-pymemcache[instruments]", - "opentelemetry-test-utils == 0.37b0.dev", + "opentelemetry-test-utils == 0.38b0.dev", ] [project.entry-points.opentelemetry_instrumentor] diff --git a/instrumentation/opentelemetry-instrumentation-pymemcache/src/opentelemetry/instrumentation/pymemcache/version.py b/instrumentation/opentelemetry-instrumentation-pymemcache/src/opentelemetry/instrumentation/pymemcache/version.py index 0a47df4f5a..8778b43b17 100644 --- a/instrumentation/opentelemetry-instrumentation-pymemcache/src/opentelemetry/instrumentation/pymemcache/version.py +++ b/instrumentation/opentelemetry-instrumentation-pymemcache/src/opentelemetry/instrumentation/pymemcache/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/instrumentation/opentelemetry-instrumentation-pymongo/pyproject.toml b/instrumentation/opentelemetry-instrumentation-pymongo/pyproject.toml index 8c47fed5d2..179a0a8f03 100644 --- a/instrumentation/opentelemetry-instrumentation-pymongo/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-pymongo/pyproject.toml @@ -26,8 +26,8 @@ classifiers = [ ] dependencies = [ "opentelemetry-api ~= 1.12", - "opentelemetry-instrumentation == 0.37b0.dev", - "opentelemetry-semantic-conventions == 0.37b0.dev", + "opentelemetry-instrumentation == 0.38b0.dev", + "opentelemetry-semantic-conventions == 0.38b0.dev", ] [project.optional-dependencies] @@ -36,7 +36,7 @@ instruments = [ ] test = [ "opentelemetry-instrumentation-pymongo[instruments]", - "opentelemetry-test-utils == 0.37b0.dev", + "opentelemetry-test-utils == 0.38b0.dev", ] [project.entry-points.opentelemetry_instrumentor] diff --git a/instrumentation/opentelemetry-instrumentation-pymongo/src/opentelemetry/instrumentation/pymongo/version.py b/instrumentation/opentelemetry-instrumentation-pymongo/src/opentelemetry/instrumentation/pymongo/version.py index 0a47df4f5a..8778b43b17 100644 --- a/instrumentation/opentelemetry-instrumentation-pymongo/src/opentelemetry/instrumentation/pymongo/version.py +++ b/instrumentation/opentelemetry-instrumentation-pymongo/src/opentelemetry/instrumentation/pymongo/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/instrumentation/opentelemetry-instrumentation-pymysql/pyproject.toml b/instrumentation/opentelemetry-instrumentation-pymysql/pyproject.toml index be5f099245..3a68638953 100644 --- a/instrumentation/opentelemetry-instrumentation-pymysql/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-pymysql/pyproject.toml @@ -26,8 +26,8 @@ classifiers = [ ] dependencies = [ "opentelemetry-api ~= 1.12", - "opentelemetry-instrumentation == 0.37b0.dev", - "opentelemetry-instrumentation-dbapi == 0.37b0.dev", + "opentelemetry-instrumentation == 0.38b0.dev", + "opentelemetry-instrumentation-dbapi == 0.38b0.dev", ] [project.optional-dependencies] @@ -36,7 +36,7 @@ instruments = [ ] test = [ "opentelemetry-instrumentation-pymysql[instruments]", - "opentelemetry-test-utils == 0.37b0.dev", + "opentelemetry-test-utils == 0.38b0.dev", ] [project.entry-points.opentelemetry_instrumentor] diff --git a/instrumentation/opentelemetry-instrumentation-pymysql/src/opentelemetry/instrumentation/pymysql/version.py b/instrumentation/opentelemetry-instrumentation-pymysql/src/opentelemetry/instrumentation/pymysql/version.py index 0a47df4f5a..8778b43b17 100644 --- a/instrumentation/opentelemetry-instrumentation-pymysql/src/opentelemetry/instrumentation/pymysql/version.py +++ b/instrumentation/opentelemetry-instrumentation-pymysql/src/opentelemetry/instrumentation/pymysql/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/instrumentation/opentelemetry-instrumentation-pymysql/tests/test_pymysql_integration.py b/instrumentation/opentelemetry-instrumentation-pymysql/tests/test_pymysql_integration.py index 42dd94f2da..587ebc1b53 100644 --- a/instrumentation/opentelemetry-instrumentation-pymysql/tests/test_pymysql_integration.py +++ b/instrumentation/opentelemetry-instrumentation-pymysql/tests/test_pymysql_integration.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from unittest.mock import Mock, patch +from unittest import mock import pymysql @@ -22,24 +22,15 @@ from opentelemetry.test.test_base import TestBase -def mock_connect(*args, **kwargs): - class MockConnection: - def cursor(self): - # pylint: disable=no-self-use - return Mock() - - return MockConnection() - - class TestPyMysqlIntegration(TestBase): def tearDown(self): super().tearDown() with self.disable_logging(): PyMySQLInstrumentor().uninstrument() - @patch("pymysql.connect", new=mock_connect) + @mock.patch("pymysql.connect") # pylint: disable=unused-argument - def test_instrumentor(self): + def test_instrumentor(self, mock_connect): PyMySQLInstrumentor().instrument() cnx = pymysql.connect(database="test") @@ -67,9 +58,9 @@ def test_instrumentor(self): spans_list = self.memory_exporter.get_finished_spans() self.assertEqual(len(spans_list), 1) - @patch("pymysql.connect", new=mock_connect) + @mock.patch("pymysql.connect") # pylint: disable=unused-argument - def test_custom_tracer_provider(self): + def test_custom_tracer_provider(self, mock_connect): resource = resources.Resource.create({}) result = self.create_tracer_provider(resource=resource) tracer_provider, exporter = result @@ -87,9 +78,9 @@ def test_custom_tracer_provider(self): self.assertIs(span.resource, resource) - @patch("pymysql.connect", new=mock_connect) + @mock.patch("pymysql.connect") # pylint: disable=unused-argument - def test_instrument_connection(self): + def test_instrument_connection(self, mock_connect): cnx = pymysql.connect(database="test") query = "SELECT * FROM test" cursor = cnx.cursor() @@ -105,9 +96,9 @@ def test_instrument_connection(self): spans_list = self.memory_exporter.get_finished_spans() self.assertEqual(len(spans_list), 1) - @patch("pymysql.connect", new=mock_connect) + @mock.patch("pymysql.connect") # pylint: disable=unused-argument - def test_uninstrument_connection(self): + def test_uninstrument_connection(self, mock_connect): PyMySQLInstrumentor().instrument() cnx = pymysql.connect(database="test") query = "SELECT * FROM test" diff --git a/instrumentation/opentelemetry-instrumentation-pyramid/pyproject.toml b/instrumentation/opentelemetry-instrumentation-pyramid/pyproject.toml index 0bfcf29b24..b7bf6fe7cf 100644 --- a/instrumentation/opentelemetry-instrumentation-pyramid/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-pyramid/pyproject.toml @@ -26,10 +26,10 @@ classifiers = [ ] dependencies = [ "opentelemetry-api ~= 1.12", - "opentelemetry-instrumentation == 0.37b0.dev", - "opentelemetry-instrumentation-wsgi == 0.37b0.dev", - "opentelemetry-semantic-conventions == 0.37b0.dev", - "opentelemetry-util-http == 0.37b0.dev", + "opentelemetry-instrumentation == 0.38b0.dev", + "opentelemetry-instrumentation-wsgi == 0.38b0.dev", + "opentelemetry-semantic-conventions == 0.38b0.dev", + "opentelemetry-util-http == 0.38b0.dev", "wrapt >= 1.0.0, < 2.0.0", ] @@ -39,7 +39,7 @@ instruments = [ ] test = [ "opentelemetry-instrumentation-pyramid[instruments]", - "opentelemetry-test-utils == 0.37b0.dev", + "opentelemetry-test-utils == 0.38b0.dev", "werkzeug == 0.16.1", ] diff --git a/instrumentation/opentelemetry-instrumentation-pyramid/src/opentelemetry/instrumentation/pyramid/version.py b/instrumentation/opentelemetry-instrumentation-pyramid/src/opentelemetry/instrumentation/pyramid/version.py index 0a47df4f5a..8778b43b17 100644 --- a/instrumentation/opentelemetry-instrumentation-pyramid/src/opentelemetry/instrumentation/pyramid/version.py +++ b/instrumentation/opentelemetry-instrumentation-pyramid/src/opentelemetry/instrumentation/pyramid/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/instrumentation/opentelemetry-instrumentation-redis/pyproject.toml b/instrumentation/opentelemetry-instrumentation-redis/pyproject.toml index 4c48a39941..2300bb8da1 100644 --- a/instrumentation/opentelemetry-instrumentation-redis/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-redis/pyproject.toml @@ -26,8 +26,8 @@ classifiers = [ ] dependencies = [ "opentelemetry-api ~= 1.12", - "opentelemetry-instrumentation == 0.37b0.dev", - "opentelemetry-semantic-conventions == 0.37b0.dev", + "opentelemetry-instrumentation == 0.38b0.dev", + "opentelemetry-semantic-conventions == 0.38b0.dev", "wrapt >= 1.12.1", ] @@ -38,7 +38,7 @@ instruments = [ test = [ "opentelemetry-instrumentation-redis[instruments]", "opentelemetry-sdk ~= 1.3", - "opentelemetry-test-utils == 0.37b0.dev", + "opentelemetry-test-utils == 0.38b0.dev", ] [project.entry-points.opentelemetry_instrumentor] diff --git a/instrumentation/opentelemetry-instrumentation-redis/src/opentelemetry/instrumentation/redis/version.py b/instrumentation/opentelemetry-instrumentation-redis/src/opentelemetry/instrumentation/redis/version.py index 0a47df4f5a..8778b43b17 100644 --- a/instrumentation/opentelemetry-instrumentation-redis/src/opentelemetry/instrumentation/redis/version.py +++ b/instrumentation/opentelemetry-instrumentation-redis/src/opentelemetry/instrumentation/redis/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/instrumentation/opentelemetry-instrumentation-remoulade/pyproject.toml b/instrumentation/opentelemetry-instrumentation-remoulade/pyproject.toml index 6fa4b2192e..f54fbc37fd 100644 --- a/instrumentation/opentelemetry-instrumentation-remoulade/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-remoulade/pyproject.toml @@ -26,8 +26,8 @@ classifiers = [ ] dependencies = [ "opentelemetry-api ~= 1.12", - "opentelemetry-instrumentation == 0.37b0.dev", - "opentelemetry-semantic-conventions == 0.37b0.dev", + "opentelemetry-instrumentation == 0.38b0.dev", + "opentelemetry-semantic-conventions == 0.38b0.dev", ] [project.optional-dependencies] @@ -36,7 +36,7 @@ instruments = [ ] test = [ "opentelemetry-instrumentation-remoulade[instruments]", - "opentelemetry-test-utils == 0.37b0.dev", + "opentelemetry-test-utils == 0.38b0.dev", "opentelemetry-sdk ~= 1.10" ] diff --git a/instrumentation/opentelemetry-instrumentation-remoulade/src/opentelemetry/instrumentation/remoulade/version.py b/instrumentation/opentelemetry-instrumentation-remoulade/src/opentelemetry/instrumentation/remoulade/version.py index 0a47df4f5a..8778b43b17 100644 --- a/instrumentation/opentelemetry-instrumentation-remoulade/src/opentelemetry/instrumentation/remoulade/version.py +++ b/instrumentation/opentelemetry-instrumentation-remoulade/src/opentelemetry/instrumentation/remoulade/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/instrumentation/opentelemetry-instrumentation-requests/pyproject.toml b/instrumentation/opentelemetry-instrumentation-requests/pyproject.toml index 3fe3f9fb1e..9daa5abca6 100644 --- a/instrumentation/opentelemetry-instrumentation-requests/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-requests/pyproject.toml @@ -26,9 +26,9 @@ classifiers = [ ] dependencies = [ "opentelemetry-api ~= 1.12", - "opentelemetry-instrumentation == 0.37b0.dev", - "opentelemetry-semantic-conventions == 0.37b0.dev", - "opentelemetry-util-http == 0.37b0.dev", + "opentelemetry-instrumentation == 0.38b0.dev", + "opentelemetry-semantic-conventions == 0.38b0.dev", + "opentelemetry-util-http == 0.38b0.dev", ] [project.optional-dependencies] @@ -38,7 +38,7 @@ instruments = [ test = [ "opentelemetry-instrumentation-requests[instruments]", "httpretty ~= 1.0", - "opentelemetry-test-utils == 0.37b0.dev", + "opentelemetry-test-utils == 0.38b0.dev", ] [project.entry-points.opentelemetry_instrumentor] diff --git a/instrumentation/opentelemetry-instrumentation-requests/src/opentelemetry/instrumentation/requests/version.py b/instrumentation/opentelemetry-instrumentation-requests/src/opentelemetry/instrumentation/requests/version.py index 0a47df4f5a..8778b43b17 100644 --- a/instrumentation/opentelemetry-instrumentation-requests/src/opentelemetry/instrumentation/requests/version.py +++ b/instrumentation/opentelemetry-instrumentation-requests/src/opentelemetry/instrumentation/requests/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/instrumentation/opentelemetry-instrumentation-sklearn/pyproject.toml b/instrumentation/opentelemetry-instrumentation-sklearn/pyproject.toml index 4b80924c37..edd4fcaf2b 100644 --- a/instrumentation/opentelemetry-instrumentation-sklearn/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-sklearn/pyproject.toml @@ -26,7 +26,7 @@ classifiers = [ ] dependencies = [ "opentelemetry-api ~= 1.12", - "opentelemetry-instrumentation == 0.37b0.dev", + "opentelemetry-instrumentation == 0.38b0.dev", ] [project.optional-dependencies] @@ -35,7 +35,7 @@ instruments = [ ] test = [ "opentelemetry-instrumentation-sklearn[instruments]", - "opentelemetry-test-utils == 0.37b0.dev", + "opentelemetry-test-utils == 0.38b0.dev", ] [project.entry-points.opentelemetry_instrumentor] diff --git a/instrumentation/opentelemetry-instrumentation-sklearn/src/opentelemetry/instrumentation/sklearn/version.py b/instrumentation/opentelemetry-instrumentation-sklearn/src/opentelemetry/instrumentation/sklearn/version.py index 12c944d283..782d00d60c 100644 --- a/instrumentation/opentelemetry-instrumentation-sklearn/src/opentelemetry/instrumentation/sklearn/version.py +++ b/instrumentation/opentelemetry-instrumentation-sklearn/src/opentelemetry/instrumentation/sklearn/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/instrumentation/opentelemetry-instrumentation-sqlalchemy/pyproject.toml b/instrumentation/opentelemetry-instrumentation-sqlalchemy/pyproject.toml index c9c322184a..62aed5aa1e 100644 --- a/instrumentation/opentelemetry-instrumentation-sqlalchemy/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-sqlalchemy/pyproject.toml @@ -26,8 +26,8 @@ classifiers = [ ] dependencies = [ "opentelemetry-api ~= 1.12", - "opentelemetry-instrumentation == 0.37b0.dev", - "opentelemetry-semantic-conventions == 0.37b0.dev", + "opentelemetry-instrumentation == 0.38b0.dev", + "opentelemetry-semantic-conventions == 0.38b0.dev", "packaging >= 21.0", "wrapt >= 1.11.2", ] diff --git a/instrumentation/opentelemetry-instrumentation-sqlalchemy/src/opentelemetry/instrumentation/sqlalchemy/engine.py b/instrumentation/opentelemetry-instrumentation-sqlalchemy/src/opentelemetry/instrumentation/sqlalchemy/engine.py index f95751d9c6..2afbd7a82f 100644 --- a/instrumentation/opentelemetry-instrumentation-sqlalchemy/src/opentelemetry/instrumentation/sqlalchemy/engine.py +++ b/instrumentation/opentelemetry-instrumentation-sqlalchemy/src/opentelemetry/instrumentation/sqlalchemy/engine.py @@ -91,7 +91,13 @@ def _wrap_connect(tracer_provider=None): def _wrap_connect_internal(func, module, args, kwargs): with tracer.start_as_current_span( "connect", kind=trace.SpanKind.CLIENT - ): + ) as span: + if span.is_recording(): + attrs, _ = _get_attributes_from_url(module.url) + span.set_attributes(attrs) + span.set_attribute( + SpanAttributes.DB_SYSTEM, _normalize_vendor(module.name) + ) return func(*args, **kwargs) return _wrap_connect_internal diff --git a/instrumentation/opentelemetry-instrumentation-sqlalchemy/src/opentelemetry/instrumentation/sqlalchemy/version.py b/instrumentation/opentelemetry-instrumentation-sqlalchemy/src/opentelemetry/instrumentation/sqlalchemy/version.py index 0a47df4f5a..8778b43b17 100644 --- a/instrumentation/opentelemetry-instrumentation-sqlalchemy/src/opentelemetry/instrumentation/sqlalchemy/version.py +++ b/instrumentation/opentelemetry-instrumentation-sqlalchemy/src/opentelemetry/instrumentation/sqlalchemy/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/instrumentation/opentelemetry-instrumentation-sqlalchemy/tests/test_sqlalchemy.py b/instrumentation/opentelemetry-instrumentation-sqlalchemy/tests/test_sqlalchemy.py index e00148320c..981da107db 100644 --- a/instrumentation/opentelemetry-instrumentation-sqlalchemy/tests/test_sqlalchemy.py +++ b/instrumentation/opentelemetry-instrumentation-sqlalchemy/tests/test_sqlalchemy.py @@ -22,6 +22,7 @@ from opentelemetry.instrumentation.sqlalchemy import SQLAlchemyInstrumentor from opentelemetry.sdk.resources import Resource from opentelemetry.sdk.trace import TracerProvider, export +from opentelemetry.semconv.trace import SpanAttributes from opentelemetry.test.test_base import TestBase @@ -128,11 +129,12 @@ async def run(): def test_not_recording(self): mock_tracer = mock.Mock() mock_span = mock.Mock() + mock_context = mock.Mock() mock_span.is_recording.return_value = False - mock_span.__enter__ = mock.Mock(return_value=(mock.Mock(), None)) - mock_span.__exit__ = mock.Mock(return_value=None) - mock_tracer.start_span.return_value = mock_span - mock_tracer.start_as_current_span.return_value = mock_span + mock_context.__enter__ = mock.Mock(return_value=mock_span) + mock_context.__exit__ = mock.Mock(return_value=None) + mock_tracer.start_span.return_value = mock_context + mock_tracer.start_as_current_span.return_value = mock_context with mock.patch("opentelemetry.trace.get_tracer") as tracer: tracer.return_value = mock_tracer engine = create_engine("sqlite:///:memory:") @@ -159,6 +161,12 @@ def test_create_engine_wrapper(self): self.assertEqual(len(spans), 2) # first span - the connection to the db self.assertEqual(spans[0].name, "connect") + self.assertEqual( + spans[0].attributes[SpanAttributes.DB_NAME], ":memory:" + ) + self.assertEqual( + spans[0].attributes[SpanAttributes.DB_SYSTEM], "sqlite" + ) self.assertEqual(spans[0].kind, trace.SpanKind.CLIENT) # second span - the query self.assertEqual(spans[1].name, "SELECT :memory:") @@ -217,6 +225,12 @@ async def run(): self.assertEqual(len(spans), 2) # first span - the connection to the db self.assertEqual(spans[0].name, "connect") + self.assertEqual( + spans[0].attributes[SpanAttributes.DB_NAME], ":memory:" + ) + self.assertEqual( + spans[0].attributes[SpanAttributes.DB_SYSTEM], "sqlite" + ) self.assertEqual(spans[0].kind, trace.SpanKind.CLIENT) # second span - the query self.assertEqual(spans[1].name, "SELECT :memory:") diff --git a/instrumentation/opentelemetry-instrumentation-sqlite3/pyproject.toml b/instrumentation/opentelemetry-instrumentation-sqlite3/pyproject.toml index a1e0d6e686..5a22d02603 100644 --- a/instrumentation/opentelemetry-instrumentation-sqlite3/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-sqlite3/pyproject.toml @@ -26,14 +26,14 @@ classifiers = [ ] dependencies = [ "opentelemetry-api ~= 1.12", - "opentelemetry-instrumentation == 0.37b0.dev", - "opentelemetry-instrumentation-dbapi == 0.37b0.dev", + "opentelemetry-instrumentation == 0.38b0.dev", + "opentelemetry-instrumentation-dbapi == 0.38b0.dev", ] [project.optional-dependencies] instruments = [] test = [ - "opentelemetry-test-utils == 0.37b0.dev", + "opentelemetry-test-utils == 0.38b0.dev", ] [project.entry-points.opentelemetry_instrumentor] diff --git a/instrumentation/opentelemetry-instrumentation-sqlite3/src/opentelemetry/instrumentation/sqlite3/version.py b/instrumentation/opentelemetry-instrumentation-sqlite3/src/opentelemetry/instrumentation/sqlite3/version.py index eddd0b7d81..03a6e47521 100644 --- a/instrumentation/opentelemetry-instrumentation-sqlite3/src/opentelemetry/instrumentation/sqlite3/version.py +++ b/instrumentation/opentelemetry-instrumentation-sqlite3/src/opentelemetry/instrumentation/sqlite3/version.py @@ -12,6 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" _instruments = tuple() diff --git a/instrumentation/opentelemetry-instrumentation-sqlite3/tests/testdb b/instrumentation/opentelemetry-instrumentation-sqlite3/tests/testdb new file mode 100644 index 0000000000..e7584e9d7a Binary files /dev/null and b/instrumentation/opentelemetry-instrumentation-sqlite3/tests/testdb differ diff --git a/instrumentation/opentelemetry-instrumentation-starlette/pyproject.toml b/instrumentation/opentelemetry-instrumentation-starlette/pyproject.toml index 87d7763628..9283194d40 100644 --- a/instrumentation/opentelemetry-instrumentation-starlette/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-starlette/pyproject.toml @@ -26,10 +26,10 @@ classifiers = [ ] dependencies = [ "opentelemetry-api ~= 1.12", - "opentelemetry-instrumentation == 0.37b0.dev", - "opentelemetry-instrumentation-asgi == 0.37b0.dev", - "opentelemetry-semantic-conventions == 0.37b0.dev", - "opentelemetry-util-http == 0.37b0.dev", + "opentelemetry-instrumentation == 0.38b0.dev", + "opentelemetry-instrumentation-asgi == 0.38b0.dev", + "opentelemetry-semantic-conventions == 0.38b0.dev", + "opentelemetry-util-http == 0.38b0.dev", ] [project.optional-dependencies] @@ -38,7 +38,7 @@ instruments = [ ] test = [ "opentelemetry-instrumentation-starlette[instruments]", - "opentelemetry-test-utils == 0.37b0.dev", + "opentelemetry-test-utils == 0.38b0.dev", "requests ~= 2.23", # needed for testclient "httpx ~= 0.22", # needed for testclient ] diff --git a/instrumentation/opentelemetry-instrumentation-starlette/src/opentelemetry/instrumentation/starlette/version.py b/instrumentation/opentelemetry-instrumentation-starlette/src/opentelemetry/instrumentation/starlette/version.py index 0a47df4f5a..8778b43b17 100644 --- a/instrumentation/opentelemetry-instrumentation-starlette/src/opentelemetry/instrumentation/starlette/version.py +++ b/instrumentation/opentelemetry-instrumentation-starlette/src/opentelemetry/instrumentation/starlette/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/instrumentation/opentelemetry-instrumentation-system-metrics/pyproject.toml b/instrumentation/opentelemetry-instrumentation-system-metrics/pyproject.toml index 95931f4d29..4b618e7508 100644 --- a/instrumentation/opentelemetry-instrumentation-system-metrics/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-system-metrics/pyproject.toml @@ -36,7 +36,7 @@ instruments = [ ] test = [ "opentelemetry-instrumentation-system-metrics[instruments]", - "opentelemetry-test-utils == 0.37b0.dev", + "opentelemetry-test-utils == 0.38b0.dev", ] [project.entry-points.opentelemetry_instrumentor] diff --git a/instrumentation/opentelemetry-instrumentation-system-metrics/src/opentelemetry/instrumentation/system_metrics/version.py b/instrumentation/opentelemetry-instrumentation-system-metrics/src/opentelemetry/instrumentation/system_metrics/version.py index 0a47df4f5a..8778b43b17 100644 --- a/instrumentation/opentelemetry-instrumentation-system-metrics/src/opentelemetry/instrumentation/system_metrics/version.py +++ b/instrumentation/opentelemetry-instrumentation-system-metrics/src/opentelemetry/instrumentation/system_metrics/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/instrumentation/opentelemetry-instrumentation-tornado/pyproject.toml b/instrumentation/opentelemetry-instrumentation-tornado/pyproject.toml index 83ca451075..6a1ece943f 100644 --- a/instrumentation/opentelemetry-instrumentation-tornado/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-tornado/pyproject.toml @@ -25,9 +25,9 @@ classifiers = [ ] dependencies = [ "opentelemetry-api ~= 1.12", - "opentelemetry-instrumentation == 0.37b0.dev", - "opentelemetry-semantic-conventions == 0.37b0.dev", - "opentelemetry-util-http == 0.37b0.dev", + "opentelemetry-instrumentation == 0.38b0.dev", + "opentelemetry-semantic-conventions == 0.38b0.dev", + "opentelemetry-util-http == 0.38b0.dev", ] [project.optional-dependencies] @@ -36,7 +36,7 @@ instruments = [ ] test = [ "opentelemetry-instrumentation-tornado[instruments]", - "opentelemetry-test-utils == 0.37b0.dev", + "opentelemetry-test-utils == 0.38b0.dev", ] [project.entry-points.opentelemetry_instrumentor] diff --git a/instrumentation/opentelemetry-instrumentation-tornado/src/opentelemetry/instrumentation/tornado/version.py b/instrumentation/opentelemetry-instrumentation-tornado/src/opentelemetry/instrumentation/tornado/version.py index 0a47df4f5a..8778b43b17 100644 --- a/instrumentation/opentelemetry-instrumentation-tornado/src/opentelemetry/instrumentation/tornado/version.py +++ b/instrumentation/opentelemetry-instrumentation-tornado/src/opentelemetry/instrumentation/tornado/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/instrumentation/opentelemetry-instrumentation-tornado/tests/test_instrumentation.py b/instrumentation/opentelemetry-instrumentation-tornado/tests/test_instrumentation.py index 8addb4eb13..9fb3608572 100644 --- a/instrumentation/opentelemetry-instrumentation-tornado/tests/test_instrumentation.py +++ b/instrumentation/opentelemetry-instrumentation-tornado/tests/test_instrumentation.py @@ -494,28 +494,32 @@ def test_response_headers(self): self.memory_exporter.clear() set_global_response_propagator(orig) - def test_credential_removal(self): - response = self.fetch( - "http://username:password@httpbin.org/status/200" - ) - self.assertEqual(response.code, 200) - - spans = self.sorted_spans(self.memory_exporter.get_finished_spans()) - self.assertEqual(len(spans), 1) - client = spans[0] - - self.assertEqual(client.name, "GET") - self.assertEqual(client.kind, SpanKind.CLIENT) - self.assertSpanHasAttributes( - client, - { - SpanAttributes.HTTP_URL: "http://httpbin.org/status/200", - SpanAttributes.HTTP_METHOD: "GET", - SpanAttributes.HTTP_STATUS_CODE: 200, - }, - ) - - self.memory_exporter.clear() + # todo(srikanthccv): fix this test + # this test is making request to real httpbin.org/status/200 which + # is not a good idea as it can fail due to availability of the + # service. + # def test_credential_removal(self): + # response = self.fetch( + # "http://username:password@httpbin.org/status/200" + # ) + # self.assertEqual(response.code, 200) + + # spans = self.sorted_spans(self.memory_exporter.get_finished_spans()) + # self.assertEqual(len(spans), 1) + # client = spans[0] + + # self.assertEqual(client.name, "GET") + # self.assertEqual(client.kind, SpanKind.CLIENT) + # self.assertSpanHasAttributes( + # client, + # { + # SpanAttributes.HTTP_URL: "http://httpbin.org/status/200", + # SpanAttributes.HTTP_METHOD: "GET", + # SpanAttributes.HTTP_STATUS_CODE: 200, + # }, + # ) + + # self.memory_exporter.clear() class TestTornadoInstrumentationWithXHeaders(TornadoTest): diff --git a/instrumentation/opentelemetry-instrumentation-tortoiseorm/pyproject.toml b/instrumentation/opentelemetry-instrumentation-tortoiseorm/pyproject.toml index 8f9a2563a6..8aa17edfc8 100644 --- a/instrumentation/opentelemetry-instrumentation-tortoiseorm/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-tortoiseorm/pyproject.toml @@ -26,8 +26,8 @@ classifiers = [ ] dependencies = [ "opentelemetry-api ~= 1.12", - "opentelemetry-instrumentation == 0.37b0.dev", - "opentelemetry-semantic-conventions == 0.37b0.dev", + "opentelemetry-instrumentation == 0.38b0.dev", + "opentelemetry-semantic-conventions == 0.38b0.dev", ] [project.optional-dependencies] @@ -37,7 +37,7 @@ instruments = [ ] test = [ "opentelemetry-instrumentation-tortoiseorm[instruments]", - "opentelemetry-test-utils == 0.37b0.dev", + "opentelemetry-test-utils == 0.38b0.dev", ] [project.entry-points.opentelemetry_instrumentor] diff --git a/instrumentation/opentelemetry-instrumentation-tortoiseorm/src/opentelemetry/instrumentation/tortoiseorm/version.py b/instrumentation/opentelemetry-instrumentation-tortoiseorm/src/opentelemetry/instrumentation/tortoiseorm/version.py index 0a47df4f5a..8778b43b17 100644 --- a/instrumentation/opentelemetry-instrumentation-tortoiseorm/src/opentelemetry/instrumentation/tortoiseorm/version.py +++ b/instrumentation/opentelemetry-instrumentation-tortoiseorm/src/opentelemetry/instrumentation/tortoiseorm/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/instrumentation/opentelemetry-instrumentation-urllib/pyproject.toml b/instrumentation/opentelemetry-instrumentation-urllib/pyproject.toml index 9bca44a9f3..ef7564f6f2 100644 --- a/instrumentation/opentelemetry-instrumentation-urllib/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-urllib/pyproject.toml @@ -26,16 +26,16 @@ classifiers = [ ] dependencies = [ "opentelemetry-api ~= 1.12", - "opentelemetry-instrumentation == 0.37b0.dev", - "opentelemetry-semantic-conventions == 0.37b0.dev", - "opentelemetry-util-http == 0.37b0.dev", + "opentelemetry-instrumentation == 0.38b0.dev", + "opentelemetry-semantic-conventions == 0.38b0.dev", + "opentelemetry-util-http == 0.38b0.dev", ] [project.optional-dependencies] instruments = [] test = [ "httpretty ~= 1.0", - "opentelemetry-test-utils == 0.37b0.dev", + "opentelemetry-test-utils == 0.38b0.dev", ] [project.entry-points.opentelemetry_instrumentor] diff --git a/instrumentation/opentelemetry-instrumentation-urllib/src/opentelemetry/instrumentation/urllib/version.py b/instrumentation/opentelemetry-instrumentation-urllib/src/opentelemetry/instrumentation/urllib/version.py index eddd0b7d81..03a6e47521 100644 --- a/instrumentation/opentelemetry-instrumentation-urllib/src/opentelemetry/instrumentation/urllib/version.py +++ b/instrumentation/opentelemetry-instrumentation-urllib/src/opentelemetry/instrumentation/urllib/version.py @@ -12,6 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" _instruments = tuple() diff --git a/instrumentation/opentelemetry-instrumentation-urllib3/pyproject.toml b/instrumentation/opentelemetry-instrumentation-urllib3/pyproject.toml index d50e82d086..1a0a5064c2 100644 --- a/instrumentation/opentelemetry-instrumentation-urllib3/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-urllib3/pyproject.toml @@ -26,9 +26,9 @@ classifiers = [ ] dependencies = [ "opentelemetry-api ~= 1.12", - "opentelemetry-instrumentation == 0.37b0.dev", - "opentelemetry-semantic-conventions == 0.37b0.dev", - "opentelemetry-util-http == 0.37b0.dev", + "opentelemetry-instrumentation == 0.38b0.dev", + "opentelemetry-semantic-conventions == 0.38b0.dev", + "opentelemetry-util-http == 0.38b0.dev", "wrapt >= 1.0.0, < 2.0.0", ] @@ -39,7 +39,7 @@ instruments = [ test = [ "opentelemetry-instrumentation-urllib3[instruments]", "httpretty ~= 1.0", - "opentelemetry-test-utils == 0.37b0.dev", + "opentelemetry-test-utils == 0.38b0.dev", ] [project.entry-points.opentelemetry_instrumentor] diff --git a/instrumentation/opentelemetry-instrumentation-urllib3/src/opentelemetry/instrumentation/urllib3/version.py b/instrumentation/opentelemetry-instrumentation-urllib3/src/opentelemetry/instrumentation/urllib3/version.py index 0a47df4f5a..8778b43b17 100644 --- a/instrumentation/opentelemetry-instrumentation-urllib3/src/opentelemetry/instrumentation/urllib3/version.py +++ b/instrumentation/opentelemetry-instrumentation-urllib3/src/opentelemetry/instrumentation/urllib3/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/instrumentation/opentelemetry-instrumentation-wsgi/pyproject.toml b/instrumentation/opentelemetry-instrumentation-wsgi/pyproject.toml index 76a72ea845..dd8e0308cb 100644 --- a/instrumentation/opentelemetry-instrumentation-wsgi/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-wsgi/pyproject.toml @@ -26,15 +26,15 @@ classifiers = [ ] dependencies = [ "opentelemetry-api ~= 1.12", - "opentelemetry-instrumentation == 0.37b0.dev", - "opentelemetry-semantic-conventions == 0.37b0.dev", - "opentelemetry-util-http == 0.37b0.dev", + "opentelemetry-instrumentation == 0.38b0.dev", + "opentelemetry-semantic-conventions == 0.38b0.dev", + "opentelemetry-util-http == 0.38b0.dev", ] [project.optional-dependencies] instruments = [] test = [ - "opentelemetry-test-utils == 0.37b0.dev", + "opentelemetry-test-utils == 0.38b0.dev", ] [project.urls] diff --git a/instrumentation/opentelemetry-instrumentation-wsgi/src/opentelemetry/instrumentation/wsgi/version.py b/instrumentation/opentelemetry-instrumentation-wsgi/src/opentelemetry/instrumentation/wsgi/version.py index 0a47df4f5a..8778b43b17 100644 --- a/instrumentation/opentelemetry-instrumentation-wsgi/src/opentelemetry/instrumentation/wsgi/version.py +++ b/instrumentation/opentelemetry-instrumentation-wsgi/src/opentelemetry/instrumentation/wsgi/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/instrumentation/opentelemetry-instrumentation-wsgi/tests/test_wsgi_middleware.py b/instrumentation/opentelemetry-instrumentation-wsgi/tests/test_wsgi_middleware.py index 6073b9daa7..ffe2982052 100644 --- a/instrumentation/opentelemetry-instrumentation-wsgi/tests/test_wsgi_middleware.py +++ b/instrumentation/opentelemetry-instrumentation-wsgi/tests/test_wsgi_middleware.py @@ -484,6 +484,21 @@ def test_basic_wsgi_call(self): response = app(self.environ, self.start_response) self.validate_response(response, exporter) + def test_no_op_tracer_provider(self): + app = otel_wsgi.OpenTelemetryMiddleware( + simple_wsgi, tracer_provider=trace_api.NoOpTracerProvider() + ) + + response = app(self.environ, self.start_response) + while True: + try: + value = next(response) + self.assertEqual(value, b"*") + except StopIteration: + break + span_list = self.memory_exporter.get_finished_spans() + self.assertEqual(len(span_list), 0) + class TestWsgiMiddlewareWrappedWithAnotherFramework(WsgiTestBase): def test_mark_span_internal_in_presence_of_span_from_other_framework(self): diff --git a/opentelemetry-contrib-instrumentations/pyproject.toml b/opentelemetry-contrib-instrumentations/pyproject.toml index ceff5a175a..a6f9132eaa 100644 --- a/opentelemetry-contrib-instrumentations/pyproject.toml +++ b/opentelemetry-contrib-instrumentations/pyproject.toml @@ -29,48 +29,48 @@ classifiers = [ "Programming Language :: Python :: 3.11", ] dependencies = [ - "opentelemetry-instrumentation-aio-pika==0.37b0.dev", - "opentelemetry-instrumentation-aiohttp-client==0.37b0.dev", - "opentelemetry-instrumentation-aiopg==0.37b0.dev", - "opentelemetry-instrumentation-asgi==0.37b0.dev", - "opentelemetry-instrumentation-asyncpg==0.37b0.dev", - "opentelemetry-instrumentation-aws-lambda==0.37b0.dev", - "opentelemetry-instrumentation-boto==0.37b0.dev", - "opentelemetry-instrumentation-boto3sqs==0.37b0.dev", - "opentelemetry-instrumentation-botocore==0.37b0.dev", - "opentelemetry-instrumentation-celery==0.37b0.dev", - "opentelemetry-instrumentation-confluent-kafka==0.37b0.dev", - "opentelemetry-instrumentation-dbapi==0.37b0.dev", - "opentelemetry-instrumentation-django==0.37b0.dev", - "opentelemetry-instrumentation-elasticsearch==0.37b0.dev", - "opentelemetry-instrumentation-falcon==0.37b0.dev", - "opentelemetry-instrumentation-fastapi==0.37b0.dev", - "opentelemetry-instrumentation-flask==0.37b0.dev", - "opentelemetry-instrumentation-grpc==0.37b0.dev", - "opentelemetry-instrumentation-httpx==0.37b0.dev", - "opentelemetry-instrumentation-jinja2==0.37b0.dev", - "opentelemetry-instrumentation-kafka-python==0.37b0.dev", - "opentelemetry-instrumentation-logging==0.37b0.dev", - "opentelemetry-instrumentation-mysql==0.37b0.dev", - "opentelemetry-instrumentation-pika==0.37b0.dev", - "opentelemetry-instrumentation-psycopg2==0.37b0.dev", - "opentelemetry-instrumentation-pymemcache==0.37b0.dev", - "opentelemetry-instrumentation-pymongo==0.37b0.dev", - "opentelemetry-instrumentation-pymysql==0.37b0.dev", - "opentelemetry-instrumentation-pyramid==0.37b0.dev", - "opentelemetry-instrumentation-redis==0.37b0.dev", - "opentelemetry-instrumentation-remoulade==0.37b0.dev", - "opentelemetry-instrumentation-requests==0.37b0.dev", - "opentelemetry-instrumentation-sklearn==0.37b0.dev", - "opentelemetry-instrumentation-sqlalchemy==0.37b0.dev", - "opentelemetry-instrumentation-sqlite3==0.37b0.dev", - "opentelemetry-instrumentation-starlette==0.37b0.dev", - "opentelemetry-instrumentation-system-metrics==0.37b0.dev", - "opentelemetry-instrumentation-tornado==0.37b0.dev", - "opentelemetry-instrumentation-tortoiseorm==0.37b0.dev", - "opentelemetry-instrumentation-urllib==0.37b0.dev", - "opentelemetry-instrumentation-urllib3==0.37b0.dev", - "opentelemetry-instrumentation-wsgi==0.37b0.dev", + "opentelemetry-instrumentation-aio-pika==0.38b0.dev", + "opentelemetry-instrumentation-aiohttp-client==0.38b0.dev", + "opentelemetry-instrumentation-aiopg==0.38b0.dev", + "opentelemetry-instrumentation-asgi==0.38b0.dev", + "opentelemetry-instrumentation-asyncpg==0.38b0.dev", + "opentelemetry-instrumentation-aws-lambda==0.38b0.dev", + "opentelemetry-instrumentation-boto==0.38b0.dev", + "opentelemetry-instrumentation-boto3sqs==0.38b0.dev", + "opentelemetry-instrumentation-botocore==0.38b0.dev", + "opentelemetry-instrumentation-celery==0.38b0.dev", + "opentelemetry-instrumentation-confluent-kafka==0.38b0.dev", + "opentelemetry-instrumentation-dbapi==0.38b0.dev", + "opentelemetry-instrumentation-django==0.38b0.dev", + "opentelemetry-instrumentation-elasticsearch==0.38b0.dev", + "opentelemetry-instrumentation-falcon==0.38b0.dev", + "opentelemetry-instrumentation-fastapi==0.38b0.dev", + "opentelemetry-instrumentation-flask==0.38b0.dev", + "opentelemetry-instrumentation-grpc==0.38b0.dev", + "opentelemetry-instrumentation-httpx==0.38b0.dev", + "opentelemetry-instrumentation-jinja2==0.38b0.dev", + "opentelemetry-instrumentation-kafka-python==0.38b0.dev", + "opentelemetry-instrumentation-logging==0.38b0.dev", + "opentelemetry-instrumentation-mysql==0.38b0.dev", + "opentelemetry-instrumentation-pika==0.38b0.dev", + "opentelemetry-instrumentation-psycopg2==0.38b0.dev", + "opentelemetry-instrumentation-pymemcache==0.38b0.dev", + "opentelemetry-instrumentation-pymongo==0.38b0.dev", + "opentelemetry-instrumentation-pymysql==0.38b0.dev", + "opentelemetry-instrumentation-pyramid==0.38b0.dev", + "opentelemetry-instrumentation-redis==0.38b0.dev", + "opentelemetry-instrumentation-remoulade==0.38b0.dev", + "opentelemetry-instrumentation-requests==0.38b0.dev", + "opentelemetry-instrumentation-sklearn==0.38b0.dev", + "opentelemetry-instrumentation-sqlalchemy==0.38b0.dev", + "opentelemetry-instrumentation-sqlite3==0.38b0.dev", + "opentelemetry-instrumentation-starlette==0.38b0.dev", + "opentelemetry-instrumentation-system-metrics==0.38b0.dev", + "opentelemetry-instrumentation-tornado==0.38b0.dev", + "opentelemetry-instrumentation-tortoiseorm==0.38b0.dev", + "opentelemetry-instrumentation-urllib==0.38b0.dev", + "opentelemetry-instrumentation-urllib3==0.38b0.dev", + "opentelemetry-instrumentation-wsgi==0.38b0.dev", ] [project.optional-dependencies] diff --git a/opentelemetry-contrib-instrumentations/src/opentelemetry/contrib-instrumentations/version.py b/opentelemetry-contrib-instrumentations/src/opentelemetry/contrib-instrumentations/version.py index 0a47df4f5a..8778b43b17 100644 --- a/opentelemetry-contrib-instrumentations/src/opentelemetry/contrib-instrumentations/version.py +++ b/opentelemetry-contrib-instrumentations/src/opentelemetry/contrib-instrumentations/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/opentelemetry-distro/pyproject.toml b/opentelemetry-distro/pyproject.toml index 4f9c1322b1..ab5816acb1 100644 --- a/opentelemetry-distro/pyproject.toml +++ b/opentelemetry-distro/pyproject.toml @@ -24,13 +24,13 @@ classifiers = [ ] dependencies = [ "opentelemetry-api ~= 1.12", - "opentelemetry-instrumentation == 0.37b0.dev", + "opentelemetry-instrumentation == 0.38b0.dev", "opentelemetry-sdk ~= 1.13", ] [project.optional-dependencies] otlp = [ - "opentelemetry-exporter-otlp == 1.16.0.dev", + "opentelemetry-exporter-otlp == 1.17.0.dev", ] test = [] diff --git a/opentelemetry-distro/src/opentelemetry/distro/version.py b/opentelemetry-distro/src/opentelemetry/distro/version.py index 0a47df4f5a..8778b43b17 100644 --- a/opentelemetry-distro/src/opentelemetry/distro/version.py +++ b/opentelemetry-distro/src/opentelemetry/distro/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap_gen.py b/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap_gen.py index b06bdba635..cbebc5f203 100644 --- a/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap_gen.py +++ b/opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap_gen.py @@ -17,159 +17,159 @@ libraries = { "aio_pika": { - "library": "aio_pika >= 7.2.0, < 9.0.0", - "instrumentation": "opentelemetry-instrumentation-aio-pika==0.37b0.dev", + "library": "aio_pika >= 7.2.0, < 10.0.0", + "instrumentation": "opentelemetry-instrumentation-aio-pika==0.38b0.dev", }, "aiohttp": { "library": "aiohttp ~= 3.0", - "instrumentation": "opentelemetry-instrumentation-aiohttp-client==0.37b0.dev", + "instrumentation": "opentelemetry-instrumentation-aiohttp-client==0.38b0.dev", }, "aiopg": { "library": "aiopg >= 0.13.0, < 2.0.0", - "instrumentation": "opentelemetry-instrumentation-aiopg==0.37b0.dev", + "instrumentation": "opentelemetry-instrumentation-aiopg==0.38b0.dev", }, "asgiref": { "library": "asgiref ~= 3.0", - "instrumentation": "opentelemetry-instrumentation-asgi==0.37b0.dev", + "instrumentation": "opentelemetry-instrumentation-asgi==0.38b0.dev", }, "asyncpg": { "library": "asyncpg >= 0.12.0", - "instrumentation": "opentelemetry-instrumentation-asyncpg==0.37b0.dev", + "instrumentation": "opentelemetry-instrumentation-asyncpg==0.38b0.dev", }, "boto": { "library": "boto~=2.0", - "instrumentation": "opentelemetry-instrumentation-boto==0.37b0.dev", + "instrumentation": "opentelemetry-instrumentation-boto==0.38b0.dev", }, "boto3": { "library": "boto3 ~= 1.0", - "instrumentation": "opentelemetry-instrumentation-boto3sqs==0.37b0.dev", + "instrumentation": "opentelemetry-instrumentation-boto3sqs==0.38b0.dev", }, "botocore": { "library": "botocore ~= 1.0", - "instrumentation": "opentelemetry-instrumentation-botocore==0.37b0.dev", + "instrumentation": "opentelemetry-instrumentation-botocore==0.38b0.dev", }, "celery": { "library": "celery >= 4.0, < 6.0", - "instrumentation": "opentelemetry-instrumentation-celery==0.37b0.dev", + "instrumentation": "opentelemetry-instrumentation-celery==0.38b0.dev", }, "confluent-kafka": { "library": "confluent-kafka >= 1.8.2, < 2.0.0", - "instrumentation": "opentelemetry-instrumentation-confluent-kafka==0.37b0.dev", + "instrumentation": "opentelemetry-instrumentation-confluent-kafka==0.38b0.dev", }, "django": { "library": "django >= 1.10", - "instrumentation": "opentelemetry-instrumentation-django==0.37b0.dev", + "instrumentation": "opentelemetry-instrumentation-django==0.38b0.dev", }, "elasticsearch": { "library": "elasticsearch >= 2.0", - "instrumentation": "opentelemetry-instrumentation-elasticsearch==0.37b0.dev", + "instrumentation": "opentelemetry-instrumentation-elasticsearch==0.38b0.dev", }, "falcon": { "library": "falcon >= 1.4.1, < 4.0.0", - "instrumentation": "opentelemetry-instrumentation-falcon==0.37b0.dev", + "instrumentation": "opentelemetry-instrumentation-falcon==0.38b0.dev", }, "fastapi": { "library": "fastapi <= 0.90.1", - "instrumentation": "opentelemetry-instrumentation-fastapi==0.37b0.dev", + "instrumentation": "opentelemetry-instrumentation-fastapi==0.38b0.dev", }, "flask": { "library": "flask >= 1.0, < 3.0", - "instrumentation": "opentelemetry-instrumentation-flask==0.37b0.dev", + "instrumentation": "opentelemetry-instrumentation-flask==0.38b0.dev", }, "grpcio": { "library": "grpcio ~= 1.27", - "instrumentation": "opentelemetry-instrumentation-grpc==0.37b0.dev", + "instrumentation": "opentelemetry-instrumentation-grpc==0.38b0.dev", }, "httpx": { "library": "httpx >= 0.18.0, <= 0.23.0", - "instrumentation": "opentelemetry-instrumentation-httpx==0.37b0.dev", + "instrumentation": "opentelemetry-instrumentation-httpx==0.38b0.dev", }, "jinja2": { "library": "jinja2 >= 2.7, < 4.0", - "instrumentation": "opentelemetry-instrumentation-jinja2==0.37b0.dev", + "instrumentation": "opentelemetry-instrumentation-jinja2==0.38b0.dev", }, "kafka-python": { "library": "kafka-python >= 2.0", - "instrumentation": "opentelemetry-instrumentation-kafka-python==0.37b0.dev", + "instrumentation": "opentelemetry-instrumentation-kafka-python==0.38b0.dev", }, "mysql-connector-python": { "library": "mysql-connector-python ~= 8.0", - "instrumentation": "opentelemetry-instrumentation-mysql==0.37b0.dev", + "instrumentation": "opentelemetry-instrumentation-mysql==0.38b0.dev", }, "pika": { "library": "pika >= 0.12.0", - "instrumentation": "opentelemetry-instrumentation-pika==0.37b0.dev", + "instrumentation": "opentelemetry-instrumentation-pika==0.38b0.dev", }, "psycopg2": { "library": "psycopg2 >= 2.7.3.1", - "instrumentation": "opentelemetry-instrumentation-psycopg2==0.37b0.dev", + "instrumentation": "opentelemetry-instrumentation-psycopg2==0.38b0.dev", }, "pymemcache": { "library": "pymemcache >= 1.3.5, < 4", - "instrumentation": "opentelemetry-instrumentation-pymemcache==0.37b0.dev", + "instrumentation": "opentelemetry-instrumentation-pymemcache==0.38b0.dev", }, "pymongo": { "library": "pymongo >= 3.1, < 5.0", - "instrumentation": "opentelemetry-instrumentation-pymongo==0.37b0.dev", + "instrumentation": "opentelemetry-instrumentation-pymongo==0.38b0.dev", }, "PyMySQL": { "library": "PyMySQL < 2", - "instrumentation": "opentelemetry-instrumentation-pymysql==0.37b0.dev", + "instrumentation": "opentelemetry-instrumentation-pymysql==0.38b0.dev", }, "pyramid": { "library": "pyramid >= 1.7", - "instrumentation": "opentelemetry-instrumentation-pyramid==0.37b0.dev", + "instrumentation": "opentelemetry-instrumentation-pyramid==0.38b0.dev", }, "redis": { "library": "redis >= 2.6", - "instrumentation": "opentelemetry-instrumentation-redis==0.37b0.dev", + "instrumentation": "opentelemetry-instrumentation-redis==0.38b0.dev", }, "remoulade": { "library": "remoulade >= 0.50", - "instrumentation": "opentelemetry-instrumentation-remoulade==0.37b0.dev", + "instrumentation": "opentelemetry-instrumentation-remoulade==0.38b0.dev", }, "requests": { "library": "requests ~= 2.0", - "instrumentation": "opentelemetry-instrumentation-requests==0.37b0.dev", + "instrumentation": "opentelemetry-instrumentation-requests==0.38b0.dev", }, "scikit-learn": { "library": "scikit-learn ~= 0.24.0", - "instrumentation": "opentelemetry-instrumentation-sklearn==0.37b0.dev", + "instrumentation": "opentelemetry-instrumentation-sklearn==0.38b0.dev", }, "sqlalchemy": { "library": "sqlalchemy", - "instrumentation": "opentelemetry-instrumentation-sqlalchemy==0.37b0.dev", + "instrumentation": "opentelemetry-instrumentation-sqlalchemy==0.38b0.dev", }, "starlette": { "library": "starlette ~= 0.13.0", - "instrumentation": "opentelemetry-instrumentation-starlette==0.37b0.dev", + "instrumentation": "opentelemetry-instrumentation-starlette==0.38b0.dev", }, "psutil": { "library": "psutil >= 5", - "instrumentation": "opentelemetry-instrumentation-system-metrics==0.37b0.dev", + "instrumentation": "opentelemetry-instrumentation-system-metrics==0.38b0.dev", }, "tornado": { "library": "tornado >= 5.1.1", - "instrumentation": "opentelemetry-instrumentation-tornado==0.37b0.dev", + "instrumentation": "opentelemetry-instrumentation-tornado==0.38b0.dev", }, "tortoise-orm": { "library": "tortoise-orm >= 0.17.0", - "instrumentation": "opentelemetry-instrumentation-tortoiseorm==0.37b0.dev", + "instrumentation": "opentelemetry-instrumentation-tortoiseorm==0.38b0.dev", }, "pydantic": { "library": "pydantic >= 1.10.2", - "instrumentation": "opentelemetry-instrumentation-tortoiseorm==0.37b0.dev", + "instrumentation": "opentelemetry-instrumentation-tortoiseorm==0.38b0.dev", }, "urllib3": { "library": "urllib3 >= 1.0.0, < 2.0.0", - "instrumentation": "opentelemetry-instrumentation-urllib3==0.37b0.dev", + "instrumentation": "opentelemetry-instrumentation-urllib3==0.38b0.dev", }, } default_instrumentations = [ - "opentelemetry-instrumentation-aws-lambda==0.37b0.dev", - "opentelemetry-instrumentation-dbapi==0.37b0.dev", - "opentelemetry-instrumentation-logging==0.37b0.dev", - "opentelemetry-instrumentation-sqlite3==0.37b0.dev", - "opentelemetry-instrumentation-urllib==0.37b0.dev", - "opentelemetry-instrumentation-wsgi==0.37b0.dev", + "opentelemetry-instrumentation-aws-lambda==0.38b0.dev", + "opentelemetry-instrumentation-dbapi==0.38b0.dev", + "opentelemetry-instrumentation-logging==0.38b0.dev", + "opentelemetry-instrumentation-sqlite3==0.38b0.dev", + "opentelemetry-instrumentation-urllib==0.38b0.dev", + "opentelemetry-instrumentation-wsgi==0.38b0.dev", ] diff --git a/opentelemetry-instrumentation/src/opentelemetry/instrumentation/version.py b/opentelemetry-instrumentation/src/opentelemetry/instrumentation/version.py index 0a47df4f5a..8778b43b17 100644 --- a/opentelemetry-instrumentation/src/opentelemetry/instrumentation/version.py +++ b/opentelemetry-instrumentation/src/opentelemetry/instrumentation/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/propagator/opentelemetry-propagator-ot-trace/src/opentelemetry/propagators/ot_trace/version.py b/propagator/opentelemetry-propagator-ot-trace/src/opentelemetry/propagators/ot_trace/version.py index 0a47df4f5a..8778b43b17 100644 --- a/propagator/opentelemetry-propagator-ot-trace/src/opentelemetry/propagators/ot_trace/version.py +++ b/propagator/opentelemetry-propagator-ot-trace/src/opentelemetry/propagators/ot_trace/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev" diff --git a/scripts/otel_packaging.py b/scripts/otel_packaging.py index c7765c10b7..2f42e44189 100644 --- a/scripts/otel_packaging.py +++ b/scripts/otel_packaging.py @@ -14,6 +14,7 @@ import os import subprocess +from subprocess import CalledProcessError import tomli @@ -28,12 +29,18 @@ def get_instrumentation_packages(): if not os.path.isdir(pkg_path): continue - version = subprocess.check_output( - "hatch version", - shell=True, - cwd=pkg_path, - universal_newlines=True, - ) + try: + version = subprocess.check_output( + "hatch version", + shell=True, + cwd=pkg_path, + universal_newlines=True, + ) + except CalledProcessError as exc: + print(f"Could not get hatch version from path {pkg_path}") + print(exc.output) + raise exc + pyproject_toml_path = os.path.join(pkg_path, "pyproject.toml") with open(pyproject_toml_path, "rb") as file: diff --git a/tests/opentelemetry-docker-tests/tests/sqlalchemy_tests/test_mssql.py b/tests/opentelemetry-docker-tests/tests/sqlalchemy_tests/test_mssql.py index fef1bf7b7b..713be24198 100644 --- a/tests/opentelemetry-docker-tests/tests/sqlalchemy_tests/test_mssql.py +++ b/tests/opentelemetry-docker-tests/tests/sqlalchemy_tests/test_mssql.py @@ -71,6 +71,7 @@ def test_engine_execute_errors(self): spans = self.memory_exporter.get_finished_spans() # one span for the connection and one for the query self.assertEqual(len(spans), 2) + self.check_meta(spans[0]) span = spans[1] # span fields self.assertEqual(span.name, "SELECT opentelemetry-tests") @@ -99,6 +100,7 @@ def test_orm_insert(self): spans = self.memory_exporter.get_finished_spans() # connect, identity insert on before the insert, insert, and identity insert off after the insert self.assertEqual(len(spans), 4) + self.check_meta(spans[0]) span = spans[2] self._check_span(span, "INSERT") self.assertIn( diff --git a/tests/opentelemetry-docker-tests/tests/sqlalchemy_tests/test_mysql.py b/tests/opentelemetry-docker-tests/tests/sqlalchemy_tests/test_mysql.py index ceebe78ef5..6e4c85cd92 100644 --- a/tests/opentelemetry-docker-tests/tests/sqlalchemy_tests/test_mysql.py +++ b/tests/opentelemetry-docker-tests/tests/sqlalchemy_tests/test_mysql.py @@ -70,6 +70,7 @@ def test_engine_execute_errors(self): spans = self.memory_exporter.get_finished_spans() # one span for the connection and one for the query self.assertEqual(len(spans), 2) + self.check_meta(spans[0]) span = spans[1] # span fields self.assertEqual(span.name, "SELECT opentelemetry-tests") diff --git a/tox.ini b/tox.ini index e51515f906..3d73d37667 100644 --- a/tox.ini +++ b/tox.ini @@ -168,8 +168,11 @@ envlist = ; instrumentation-remoulade intentionally excluded from pypy3 ; opentelemetry-instrumentation-celery - py3{7,8,9,10,11}-test-instrumentation-celery - pypy3-test-instrumentation-celery + ; celery tests don't run on 3.7 because our opentelemetry-api requires importlib-metadata >= 5.0.0 + ; but celery requires importlib-metadata < 5.0.0 + ; see https://github.com/celery/celery/issues/7783 for more details + py3{8,9,10,11}-test-instrumentation-celery + ; pypy3-test-instrumentation-celery ; opentelemetry-instrumentation-sklearn py3{7,8}-test-instrumentation-sklearn @@ -207,8 +210,8 @@ envlist = pypy3-test-instrumentation-pika{0,1} ; opentelemetry-instrumentation-aio-pika - py3{7,8,9,10,11}-test-instrumentation-aio-pika{7,8} - pypy3-test-instrumentation-aio-pika{7,8} + py3{7,8,9,10,11}-test-instrumentation-aio-pika{7,8,9} + pypy3-test-instrumentation-aio-pika{7,8,9} ; opentelemetry-instrumentation-kafka-python py3{7,8,9,10,11}-test-instrumentation-kafka-python @@ -256,6 +259,7 @@ deps = pika1: pika>=1.0.0 aio-pika7: aio_pika~=7.2.0 aio-pika8: aio_pika>=8.0.0,<9.0.0 + aio-pika9: aio_pika>=9.0.0,<10.0.0 pymemcache135: pymemcache ==1.3.5 pymemcache200: pymemcache >2.0.0,<3.0.0 pymemcache300: pymemcache >3.0.0,<3.4.2 @@ -302,7 +306,7 @@ changedir = test-instrumentation-logging: instrumentation/opentelemetry-instrumentation-logging/tests test-instrumentation-mysql: instrumentation/opentelemetry-instrumentation-mysql/tests test-instrumentation-pika{0,1}: instrumentation/opentelemetry-instrumentation-pika/tests - test-instrumentation-aio-pika{7,8}: instrumentation/opentelemetry-instrumentation-aio-pika/tests + test-instrumentation-aio-pika{7,8,9}: instrumentation/opentelemetry-instrumentation-aio-pika/tests test-instrumentation-psycopg2: instrumentation/opentelemetry-instrumentation-psycopg2/tests test-instrumentation-pymemcache{135,200,300,342}: instrumentation/opentelemetry-instrumentation-pymemcache/tests test-instrumentation-pymongo: instrumentation/opentelemetry-instrumentation-pymongo/tests @@ -344,7 +348,7 @@ commands_pre = pika{0,1}: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-pika[test] - aio-pika{7,8}: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-aio-pika[test] + aio-pika{7,8,9}: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-aio-pika[test] kafka-python: pip install {toxinidir}/instrumentation/opentelemetry-instrumentation-kafka-python[test] diff --git a/util/opentelemetry-util-http/src/opentelemetry/util/http/version.py b/util/opentelemetry-util-http/src/opentelemetry/util/http/version.py index 0a47df4f5a..8778b43b17 100644 --- a/util/opentelemetry-util-http/src/opentelemetry/util/http/version.py +++ b/util/opentelemetry-util-http/src/opentelemetry/util/http/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.37b0.dev" +__version__ = "0.38b0.dev"