Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

### Added
### Added

- `opentelemetry-instrumentation-aiohttp-client`: add support for url exclusions via `OTEL_PYTHON_EXCLUDED_URLS` / `OTEL_PYTHON_AIOHTTP_CLIENT_EXCLUDED_URLS`
([#3850](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3850))
Expand Down Expand Up @@ -42,10 +42,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#3882](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3882))
- `opentelemetry-instrumentation-aiohttp-server`: delay initialization of tracer, meter and excluded urls to instrumentation for testability
([#3836](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3836))
- Replace Python 3.14-deprecated `asyncio.iscoroutinefunction` with `inspect.iscoroutinefunction`.
- Replace Python 3.14-deprecated `asyncio.iscoroutinefunction` with `inspect.iscoroutinefunction`.
([#3880](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3880))
- `opentelemetry-instrumentation-elasticsearch`: Enhance elasticsearch query body sanitization
([#3919](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3919))
([#3919](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3919))
- `opentelemetry-instrumentation-pymongo`: Fix span error descriptions
([#3904](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3904))
- build: bump ruff to 0.14.1
Expand All @@ -54,6 +54,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#3941](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3941))
- `opentelemetry-instrumentation-pymongo`: Fix invalid mongodb collection attribute type
([#3942](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3942))
- `opentelemetry-instrumentation-mysqlclient`: Pass all keyword parameters
([#3950](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3950))

## Version 1.38.0/0.59b0 (2025-10-16)

Expand All @@ -76,7 +78,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#3743](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3743))
- Add `rstcheck` to pre-commit to stop introducing invalid RST
([#3777](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3777))
- `opentelemetry-exporter-credential-provider-gcp`: create this package which provides support for supplying your machine's Application Default
- `opentelemetry-exporter-credential-provider-gcp`: create this package which provides support for supplying your machine's Application Default
Credentials (https://cloud.google.com/docs/authentication/application-default-credentials) to the OTLP Exporters created automatically by OpenTelemetry Python's auto instrumentation. These credentials authorize OTLP traces to be sent to `telemetry.googleapis.com`. [#3766](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3766).
- `opentelemetry-instrumentation-psycopg`: Add missing parameter `capture_parameters` to instrumentor.
([#3676](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3676))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,13 @@ def _instrument(self, **kwargs): # pylint: disable=no-self-use
"""Integrate with the mysqlclient library.
https://github.com/PyMySQL/mysqlclient/
"""
tracer_provider = kwargs.get("tracer_provider")
enable_sqlcommenter = kwargs.get("enable_commenter", False)
commenter_options = kwargs.get("commenter_options", {})
enable_attribute_commenter = kwargs.get(
"enable_attribute_commenter", False
)
kwargs_with_defaults = {
"tracer_provider": None,
"enable_commenter": False,
"commenter_options": {},
"enable_attribute_commenter": False,
**kwargs,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think on having an utility function that extracts from kwargs whatever wrap_connect supports instead? I think it'll become harder to reason about code that just forwards everything it gets.

}

dbapi.wrap_connect(
__name__,
Expand All @@ -174,10 +175,7 @@ def _instrument(self, **kwargs): # pylint: disable=no-self-use
_DATABASE_SYSTEM,
_CONNECTION_ATTRIBUTES,
version=__version__,
tracer_provider=tracer_provider,
enable_commenter=enable_sqlcommenter,
commenter_options=commenter_options,
enable_attribute_commenter=enable_attribute_commenter,
**kwargs_with_defaults,
)

def _uninstrument(self, **kwargs): # pylint: disable=no-self-use
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -507,3 +507,33 @@ def test_uninstrument_connection(self, mock_connect):

spans_list = self.memory_exporter.get_finished_spans()
self.assertEqual(len(spans_list), 0)

@mock.patch("opentelemetry.instrumentation.dbapi.wrap_connect")
@mock.patch("MySQLdb.connect")
# pylint: disable=unused-argument
def test_missing_capture_parameters_if_not_specified(
self,
_mock_connect,
mock_wrap_connect,
):
instrumentor = MySQLClientInstrumentor()
instrumentor.instrument()
kwargs = mock_wrap_connect.call_args[1]
self.assertNotIn("capture_parameters", kwargs)

@mock.patch("opentelemetry.instrumentation.dbapi.wrap_connect")
@mock.patch("MySQLdb.connect")
# pylint: disable=unused-argument
def test_passes_capture_parameters_if_specified(
self,
_mock_connect,
mock_wrap_connect,
):
"""
MySQLClientInstrumentor.instrument should pass any provided,
arbitrary kwargs to DB-API wrap_connect
"""
instrumentor = MySQLClientInstrumentor()
instrumentor.instrument(capture_parameters=True)
kwargs = mock_wrap_connect.call_args[1]
self.assertTrue(kwargs["capture_parameters"])