Skip to content

Commit

Permalink
Merge branch 'issue-1747' of https://github.com/javferrod/opentelemet…
Browse files Browse the repository at this point in the history
…ry-python-contrib into issue-1747
  • Loading branch information
javferrod committed Aug 13, 2023
2 parents a552778 + 6ce77cf commit 8a76540
Show file tree
Hide file tree
Showing 123 changed files with 1,488 additions and 491 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- 'release/*'
pull_request:
env:
CORE_REPO_SHA: e9530c5c548d08a6aaa56268d103f9beb00cd002
CORE_REPO_SHA: c41b6bf29e9486a71ba1c40cd0ea35a03b2f7489

jobs:
build:
Expand Down
35 changes: 27 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,39 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

### Fixed

- `opentelemetry-instrumentation-asgi` Fix UnboundLocalError local variable 'start' referenced before assignment
([#1889](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1889))

## Version 1.19.0/0.40b0 (2023-07-13)
- `opentelemetry-instrumentation-asgi` Add `http.server.request.size` metric
([#1867](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1867))

### Fixed

- `opentelemetry-instrumentation-django` Fix empty span name when using
`path("", ...)` ([#1788](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1788)
- Fix elastic-search instrumentation sanitization to support bulk queries
([#1870](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1870))
- Update falcon instrumentation to follow semantic conventions
([#1824](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1824))
- Fix sqlalchemy instrumentation wrap methods to accept sqlcommenter options([#1873](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1873))
- Fix sqlalchemy instrumentation wrap methods to accept sqlcommenter options
([#1873](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1873))

### Added

- Fix async redis clients not being traced correctly ([#1830](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1830))
- Add instrumentor support for mysqlclient
([#1744](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1744))
- Fix async redis clients not being traced correctly
([#1830](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1830))
- Make Flask request span attributes available for `start_span`.
([#1784](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1784))
- Fix falcon instrumentation's usage of Span Status to only set the description if the status code is ERROR.
([#1840](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1840))
- Instrument all httpx versions >= 0.18. ([#1748](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1748))
- Instrument all httpx versions >= 0.18.
([#1748](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1748))
- Fix `Invalid type NoneType for attribute X (opentelemetry-instrumentation-aws-lambda)` error when some attributes do not exist
([#1780](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1780))
- Add metric instrumentation for celery
Expand All @@ -37,18 +51,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#1810](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1810))
- `opentelemetry-instrumentation-urllib3` Add support for urllib3 version 2
([#1879](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1879))
- Add optional distro and configurator selection for auto-instrumentation
([#1823](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1823))

### Added
- `opentelemetry-instrumentation-kafka-python` Add instrumentation to `consume` method
([#1786](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1786))

## Version 1.18.0/0.39b0 (2023-05-10)

- `opentelemetry-instrumentation-system-metrics` Add `process.` prefix to `runtime.memory`, `runtime.cpu.time`, and `runtime.gc_count`. Change `runtime.memory` from count to UpDownCounter. ([#1735](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1735))
- Update runtime metrics to follow semantic conventions
([#1735](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1735))
- Add request and response hooks for GRPC instrumentation (client only)
([#1706](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1706))
- Fix memory leak in SQLAlchemy instrumentation where disposed `Engine` does not get garbage collected
([#1771](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1771)
([#1771](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1771))
- `opentelemetry-instrumentation-pymemcache` Update instrumentation to support pymemcache >4
([#1764](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1764))
- `opentelemetry-instrumentation-confluent-kafka` Add support for higher versions of confluent_kafka
Expand All @@ -71,8 +88,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- `opentelemetry-instrumentation-botocore` now uses the AWS X-Ray propagator by
default
- `opentelemetry-instrumentation-botocore` now uses the AWS X-Ray propagator by default
([#1741](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1741))

### Fixed
Expand All @@ -90,7 +106,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed
- Update HTTP server/client instrumentation span names to comply with spec
([#1759](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1759)
([#1759](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1759))

## Version 1.17.0/0.38b0 (2023-03-22)

Expand Down Expand Up @@ -143,6 +159,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#1592](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1592))
- `opentelemetry-instrumentation-django` Allow explicit `excluded_urls` configuration through `instrument()`
([#1618](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1618))
- `opentelemetry-instrumentation-aws-lambda` Use env var `_X_AMZN_TRACE_ID` as a
Span Link instead of parent
([#1657](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1657))

### Fixed

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.40b0.dev"
__version__ = "0.41b0.dev"
1 change: 1 addition & 0 deletions docs-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ falcon~=2.0
grpcio~=1.27
kafka-python>=2.0,<3.0
mysql-connector-python~=8.0
mysqlclient~=2.1.1
psutil>=5
pika>=0.12.0
pymongo~=3.1
Expand Down
7 changes: 7 additions & 0 deletions docs/instrumentation/mysqlclient/mysqlclient.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
OpenTelemetry mysqlclient Instrumentation
=========================================

.. automodule:: opentelemetry.instrumentation.mysqlclient
:members:
:undoc-members:
:show-inheritance:
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.19.0.dev
version=1.20.0.dev

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

[prerelease]
version=0.40b0.dev
version=0.41b0.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.40b0.dev"
__version__ = "0.41b0.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.40b0.dev",
"opentelemetry-semantic-conventions == 0.41b0.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.40b0.dev"
__version__ = "0.41b0.dev"
1 change: 1 addition & 0 deletions instrumentation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
| [opentelemetry-instrumentation-kafka-python](./opentelemetry-instrumentation-kafka-python) | kafka-python >= 2.0 | No
| [opentelemetry-instrumentation-logging](./opentelemetry-instrumentation-logging) | logging | No
| [opentelemetry-instrumentation-mysql](./opentelemetry-instrumentation-mysql) | mysql-connector-python ~= 8.0 | No
| [opentelemetry-instrumentation-mysqlclient](./opentelemetry-instrumentation-mysqlclient) | mysqlclient < 3 | No
| [opentelemetry-instrumentation-pika](./opentelemetry-instrumentation-pika) | pika >= 0.12.0 | No
| [opentelemetry-instrumentation-psycopg2](./opentelemetry-instrumentation-psycopg2) | psycopg2 >= 2.7.3.1 | No
| [opentelemetry-instrumentation-pymemcache](./opentelemetry-instrumentation-pymemcache) | pymemcache >= 1.3.5, < 5 | No
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ instruments = [
]
test = [
"opentelemetry-instrumentation-aio-pika[instruments]",
"opentelemetry-test-utils == 0.40b0.dev",
"opentelemetry-test-utils == 0.41b0.dev",
"pytest",
"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.40b0.dev"
__version__ = "0.41b0.dev"
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.40b0.dev",
"opentelemetry-semantic-conventions == 0.40b0.dev",
"opentelemetry-util-http == 0.40b0.dev",
"opentelemetry-instrumentation == 0.41b0.dev",
"opentelemetry-semantic-conventions == 0.41b0.dev",
"opentelemetry-util-http == 0.41b0.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.40b0.dev"
__version__ = "0.41b0.dev"
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ classifiers = [
]
dependencies = [
"opentelemetry-api ~= 1.12",
"opentelemetry-instrumentation == 0.40b0.dev",
"opentelemetry-instrumentation-dbapi == 0.40b0.dev",
"opentelemetry-instrumentation == 0.41b0.dev",
"opentelemetry-instrumentation-dbapi == 0.41b0.dev",
"wrapt >= 1.0.0, < 2.0.0",
]

Expand All @@ -37,8 +37,8 @@ instruments = [
]
test = [
"opentelemetry-instrumentation-aiopg[instruments]",
"opentelemetry-semantic-conventions == 0.40b0.dev",
"opentelemetry-test-utils == 0.40b0.dev",
"opentelemetry-semantic-conventions == 0.41b0.dev",
"opentelemetry-test-utils == 0.41b0.dev",
]

[project.entry-points.opentelemetry_instrumentor]
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.40b0.dev"
__version__ = "0.41b0.dev"
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ classifiers = [
dependencies = [
"asgiref ~= 3.0",
"opentelemetry-api ~= 1.12",
"opentelemetry-instrumentation == 0.40b0.dev",
"opentelemetry-semantic-conventions == 0.40b0.dev",
"opentelemetry-util-http == 0.40b0.dev",
"opentelemetry-instrumentation == 0.41b0.dev",
"opentelemetry-semantic-conventions == 0.41b0.dev",
"opentelemetry-util-http == 0.41b0.dev",
]

[project.optional-dependencies]
Expand All @@ -38,7 +38,7 @@ instruments = [
]
test = [
"opentelemetry-instrumentation-asgi[instruments]",
"opentelemetry-test-utils == 0.40b0.dev",
"opentelemetry-test-utils == 0.41b0.dev",
]

[project.urls]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,7 @@ async def __call__(self, scope, receive, send):
receive: An awaitable callable yielding dictionaries
send: An awaitable callable taking a single dictionary as argument.
"""
start = default_timer()
if scope["type"] not in ("http", "websocket"):
return await self.app(scope, receive, send)

Expand Down Expand Up @@ -591,7 +592,6 @@ async def __call__(self, scope, receive, send):
send,
duration_attrs,
)
start = default_timer()

await self.app(scope, otel_receive, otel_send)
finally:
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.40b0.dev"
__version__ = "0.41b0.dev"
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

# pylint: disable=too-many-lines

import asyncio
import sys
import unittest
from timeit import default_timer
Expand Down Expand Up @@ -796,5 +797,38 @@ async def wrapped_app(scope, receive, send):
)


class TestAsgiApplicationRaisingError(AsgiTestBase):
def tearDown(self):
pass

@mock.patch(
"opentelemetry.instrumentation.asgi.collect_custom_request_headers_attributes",
side_effect=ValueError("whatever"),
)
def test_asgi_issue_1883(
self, mock_collect_custom_request_headers_attributes
):
"""
Test that exception UnboundLocalError local variable 'start' referenced before assignment is not raised
See https://github.com/open-telemetry/opentelemetry-python-contrib/issues/1883
"""
app = otel_asgi.OpenTelemetryMiddleware(simple_asgi)
self.seed_app(app)
self.send_default_request()
try:
asyncio.get_event_loop().run_until_complete(
self.communicator.stop()
)
except ValueError as exc_info:
self.assertEqual(exc_info.args[0], "whatever")
except Exception as exc_info: # pylint: disable=W0703
self.fail(
"expecting ValueError('whatever'), received instead: "
+ str(exc_info)
)
else:
self.fail("expecting ValueError('whatever')")


if __name__ == "__main__":
unittest.main()
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ classifiers = [
]
dependencies = [
"opentelemetry-api ~= 1.12",
"opentelemetry-instrumentation == 0.40b0.dev",
"opentelemetry-semantic-conventions == 0.40b0.dev",
"opentelemetry-instrumentation == 0.41b0.dev",
"opentelemetry-semantic-conventions == 0.41b0.dev",
]

[project.optional-dependencies]
Expand All @@ -36,7 +36,7 @@ instruments = [
]
test = [
"opentelemetry-instrumentation-asyncpg[instruments]",
"opentelemetry-test-utils == 0.40b0.dev",
"opentelemetry-test-utils == 0.41b0.dev",
]

[project.entry-points.opentelemetry_instrumentor]
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.40b0.dev"
__version__ = "0.41b0.dev"
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ classifiers = [
"Programming Language :: Python :: 3.8",
]
dependencies = [
"opentelemetry-instrumentation == 0.40b0.dev",
"opentelemetry-instrumentation == 0.41b0.dev",
"opentelemetry-propagator-aws-xray == 1.0.1",
"opentelemetry-semantic-conventions == 0.40b0.dev",
"opentelemetry-semantic-conventions == 0.41b0.dev",
]

[project.optional-dependencies]
instruments = []
test = [
"opentelemetry-test-utils == 0.40b0.dev",
"opentelemetry-test-utils == 0.41b0.dev",
]

[project.urls]
Expand Down
Loading

0 comments on commit 8a76540

Please sign in to comment.