opentelemetry-instrumentation 0.53b0__tar.gz → 0.54b0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. {opentelemetry_instrumentation-0.53b0 → opentelemetry_instrumentation-0.54b0}/PKG-INFO +2 -2
  2. {opentelemetry_instrumentation-0.53b0 → opentelemetry_instrumentation-0.54b0}/pyproject.toml +1 -1
  3. {opentelemetry_instrumentation-0.53b0 → opentelemetry_instrumentation-0.54b0}/src/opentelemetry/instrumentation/_semconv.py +37 -0
  4. {opentelemetry_instrumentation-0.53b0 → opentelemetry_instrumentation-0.54b0}/src/opentelemetry/instrumentation/auto_instrumentation/_load.py +8 -0
  5. {opentelemetry_instrumentation-0.53b0 → opentelemetry_instrumentation-0.54b0}/src/opentelemetry/instrumentation/bootstrap_gen.py +54 -54
  6. {opentelemetry_instrumentation-0.53b0 → opentelemetry_instrumentation-0.54b0}/src/opentelemetry/instrumentation/instrumentor.py +4 -1
  7. {opentelemetry_instrumentation-0.53b0 → opentelemetry_instrumentation-0.54b0}/src/opentelemetry/instrumentation/version.py +1 -1
  8. {opentelemetry_instrumentation-0.53b0 → opentelemetry_instrumentation-0.54b0}/tests/auto_instrumentation/test_load.py +48 -1
  9. {opentelemetry_instrumentation-0.53b0 → opentelemetry_instrumentation-0.54b0}/tests/test_instrumentor.py +18 -1
  10. {opentelemetry_instrumentation-0.53b0 → opentelemetry_instrumentation-0.54b0}/.gitignore +0 -0
  11. {opentelemetry_instrumentation-0.53b0 → opentelemetry_instrumentation-0.54b0}/LICENSE +0 -0
  12. {opentelemetry_instrumentation-0.53b0 → opentelemetry_instrumentation-0.54b0}/README.rst +0 -0
  13. {opentelemetry_instrumentation-0.53b0 → opentelemetry_instrumentation-0.54b0}/src/opentelemetry/instrumentation/auto_instrumentation/__init__.py +0 -0
  14. {opentelemetry_instrumentation-0.53b0 → opentelemetry_instrumentation-0.54b0}/src/opentelemetry/instrumentation/auto_instrumentation/sitecustomize.py +0 -0
  15. {opentelemetry_instrumentation-0.53b0 → opentelemetry_instrumentation-0.54b0}/src/opentelemetry/instrumentation/bootstrap.py +0 -0
  16. {opentelemetry_instrumentation-0.53b0 → opentelemetry_instrumentation-0.54b0}/src/opentelemetry/instrumentation/dependencies.py +0 -0
  17. {opentelemetry_instrumentation-0.53b0 → opentelemetry_instrumentation-0.54b0}/src/opentelemetry/instrumentation/distro.py +0 -0
  18. {opentelemetry_instrumentation-0.53b0 → opentelemetry_instrumentation-0.54b0}/src/opentelemetry/instrumentation/environment_variables.py +0 -0
  19. {opentelemetry_instrumentation-0.53b0 → opentelemetry_instrumentation-0.54b0}/src/opentelemetry/instrumentation/propagators.py +0 -0
  20. {opentelemetry_instrumentation-0.53b0 → opentelemetry_instrumentation-0.54b0}/src/opentelemetry/instrumentation/py.typed +0 -0
  21. {opentelemetry_instrumentation-0.53b0 → opentelemetry_instrumentation-0.54b0}/src/opentelemetry/instrumentation/sqlcommenter_utils.py +0 -0
  22. {opentelemetry_instrumentation-0.53b0 → opentelemetry_instrumentation-0.54b0}/src/opentelemetry/instrumentation/utils.py +0 -0
  23. {opentelemetry_instrumentation-0.53b0 → opentelemetry_instrumentation-0.54b0}/tests/__init__.py +0 -0
  24. {opentelemetry_instrumentation-0.53b0 → opentelemetry_instrumentation-0.54b0}/tests/auto_instrumentation/test_initialize.py +0 -0
  25. {opentelemetry_instrumentation-0.53b0 → opentelemetry_instrumentation-0.54b0}/tests/auto_instrumentation/test_run.py +0 -0
  26. {opentelemetry_instrumentation-0.53b0 → opentelemetry_instrumentation-0.54b0}/tests/auto_instrumentation/test_sitecustomize.py +0 -0
  27. {opentelemetry_instrumentation-0.53b0 → opentelemetry_instrumentation-0.54b0}/tests/test_bootstrap.py +0 -0
  28. {opentelemetry_instrumentation-0.53b0 → opentelemetry_instrumentation-0.54b0}/tests/test_dependencies.py +0 -0
  29. {opentelemetry_instrumentation-0.53b0 → opentelemetry_instrumentation-0.54b0}/tests/test_distro.py +0 -0
  30. {opentelemetry_instrumentation-0.53b0 → opentelemetry_instrumentation-0.54b0}/tests/test_propagators.py +0 -0
  31. {opentelemetry_instrumentation-0.53b0 → opentelemetry_instrumentation-0.54b0}/tests/test_semconv.py +0 -0
  32. {opentelemetry_instrumentation-0.53b0 → opentelemetry_instrumentation-0.54b0}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: opentelemetry-instrumentation
