From dd682419074bfd7b054a40e346e95056bee7801c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Em=C3=ADdio=20Neto?= <9735060+emdneto@users.noreply.github.com> Date: Tue, 28 Jan 2025 11:05:19 -0300 Subject: [PATCH] fix pymssql entry_point for auto-instrumentation (#3214) Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com> Co-authored-by: Riccardo Magliocchetti --- .../pyproject.toml | 2 +- .../tests/test_pymssql_integration.py | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/instrumentation/opentelemetry-instrumentation-pymssql/pyproject.toml b/instrumentation/opentelemetry-instrumentation-pymssql/pyproject.toml index 5360007a5c..ac0e839e5c 100644 --- a/instrumentation/opentelemetry-instrumentation-pymssql/pyproject.toml +++ b/instrumentation/opentelemetry-instrumentation-pymssql/pyproject.toml @@ -37,7 +37,7 @@ instruments = [ ] [project.entry-points.opentelemetry_instrumentor] -pymssql = "opentelemetry.instrumentation.pymssql:pymssqlInstrumentor" +pymssql = "opentelemetry.instrumentation.pymssql:PyMSSQLInstrumentor" [project.urls] Homepage = "https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/instrumentation/opentelemetry-instrumentation-pymssql" diff --git a/instrumentation/opentelemetry-instrumentation-pymssql/tests/test_pymssql_integration.py b/instrumentation/opentelemetry-instrumentation-pymssql/tests/test_pymssql_integration.py index ccd522b165..3dc937318a 100644 --- a/instrumentation/opentelemetry-instrumentation-pymssql/tests/test_pymssql_integration.py +++ b/instrumentation/opentelemetry-instrumentation-pymssql/tests/test_pymssql_integration.py @@ -20,6 +20,7 @@ from opentelemetry.instrumentation.pymssql import PyMSSQLInstrumentor from opentelemetry.sdk import resources from opentelemetry.test.test_base import TestBase +from opentelemetry.util._importlib_metadata import entry_points def mock_connect(*args, **kwargs): @@ -182,3 +183,15 @@ def test_uninstrument_connection(self): spans_list = self.memory_exporter.get_finished_spans() self.assertEqual(len(spans_list), 1) + + def test_load_entry_point(self): + self.assertIs( + next( + iter( + entry_points( + group="opentelemetry_instrumentor", name="pymssql" + ) + ) + ).load(), + PyMSSQLInstrumentor, + )