Skip to content

Commit

Permalink
Merge branch 'Change-metrics-tests-to-work-with-test_base' of https:/…
Browse files Browse the repository at this point in the history
…/github.com/shalevr/opentelemetry-python-contrib into Change-metrics-tests-to-work-with-test_base

* 'Change-metrics-tests-to-work-with-test_base' of https://github.com/shalevr/opentelemetry-python-contrib:
  Fix issue with Flask instrumentation when a request spawn children threads and copies the request context (open-telemetry#1654)
  Add connection attributes to sqlalchemy connect span (open-telemetry#1608)
  Add boto3sqs to docs (open-telemetry#1666)
  Audit and test opentelemetry-instrumentation-elasticsearch NoOpTracer… (open-telemetry#1616)
  Copy change log updates from release/v1.16.x-0.37bx (open-telemetry#1683)
  Update version to 1.17.0.dev/0.38b0.dev (open-telemetry#1677)
  Fix CI Failure (open-telemetry#1680)
  Add better debugging if hatch subprocess fails (open-telemetry#1672)
  Add confluent kafka docs (open-telemetry#1668)
  Support aio_pika 9 (open-telemetry#1670)
  Audit and test opentelemetry-instrumentation-wsgi NoOpTracerProvider (open-telemetry#1610)
  bot (open-telemetry#1667)
  Add commit method for ConfluentKafkaInstrumentor's ProxiedConsumer (open-telemetry#1656)
  Revert open-telemetry#1097 (open-telemetry#1660)
  Audit and test opentelemetry-instrumentation-django NoOpTracerProvider (open-telemetry#1611)
  Audit and test opentelemetry-instrumentation-aiohttp-client NoOpTrace… (open-telemetry#1612)
  Audit and test opentelemetry-instrumentation-flask NoOpTracerProvider (open-telemetry#1614)
  Audit and test opentelemetry-instrumentation-dbapi NoOpTracerProvider (open-telemetry#1607)
  • Loading branch information
shalevr committed Feb 23, 2023
2 parents 7cbdb7d + 2d04bf8 commit dfcedf8
Show file tree
Hide file tree
Showing 134 changed files with 703 additions and 452 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/backport.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/prepare-patch-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/prepare-release-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down Expand Up @@ -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}\`."
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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\`."
Expand Down
17 changes: 16 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion _template/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 2 additions & 0 deletions docs-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 8 additions & 19 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
6 changes: 6 additions & 0 deletions docs/instrumentation/boto3sqs/boto3sqs.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.. include:: ../../../instrumentation/opentelemetry-instrumentation-boto3sqs/README.rst

.. automodule:: opentelemetry.instrumentation.boto3sqs
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/instrumentation/confluent_kafka/confluent_kafka.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.. include:: ../../../instrumentation/opentelemetry-instrumentation-confluent-kafka/README.rst

.. automodule:: opentelemetry.instrumentation.confluent_kafka
:members:
:undoc-members:
:show-inheritance:
:noindex:
33 changes: 31 additions & 2 deletions docs/nitpick-exceptions.ini
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
4 changes: 2 additions & 2 deletions eachdist.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ sortfirst=
ext/*

[stable]
version=1.16.0.dev
version=1.17.0.dev

packages=
opentelemetry-sdk
Expand All @@ -34,7 +34,7 @@ packages=
opentelemetry-api

[prerelease]
version=0.37b0.dev
version=0.38b0.dev

packages=
all
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion exporter/opentelemetry-exporter-richconsole/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion instrumentation/README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",)
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -23,6 +23,7 @@
from opentelemetry.trace import SpanKind, get_tracer

from .consts import (
AIOPIKA_VERSION_INFO,
CHANNEL_7,
CHANNEL_8,
CORRELATION_ID,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -24,6 +24,7 @@
from opentelemetry.trace import SpanKind, get_tracer

from .consts import (
AIOPIKA_VERSION_INFO,
CHANNEL_7,
CHANNEL_8,
CONNECTION_7,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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(
Expand Down
Loading

0 comments on commit dfcedf8

Please sign in to comment.