3
- Version: 0.53b0
3
+ Version: 0.54b0
4
4
  Summary: Instrumentation Tools & Auto Instrumentation for OpenTelemetry Python
5
5
  Project-URL: Homepage, https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/opentelemetry-instrumentation
6
6
  Project-URL: Repository, https://github.com/open-telemetry/opentelemetry-python-contrib
@@ -20,7 +20,7 @@ Classifier: Programming Language :: Python :: 3.12
20
20
  Classifier: Programming Language :: Python :: 3.13
21
21
  Requires-Python: >=3.8
22
22
  Requires-Dist: opentelemetry-api~=1.4
23
- Requires-Dist: opentelemetry-semantic-conventions==0.53b0
23
+ Requires-Dist: opentelemetry-semantic-conventions==0.54b0
24
24
  Requires-Dist: packaging>=18.0
25
25
  Requires-Dist: wrapt<2.0.0,>=1.0.0
26
26
  Description-Content-Type: text/x-rst
@@ -27,7 +27,7 @@ classifiers = [
27
27
  ]
28
28
  dependencies = [
29
29
  "opentelemetry-api ~= 1.4",
30
- "opentelemetry-semantic-conventions == 0.53b0",
30
+ "opentelemetry-semantic-conventions == 0.54b0",
31
31
  "wrapt >= 1.0.0, < 2.0.0",
32
32
  "packaging >= 18.0",
33
33
  ]
@@ -47,6 +47,43 @@ from opentelemetry.semconv.attributes.user_agent_attributes import (
47
47
  from opentelemetry.semconv.trace import SpanAttributes
48
48
  from opentelemetry.trace.status import Status, StatusCode
49
49
 
50
+ # Values defined in milliseconds
51
+ HTTP_DURATION_HISTOGRAM_BUCKETS_OLD = (
52
+ 0.0,
53
+ 5.0,
54
+ 10.0,
55
+ 25.0,
56
+ 50.0,
57
+ 75.0,
58
+ 100.0,
59
+ 250.0,
60
+ 500.0,
61
+ 750.0,
62
+ 1000.0,
63
+ 2500.0,
64
+ 5000.0,
65
+ 7500.0,
66
+ 10000.0,
67
+ )
68
+
69
+ # Values defined in seconds
70
+ HTTP_DURATION_HISTOGRAM_BUCKETS_NEW = (
71
+ 0.005,
72
+ 0.01,
73
+ 0.025,
74
+ 0.05,
75
+ 0.075,
76
+ 0.1,
77
+ 0.25,
78
+ 0.5,
79
+ 0.75,
80
+ 1,
81
+ 2.5,
82
+ 5,
83
+ 7.5,
84
+ 10,
85
+ )
86
+
50
87
  # These lists represent attributes for metrics that are currently supported
51
88
 
52
89
  _client_duration_attrs_old = [
@@ -82,6 +82,14 @@ def _load_instrumentors(distro):
82
82
  exc.conflict,
83
83
  )
84
84
  continue
85
+ except ModuleNotFoundError as exc:
86
+ # ModuleNotFoundError is raised when the library is not installed
87
+ # and the instrumentation is not required to be loaded.
88
+ # See https://github.com/open-telemetry/opentelemetry-python-contrib/issues/3421
89
+ _logger.debug(
90
+ "Skipping instrumentation %s: %s", entry_point.name, exc.msg
91
+ )
92
+ continue
85
93
  except ImportError:
86
94
  # in scenarios using the kubernetes operator to do autoinstrumentation some
87
95
  # instrumentors (usually requiring binary extensions) may fail to load
@@ -26,199 +26,199 @@ libraries = [
26
26
  },
27
27
  {
28
28
  "library": "aio_pika >= 7.2.0, < 10.0.0",
29
- "instrumentation": "opentelemetry-instrumentation-aio-pika==0.53b0",
29
+ "instrumentation": "opentelemetry-instrumentation-aio-pika==0.54b0",
30
30
  },
31
31
  {
32
32
  "library": "aiohttp ~= 3.0",
33
- "instrumentation": "opentelemetry-instrumentation-aiohttp-client==0.53b0",
33
+ "instrumentation": "opentelemetry-instrumentation-aiohttp-client==0.54b0",
34
34
  },
35
35
  {
36
36
  "library": "aiohttp ~= 3.0",
37
- "instrumentation": "opentelemetry-instrumentation-aiohttp-server==0.53b0",
37
+ "instrumentation": "opentelemetry-instrumentation-aiohttp-server==0.54b0",
38
38
  },
39
39
  {
40
40
  "library": "aiokafka >= 0.8, < 1.0",
41
- "instrumentation": "opentelemetry-instrumentation-aiokafka==0.53b0",
41
+ "instrumentation": "opentelemetry-instrumentation-aiokafka==0.54b0",
42
42
  },
43
43
  {
44
44
  "library": "aiopg >= 0.13.0, < 2.0.0",
45
- "instrumentation": "opentelemetry-instrumentation-aiopg==0.53b0",
45
+ "instrumentation": "opentelemetry-instrumentation-aiopg==0.54b0",
46
46
  },
47
47
  {
48
48
  "library": "asgiref ~= 3.0",
49
- "instrumentation": "opentelemetry-instrumentation-asgi==0.53b0",
49
+ "instrumentation": "opentelemetry-instrumentation-asgi==0.54b0",
50
50
  },
51
51
  {
52
52
  "library": "asyncclick ~= 8.0",
53
- "instrumentation": "opentelemetry-instrumentation-asyncclick==0.53b0",
53
+ "instrumentation": "opentelemetry-instrumentation-asyncclick==0.54b0",
54
54
  },
55
55
  {
56
56
  "library": "asyncpg >= 0.12.0",
57
- "instrumentation": "opentelemetry-instrumentation-asyncpg==0.53b0",
57
+ "instrumentation": "opentelemetry-instrumentation-asyncpg==0.54b0",
58
58
  },
59
59
  {
60
60
  "library": "boto~=2.0",
61
- "instrumentation": "opentelemetry-instrumentation-boto==0.53b0",
61
+ "instrumentation": "opentelemetry-instrumentation-boto==0.54b0",
62
62
  },
63
63
  {
64
64
  "library": "boto3 ~= 1.0",
65
- "instrumentation": "opentelemetry-instrumentation-boto3sqs==0.53b0",
65
+ "instrumentation": "opentelemetry-instrumentation-boto3sqs==0.54b0",
66
66
  },
67
67
  {
68
68
  "library": "botocore ~= 1.0",
69
- "instrumentation": "opentelemetry-instrumentation-botocore==0.53b0",
69
+ "instrumentation": "opentelemetry-instrumentation-botocore==0.54b0",
70
70
  },
71
71
  {
72
72
  "library": "cassandra-driver ~= 3.25",
73
- "instrumentation": "opentelemetry-instrumentation-cassandra==0.53b0",
73
+ "instrumentation": "opentelemetry-instrumentation-cassandra==0.54b0",
74
74
  },
75
75
  {
76
76
  "library": "scylla-driver ~= 3.25",
77
- "instrumentation": "opentelemetry-instrumentation-cassandra==0.53b0",
77
+ "instrumentation": "opentelemetry-instrumentation-cassandra==0.54b0",
78
78
  },
79
79
  {
80
80
  "library": "celery >= 4.0, < 6.0",
81
- "instrumentation": "opentelemetry-instrumentation-celery==0.53b0",
81
+ "instrumentation": "opentelemetry-instrumentation-celery==0.54b0",
82
82
  },
83
83
  {
84
84
  "library": "click >= 8.1.3, < 9.0.0",
85
- "instrumentation": "opentelemetry-instrumentation-click==0.53b0",
85
+ "instrumentation": "opentelemetry-instrumentation-click==0.54b0",
86
86
  },
87
87
  {
88
88
  "library": "confluent-kafka >= 1.8.2, <= 2.7.0",
89
- "instrumentation": "opentelemetry-instrumentation-confluent-kafka==0.53b0",
89
+ "instrumentation": "opentelemetry-instrumentation-confluent-kafka==0.54b0",
90
90
  },
91
91
  {
92
92
  "library": "django >= 1.10",
93
- "instrumentation": "opentelemetry-instrumentation-django==0.53b0",
93
+ "instrumentation": "opentelemetry-instrumentation-django==0.54b0",
94
94
  },
95
95
  {
96
96
  "library": "elasticsearch >= 6.0",
97
- "instrumentation": "opentelemetry-instrumentation-elasticsearch==0.53b0",
97
+ "instrumentation": "opentelemetry-instrumentation-elasticsearch==0.54b0",
98
98
  },
99
99
  {
100
100
  "library": "falcon >= 1.4.1, < 5.0.0",
101
- "instrumentation": "opentelemetry-instrumentation-falcon==0.53b0",
101
+ "instrumentation": "opentelemetry-instrumentation-falcon==0.54b0",
102
102
  },
103
103
  {
104
104
  "library": "fastapi ~= 0.58",
105
- "instrumentation": "opentelemetry-instrumentation-fastapi==0.53b0",
105
+ "instrumentation": "opentelemetry-instrumentation-fastapi==0.54b0",
106
106
  },
107
107
  {
108
108
  "library": "flask >= 1.0",
109
- "instrumentation": "opentelemetry-instrumentation-flask==0.53b0",
109
+ "instrumentation": "opentelemetry-instrumentation-flask==0.54b0",
110
110
  },
111
111
  {
112
112
  "library": "grpcio >= 1.42.0",
113
- "instrumentation": "opentelemetry-instrumentation-grpc==0.53b0",
113
+ "instrumentation": "opentelemetry-instrumentation-grpc==0.54b0",
114
114
  },
115
115
  {
116
116
  "library": "httpx >= 0.18.0",
117
- "instrumentation": "opentelemetry-instrumentation-httpx==0.53b0",
117
+ "instrumentation": "opentelemetry-instrumentation-httpx==0.54b0",
118
118
  },
119
119
  {
120
120
  "library": "jinja2 >= 2.7, < 4.0",
121
- "instrumentation": "opentelemetry-instrumentation-jinja2==0.53b0",
121
+ "instrumentation": "opentelemetry-instrumentation-jinja2==0.54b0",
122
122
  },
123
123
  {
124
124
  "library": "kafka-python >= 2.0, < 3.0",
125
- "instrumentation": "opentelemetry-instrumentation-kafka-python==0.53b0",
125
+ "instrumentation": "opentelemetry-instrumentation-kafka-python==0.54b0",
126
126
  },
127
127
  {
128
128
  "library": "kafka-python-ng >= 2.0, < 3.0",
129
- "instrumentation": "opentelemetry-instrumentation-kafka-python==0.53b0",
129
+ "instrumentation": "opentelemetry-instrumentation-kafka-python==0.54b0",
130
130
  },
131
131
  {
132
132
  "library": "mysql-connector-python >= 8.0, < 10.0",
133
- "instrumentation": "opentelemetry-instrumentation-mysql==0.53b0",
133
+ "instrumentation": "opentelemetry-instrumentation-mysql==0.54b0",
134
134
  },
135
135
  {
136
136
  "library": "mysqlclient < 3",
137
- "instrumentation": "opentelemetry-instrumentation-mysqlclient==0.53b0",
137
+ "instrumentation": "opentelemetry-instrumentation-mysqlclient==0.54b0",
138
138
  },
139
139
  {
140
140
  "library": "pika >= 0.12.0",
141
- "instrumentation": "opentelemetry-instrumentation-pika==0.53b0",
141
+ "instrumentation": "opentelemetry-instrumentation-pika==0.54b0",
142
142
  },
143
143
  {
144
144
  "library": "psycopg >= 3.1.0",
145
- "instrumentation": "opentelemetry-instrumentation-psycopg==0.53b0",
145
+ "instrumentation": "opentelemetry-instrumentation-psycopg==0.54b0",
146
146
  },
147
147
  {
148
148
  "library": "psycopg2 >= 2.7.3.1",
149
- "instrumentation": "opentelemetry-instrumentation-psycopg2==0.53b0",
149
+ "instrumentation": "opentelemetry-instrumentation-psycopg2==0.54b0",
150
150
  },
151
151
  {
152
152
  "library": "psycopg2-binary >= 2.7.3.1",
153
- "instrumentation": "opentelemetry-instrumentation-psycopg2==0.53b0",
153
+ "instrumentation": "opentelemetry-instrumentation-psycopg2==0.54b0",
154
154
  },
155
155
  {
156
156
  "library": "pymemcache >= 1.3.5, < 5",
157
- "instrumentation": "opentelemetry-instrumentation-pymemcache==0.53b0",
157
+ "instrumentation": "opentelemetry-instrumentation-pymemcache==0.54b0",
158
158
  },
159
159
  {
160
160
  "library": "pymongo >= 3.1, < 5.0",
161
- "instrumentation": "opentelemetry-instrumentation-pymongo==0.53b0",
161
+ "instrumentation": "opentelemetry-instrumentation-pymongo==0.54b0",
162
162
  },
163
163
  {
164
164
  "library": "pymssql >= 2.1.5, < 3",
165
- "instrumentation": "opentelemetry-instrumentation-pymssql==0.53b0",
165
+ "instrumentation": "opentelemetry-instrumentation-pymssql==0.54b0",
166
166
  },
167
167
  {
168
168
  "library": "PyMySQL < 2",
169
- "instrumentation": "opentelemetry-instrumentation-pymysql==0.53b0",
169
+ "instrumentation": "opentelemetry-instrumentation-pymysql==0.54b0",
170
170
  },
171
171
  {
172
172
  "library": "pyramid >= 1.7",
173
- "instrumentation": "opentelemetry-instrumentation-pyramid==0.53b0",
173
+ "instrumentation": "opentelemetry-instrumentation-pyramid==0.54b0",
174
174
  },
175
175
  {
176
176
  "library": "redis >= 2.6",
177
- "instrumentation": "opentelemetry-instrumentation-redis==0.53b0",
177
+ "instrumentation": "opentelemetry-instrumentation-redis==0.54b0",
178
178
  },
179
179
  {
180
180
  "library": "remoulade >= 0.50",
181
- "instrumentation": "opentelemetry-instrumentation-remoulade==0.53b0",
181
+ "instrumentation": "opentelemetry-instrumentation-remoulade==0.54b0",
182
182
  },
183
183
  {
184
184
  "library": "requests ~= 2.0",
185
- "instrumentation": "opentelemetry-instrumentation-requests==0.53b0",
185
+ "instrumentation": "opentelemetry-instrumentation-requests==0.54b0",
186
186
  },
187
187
  {
188
188
  "library": "sqlalchemy >= 1.0.0, < 2.1.0",
189
- "instrumentation": "opentelemetry-instrumentation-sqlalchemy==0.53b0",
189
+ "instrumentation": "opentelemetry-instrumentation-sqlalchemy==0.54b0",
190
190
  },
191
191
  {
192
192
  "library": "starlette >= 0.13, <0.15",
193
- "instrumentation": "opentelemetry-instrumentation-starlette==0.53b0",
193
+ "instrumentation": "opentelemetry-instrumentation-starlette==0.54b0",
194
194
  },
195
195
  {
196
196
  "library": "psutil >= 5",
197
- "instrumentation": "opentelemetry-instrumentation-system-metrics==0.53b0",
197
+ "instrumentation": "opentelemetry-instrumentation-system-metrics==0.54b0",
198
198
  },
199
199
  {
200
200
  "library": "tornado >= 5.1.1",
201
- "instrumentation": "opentelemetry-instrumentation-tornado==0.53b0",
201
+ "instrumentation": "opentelemetry-instrumentation-tornado==0.54b0",
202
202
  },
203
203
  {
204
204
  "library": "tortoise-orm >= 0.17.0",
205
- "instrumentation": "opentelemetry-instrumentation-tortoiseorm==0.53b0",
205
+ "instrumentation": "opentelemetry-instrumentation-tortoiseorm==0.54b0",
206
206
  },
207
207
  {
208
208
  "library": "pydantic >= 1.10.2",
209
- "instrumentation": "opentelemetry-instrumentation-tortoiseorm==0.53b0",
209
+ "instrumentation": "opentelemetry-instrumentation-tortoiseorm==0.54b0",
210
210
  },
211
211
  {
212
212
  "library": "urllib3 >= 1.0.0, < 3.0.0",
213
- "instrumentation": "opentelemetry-instrumentation-urllib3==0.53b0",
213
+ "instrumentation": "opentelemetry-instrumentation-urllib3==0.54b0",
214
214
  },
215
215
  ]
216
216
  default_instrumentations = [
217
- "opentelemetry-instrumentation-asyncio==0.53b0",
218
- "opentelemetry-instrumentation-dbapi==0.53b0",
219
- "opentelemetry-instrumentation-logging==0.53b0",
220
- "opentelemetry-instrumentation-sqlite3==0.53b0",
221
- "opentelemetry-instrumentation-threading==0.53b0",
222
- "opentelemetry-instrumentation-urllib==0.53b0",
223
- "opentelemetry-instrumentation-wsgi==0.53b0",
217
+ "opentelemetry-instrumentation-asyncio==0.54b0",
218
+ "opentelemetry-instrumentation-dbapi==0.54b0",
219
+ "opentelemetry-instrumentation-logging==0.54b0",
220
+ "opentelemetry-instrumentation-sqlite3==0.54b0",
221
+ "opentelemetry-instrumentation-threading==0.54b0",
222
+ "opentelemetry-instrumentation-urllib==0.54b0",
223
+ "opentelemetry-instrumentation-wsgi==0.54b0",
224
224
  ]
@@ -111,9 +111,12 @@ class BaseInstrumentor(ABC):
111
111
  if not skip_dep_check:
112
112
  conflict = self._check_dependency_conflicts()
113
113
  if conflict:
114
- _LOG.error(conflict)
114
+ # auto-instrumentation path: don't log conflict as error, instead
115
+ # let _load_instrumentors handle the exception
115
116
  if raise_exception_on_conflict:
116
117
  raise DependencyConflictError(conflict)
118
+ # manual instrumentation path: log the conflict as error
119
+ _LOG.error(conflict)
117
120
  return None
118
121
 
119
122
  # initialize semantic conventions opt-in if needed
@@ -12,4 +12,4 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- __version__ = "0.53b0"
15
+ __version__ = "0.54b0"
@@ -326,11 +326,12 @@ class TestLoad(TestCase):
326
326
  ]
327
327
  )
328
328
 
329
+ @patch("opentelemetry.instrumentation.auto_instrumentation._load._logger")
329
330
  @patch(
330
331
  "opentelemetry.instrumentation.auto_instrumentation._load.entry_points"
331
332
  )
332
333
  def test_load_instrumentors_import_error_does_not_stop_everything(
333
- self, iter_mock
334
+ self, iter_mock, mock_logger
334
335
  ):
335
336
  ep_mock1 = Mock(name="instr1")
336
337
  ep_mock2 = Mock(name="instr2")
@@ -354,6 +355,12 @@ class TestLoad(TestCase):
354
355
  ]
355
356
  )
356
357
  self.assertEqual(distro_mock.load_instrumentor.call_count, 2)
358
+ mock_logger.exception.assert_any_call(
359
+ "Importing of %s failed, skipping it",
360
+ ep_mock1.name,
361
+ )
362
+
363
+ mock_logger.debug.assert_any_call("Instrumented %s", ep_mock2.name)
357
364
 
358
365
  @patch(
359
366
  "opentelemetry.instrumentation.auto_instrumentation._load.entry_points"
@@ -382,6 +389,46 @@ class TestLoad(TestCase):
382
389
  )
383
390
  self.assertEqual(distro_mock.load_instrumentor.call_count, 1)
384
391
 
392
+ @patch("opentelemetry.instrumentation.auto_instrumentation._load._logger")
393
+ @patch(
394
+ "opentelemetry.instrumentation.auto_instrumentation._load.entry_points"
395
+ )
396
+ def test_load_instrumentors_module_not_found_error(
397
+ self, iter_mock, mock_logger
398
+ ):
399
+ ep_mock1 = Mock()
400
+ ep_mock1.name = "instr1"
401
+
402
+ ep_mock2 = Mock()
403
+ ep_mock2.name = "instr2"
404
+
405
+ distro_mock = Mock()
406
+
407
+ distro_mock.load_instrumentor.side_effect = [
408
+ ModuleNotFoundError("No module named 'fake_module'"),
409
+ None,
410
+ ]
411
+
412
+ iter_mock.side_effect = [(), (ep_mock1, ep_mock2), ()]
413
+
414
+ _load._load_instrumentors(distro_mock)
415
+
416
+ distro_mock.load_instrumentor.assert_has_calls(
417
+ [
418
+ call(ep_mock1, raise_exception_on_conflict=True),
419
+ call(ep_mock2, raise_exception_on_conflict=True),
420
+ ]
421
+ )
422
+ self.assertEqual(distro_mock.load_instrumentor.call_count, 2)
423
+
424
+ mock_logger.debug.assert_any_call(
425
+ "Skipping instrumentation %s: %s",
426
+ "instr1",
427
+ "No module named 'fake_module'",
428
+ )
429
+
430
+ mock_logger.debug.assert_any_call("Instrumented %s", ep_mock2.name)
431
+
385
432
  def test_load_instrumentors_no_entry_point_mocks(self):
386
433
  distro_mock = Mock()
387
434
  _load._load_instrumentors(distro_mock)
@@ -54,11 +54,12 @@ class TestInstrumentor(TestCase):
54
54
  def test_singleton(self):
55
55
  self.assertIs(self.Instrumentor(), self.Instrumentor())
56
56
 
57
+ @patch("opentelemetry.instrumentation.instrumentor._LOG")
57
58
  @patch(
58
59
  "opentelemetry.instrumentation.instrumentor.BaseInstrumentor._check_dependency_conflicts"
59
60
  )
60
61
  def test_instrument_missing_dependency_raise(
61
- self, mock__check_dependency_conflicts
62
+ self, mock__check_dependency_conflicts, mock_logger
62
63
  ):
63
64
  instrumentor = self.Instrumentor()
64
65
 
@@ -71,3 +72,19 @@ class TestInstrumentor(TestCase):
71
72
  instrumentor.instrument,
72
73
  raise_exception_on_conflict=True,
73
74
  )
75
+ mock_logger.error.assert_not_called()
76
+
77
+ @patch("opentelemetry.instrumentation.instrumentor._LOG")
78
+ @patch(
79
+ "opentelemetry.instrumentation.instrumentor.BaseInstrumentor._check_dependency_conflicts"
80
+ )
81
+ def test_instrument_missing_dependency_log_error(
82
+ self, mock__check_dependency_conflicts, mock_logger
83
+ ):
84
+ instrumentor = self.Instrumentor()
85
+ conflict = DependencyConflict("missing", "missing")
86
+ mock__check_dependency_conflicts.return_value = conflict
87
+ self.assertIsNone(
88
+ instrumentor.instrument(raise_exception_on_conflict=False)
89
+ )
90
+ mock_logger.error.assert_any_call(conflict)