opentelemetry-instrumentation-botocore 0.45b0__tar.gz → 0.47b0__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 (22) hide show
  1. {opentelemetry_instrumentation_botocore-0.45b0 → opentelemetry_instrumentation_botocore-0.47b0}/.gitignore +3 -0
  2. {opentelemetry_instrumentation_botocore-0.45b0 → opentelemetry_instrumentation_botocore-0.47b0}/LICENSE +1 -1
  3. {opentelemetry_instrumentation_botocore-0.45b0 → opentelemetry_instrumentation_botocore-0.47b0}/PKG-INFO +4 -3
  4. {opentelemetry_instrumentation_botocore-0.45b0 → opentelemetry_instrumentation_botocore-0.47b0}/pyproject.toml +3 -2
  5. {opentelemetry_instrumentation_botocore-0.45b0 → opentelemetry_instrumentation_botocore-0.47b0}/src/opentelemetry/instrumentation/botocore/__init__.py +1 -1
  6. {opentelemetry_instrumentation_botocore-0.45b0 → opentelemetry_instrumentation_botocore-0.47b0}/src/opentelemetry/instrumentation/botocore/extensions/lmbd.py +3 -3
  7. {opentelemetry_instrumentation_botocore-0.45b0 → opentelemetry_instrumentation_botocore-0.47b0}/src/opentelemetry/instrumentation/botocore/extensions/sns.py +3 -3
  8. {opentelemetry_instrumentation_botocore-0.45b0 → opentelemetry_instrumentation_botocore-0.47b0}/src/opentelemetry/instrumentation/botocore/extensions/sqs.py +3 -3
  9. {opentelemetry_instrumentation_botocore-0.45b0 → opentelemetry_instrumentation_botocore-0.47b0}/src/opentelemetry/instrumentation/botocore/version.py +1 -1
  10. {opentelemetry_instrumentation_botocore-0.45b0 → opentelemetry_instrumentation_botocore-0.47b0}/tests/test_botocore_dynamodb.py +38 -22
  11. {opentelemetry_instrumentation_botocore-0.45b0 → opentelemetry_instrumentation_botocore-0.47b0}/tests/test_botocore_instrumentation.py +27 -35
  12. {opentelemetry_instrumentation_botocore-0.45b0 → opentelemetry_instrumentation_botocore-0.47b0}/tests/test_botocore_lambda.py +4 -4
  13. {opentelemetry_instrumentation_botocore-0.45b0 → opentelemetry_instrumentation_botocore-0.47b0}/tests/test_botocore_sns.py +5 -5
  14. {opentelemetry_instrumentation_botocore-0.45b0 → opentelemetry_instrumentation_botocore-0.47b0}/tests/test_botocore_sqs.py +5 -5
  15. {opentelemetry_instrumentation_botocore-0.45b0 → opentelemetry_instrumentation_botocore-0.47b0}/README.rst +0 -0
  16. {opentelemetry_instrumentation_botocore-0.45b0 → opentelemetry_instrumentation_botocore-0.47b0}/src/opentelemetry/instrumentation/botocore/extensions/__init__.py +0 -0
  17. {opentelemetry_instrumentation_botocore-0.45b0 → opentelemetry_instrumentation_botocore-0.47b0}/src/opentelemetry/instrumentation/botocore/extensions/_messaging.py +0 -0
  18. {opentelemetry_instrumentation_botocore-0.45b0 → opentelemetry_instrumentation_botocore-0.47b0}/src/opentelemetry/instrumentation/botocore/extensions/dynamodb.py +0 -0
  19. {opentelemetry_instrumentation_botocore-0.45b0 → opentelemetry_instrumentation_botocore-0.47b0}/src/opentelemetry/instrumentation/botocore/extensions/types.py +0 -0
  20. {opentelemetry_instrumentation_botocore-0.45b0 → opentelemetry_instrumentation_botocore-0.47b0}/src/opentelemetry/instrumentation/botocore/package.py +0 -0
  21. {opentelemetry_instrumentation_botocore-0.45b0 → opentelemetry_instrumentation_botocore-0.47b0}/tests/__init__.py +0 -0
  22. {opentelemetry_instrumentation_botocore-0.45b0 → opentelemetry_instrumentation_botocore-0.47b0}/tests/test_botocore_messaging.py +0 -0
@@ -58,3 +58,6 @@ _build/
58
58
  # mypy
59
59
  .mypy_cache/
60
60
  target
61
+
62
+ # Benchmark result files
63
+ *-benchmark.json
@@ -186,7 +186,7 @@
186
186
  same "printed page" as the copyright notice for easier
187
187
  identification within third-party archives.
188
188
 
189
- Copyright The OpenTelemetry Authors
189
+ Copyright [yyyy] [name of copyright owner]
190
190
 
191
191
  Licensed under the Apache License, Version 2.0 (the "License");
192
192
  you may not use this file except in compliance with the License.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: opentelemetry-instrumentation-botocore
3
- Version: 0.45b0
3
+ Version: 0.47b0
4
4
  Summary: OpenTelemetry Botocore instrumentation
5
5
  Project-URL: Homepage, https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/instrumentation/opentelemetry-instrumentation-botocore
6
6
  Author-email: OpenTelemetry Authors <cncf-opentelemetry-contributors@lists.cncf.io>
@@ -15,11 +15,12 @@ Classifier: Programming Language :: Python :: 3.8
15
15
  Classifier: Programming Language :: Python :: 3.9
16
16
  Classifier: Programming Language :: Python :: 3.10
17
17
  Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
18
19
  Requires-Python: >=3.8
19
20
  Requires-Dist: opentelemetry-api~=1.12
20
- Requires-Dist: opentelemetry-instrumentation==0.45b0
21
+ Requires-Dist: opentelemetry-instrumentation==0.47b0
21
22
  Requires-Dist: opentelemetry-propagator-aws-xray==1.0.1
22
- Requires-Dist: opentelemetry-semantic-conventions==0.45b0
23
+ Requires-Dist: opentelemetry-semantic-conventions==0.47b0
23
24
  Provides-Extra: instruments
24
25
  Requires-Dist: botocore~=1.0; extra == 'instruments'
25
26
  Description-Content-Type: text/x-rst
@@ -22,11 +22,12 @@ classifiers = [
22
22
  "Programming Language :: Python :: 3.9",
23
23
  "Programming Language :: Python :: 3.10",
24
24
  "Programming Language :: Python :: 3.11",
25
+ "Programming Language :: Python :: 3.12",
25
26
  ]
26
27
  dependencies = [
27
28
  "opentelemetry-api ~= 1.12",
28
- "opentelemetry-instrumentation == 0.45b0",
29
- "opentelemetry-semantic-conventions == 0.45b0",
29
+ "opentelemetry-instrumentation == 0.47b0",
30
+ "opentelemetry-semantic-conventions == 0.47b0",
30
31
  "opentelemetry-propagator-aws-xray == 1.0.1",
31
32
  ]
32
33
 
@@ -51,7 +51,7 @@ tracer_provider (TracerProvider) - an optional tracer provider
51
51
  request_hook (Callable) - a function with extra user-defined logic to be performed before performing the request
52
52
  this function signature is: def request_hook(span: Span, service_name: str, operation_name: str, api_params: dict) -> None
53
53
  response_hook (Callable) - a function with extra user-defined logic to be performed after performing the request
54
- this function signature is: def request_hook(span: Span, service_name: str, operation_name: str, result: dict) -> None
54
+ this function signature is: def response_hook(span: Span, service_name: str, operation_name: str, result: dict) -> None
55
55
 
56
56
  for example:
57
57
 
@@ -62,9 +62,9 @@ class _OpInvoke(_LambdaOperation):
62
62
  cls, call_context: _AwsSdkCallContext, attributes: _AttributeMapT
63
63
  ):
64
64
  attributes[SpanAttributes.FAAS_INVOKED_PROVIDER] = "aws"
65
- attributes[
66
- SpanAttributes.FAAS_INVOKED_NAME
67
- ] = cls._parse_function_name(call_context)
65
+ attributes[SpanAttributes.FAAS_INVOKED_NAME] = (
66
+ cls._parse_function_name(call_context)
67
+ )
68
68
  attributes[SpanAttributes.FAAS_INVOKED_REGION] = call_context.region
69
69
 
70
70
  @classmethod
@@ -76,9 +76,9 @@ class _OpPublish(_SnsOperation):
76
76
  destination_name, is_phone_number = cls._extract_destination_name(
77
77
  call_context
78
78
  )
79
- attributes[
80
- SpanAttributes.MESSAGING_DESTINATION_KIND
81
- ] = MessagingDestinationKindValues.TOPIC.value
79
+ attributes[SpanAttributes.MESSAGING_DESTINATION_KIND] = (
80
+ MessagingDestinationKindValues.TOPIC.value
81
+ )
82
82
  attributes[SpanAttributes.MESSAGING_DESTINATION] = destination_name
83
83
 
84
84
  # TODO: Use SpanAttributes.MESSAGING_DESTINATION_NAME when opentelemetry-semantic-conventions 0.42b0 is released
@@ -35,9 +35,9 @@ class _SqsExtension(_AwsSdkExtension):
35
35
  attributes[SpanAttributes.MESSAGING_SYSTEM] = "aws.sqs"
36
36
  attributes[SpanAttributes.MESSAGING_URL] = queue_url
37
37
  try:
38
- attributes[
39
- SpanAttributes.MESSAGING_DESTINATION
40
- ] = queue_url.split("/")[-1]
38
+ attributes[SpanAttributes.MESSAGING_DESTINATION] = (
39
+ queue_url.split("/")[-1]
40
+ )
41
41
  except IndexError:
42
42
  _logger.error(
43
43
  "Could not extract messaging destination from '%s'",
@@ -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.45b0"
15
+ __version__ = "0.47b0"
@@ -16,7 +16,7 @@ import json
16
16
  from unittest import mock
17
17
 
18
18
  import botocore.session
19
- from moto import mock_dynamodb2 # pylint: disable=import-error
19
+ from moto import mock_aws # pylint: disable=import-error
20
20
 
21
21
  from opentelemetry.instrumentation.botocore import BotocoreInstrumentor
22
22
  from opentelemetry.instrumentation.botocore.extensions.dynamodb import (
@@ -184,7 +184,7 @@ class TestDynamoDbExtension(TestBase):
184
184
  )
185
185
  self.assert_item_col_metrics(span)
186
186
 
187
- @mock_dynamodb2
187
+ @mock_aws
188
188
  def test_batch_get_item(self):
189
189
  table_name1 = "test_table1"
190
190
  table_name2 = "test_table2"
@@ -203,7 +203,7 @@ class TestDynamoDbExtension(TestBase):
203
203
  self.assert_table_names(span, table_name1, table_name2)
204
204
  self.assert_consumed_capacity(span, table_name1, table_name2)
205
205
 
206
- @mock_dynamodb2
206
+ @mock_aws
207
207
  def test_batch_write_item(self):
208
208
  table_name1 = "test_table1"
209
209
  table_name2 = "test_table2"
@@ -224,7 +224,7 @@ class TestDynamoDbExtension(TestBase):
224
224
  self.assert_consumed_capacity(span, table_name1, table_name2)
225
225
  self.assert_item_col_metrics(span)
226
226
 
227
- @mock_dynamodb2
227
+ @mock_aws
228
228
  def test_create_table(self):
229
229
  local_sec_idx = {
230
230
  "IndexName": "local_sec_idx",
@@ -268,7 +268,7 @@ class TestDynamoDbExtension(TestBase):
268
268
  )
269
269
  self.assert_provisioned_read_cap(span, 42)
270
270
 
271
- @mock_dynamodb2
271
+ @mock_aws
272
272
  def test_delete_item(self):
273
273
  self._create_prepared_table()
274
274
 
@@ -297,7 +297,7 @@ class TestDynamoDbExtension(TestBase):
297
297
  def test_delete_item_item_collection_metrics(self):
298
298
  self.assert_extension_item_col_metrics("DeleteItem")
299
299
 
300
- @mock_dynamodb2
300
+ @mock_aws
301
301
  def test_delete_table(self):
302
302
  self._create_prepared_table()
303
303
 
@@ -306,7 +306,7 @@ class TestDynamoDbExtension(TestBase):
306
306
  span = self.assert_span("DeleteTable")
307
307
  self.assert_table_names(span, self.default_table_name)
308
308
 
309
- @mock_dynamodb2
309
+ @mock_aws
310
310
  def test_describe_table(self):
311
311
  self._create_prepared_table()
312
312
 
@@ -315,26 +315,42 @@ class TestDynamoDbExtension(TestBase):
315
315
  span = self.assert_span("DescribeTable")
316
316
  self.assert_table_names(span, self.default_table_name)
317
317
 
318
- @mock_dynamodb2
319
- def test_get_item(self):
318
+ @mock_aws
319
+ def test_get_item_expression(self):
320
320
  self._create_prepared_table()
321
321
 
322
322
  self.client.get_item(
323
323
  TableName=self.default_table_name,
324
324
  Key={"id": {"S": "1"}},
325
325
  ConsistentRead=True,
326
- AttributesToGet=["id"],
327
- ProjectionExpression="1,2",
326
+ ProjectionExpression="PE",
327
+ ReturnConsumedCapacity="TOTAL",
328
+ )
329
+
330
+ span = self.assert_span("GetItem")
331
+ self.assert_table_names(span, self.default_table_name)
332
+ self.assert_consistent_read(span, True)
333
+ self.assert_consumed_capacity(span, self.default_table_name)
334
+
335
+ @mock_aws
336
+ def test_get_item_non_expression(self):
337
+ self._create_prepared_table()
338
+
339
+ self.client.get_item(
340
+ TableName=self.default_table_name,
341
+ Key={"id": {"S": "1"}},
342
+ ConsistentRead=True,
343
+ ProjectionExpression="PE",
328
344
  ReturnConsumedCapacity="TOTAL",
329
345
  )
330
346
 
331
347
  span = self.assert_span("GetItem")
332
348
  self.assert_table_names(span, self.default_table_name)
333
349
  self.assert_consistent_read(span, True)
334
- self.assert_projection(span, "1,2")
350
+ self.assert_projection(span, "PE")
335
351
  self.assert_consumed_capacity(span, self.default_table_name)
336
352
 
337
- @mock_dynamodb2
353
+ @mock_aws
338
354
  def test_list_tables(self):
339
355
  self._create_table(TableName="my_table")
340
356
  self._create_prepared_table()
@@ -351,7 +367,7 @@ class TestDynamoDbExtension(TestBase):
351
367
  )
352
368
  self.assertEqual(5, span.attributes[SpanAttributes.AWS_DYNAMODB_LIMIT])
353
369
 
354
- @mock_dynamodb2
370
+ @mock_aws
355
371
  def test_put_item(self):
356
372
  table = "test_table"
357
373
  self._create_prepared_table(TableName=table)
@@ -372,7 +388,7 @@ class TestDynamoDbExtension(TestBase):
372
388
  def test_put_item_item_collection_metrics(self):
373
389
  self.assert_extension_item_col_metrics("PutItem")
374
390
 
375
- @mock_dynamodb2
391
+ @mock_aws
376
392
  def test_query(self):
377
393
  self._create_prepared_table()
378
394
 
@@ -390,7 +406,7 @@ class TestDynamoDbExtension(TestBase):
390
406
  }
391
407
  },
392
408
  ScanIndexForward=True,
393
- ProjectionExpression="1,2",
409
+ ProjectionExpression="PE",
394
410
  ReturnConsumedCapacity="TOTAL",
395
411
  )
396
412
 
@@ -403,11 +419,11 @@ class TestDynamoDbExtension(TestBase):
403
419
  self.assert_consistent_read(span, True)
404
420
  self.assert_index_name(span, "lsi")
405
421
  self.assert_limit(span, 42)
406
- self.assert_projection(span, "1,2")
422
+ self.assert_projection(span, "PE")
407
423
  self.assert_select(span, "ALL_ATTRIBUTES")
408
424
  self.assert_consumed_capacity(span, self.default_table_name)
409
425
 
410
- @mock_dynamodb2
426
+ @mock_aws
411
427
  def test_scan(self):
412
428
  self._create_prepared_table()
413
429
 
@@ -419,7 +435,7 @@ class TestDynamoDbExtension(TestBase):
419
435
  Select="ALL_ATTRIBUTES",
420
436
  TotalSegments=17,
421
437
  Segment=21,
422
- ProjectionExpression="1,2",
438
+ ProjectionExpression="PE",
423
439
  ConsistentRead=True,
424
440
  ReturnConsumedCapacity="TOTAL",
425
441
  )
@@ -440,11 +456,11 @@ class TestDynamoDbExtension(TestBase):
440
456
  self.assert_consistent_read(span, True)
441
457
  self.assert_index_name(span, "lsi")
442
458
  self.assert_limit(span, 42)
443
- self.assert_projection(span, "1,2")
459
+ self.assert_projection(span, "PE")
444
460
  self.assert_select(span, "ALL_ATTRIBUTES")
445
461
  self.assert_consumed_capacity(span, self.default_table_name)
446
462
 
447
- @mock_dynamodb2
463
+ @mock_aws
448
464
  def test_update_item(self):
449
465
  self._create_prepared_table()
450
466
 
@@ -465,7 +481,7 @@ class TestDynamoDbExtension(TestBase):
465
481
  def test_update_item_item_collection_metrics(self):
466
482
  self.assert_extension_item_col_metrics("UpdateItem")
467
483
 
468
- @mock_dynamodb2
484
+ @mock_aws
469
485
  def test_update_table(self):
470
486
  self._create_prepared_table()
471
487
 
@@ -12,19 +12,11 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
  import json
15
- from unittest.mock import Mock, patch
15
+ from unittest.mock import ANY, Mock, patch
16
16
 
17
17
  import botocore.session
18
18
  from botocore.exceptions import ParamValidationError
19
- from moto import ( # pylint: disable=import-error
20
- mock_ec2,
21
- mock_kinesis,
22
- mock_kms,
23
- mock_s3,
24
- mock_sqs,
25
- mock_sts,
26
- mock_xray,
27
- )
19
+ from moto import mock_aws # pylint: disable=import-error
28
20
 
29
21
  from opentelemetry import trace as trace_api
30
22
  from opentelemetry.instrumentation.botocore import BotocoreInstrumentor
@@ -39,7 +31,7 @@ from opentelemetry.test.mock_textmap import MockTextMapPropagator
39
31
  from opentelemetry.test.test_base import TestBase
40
32
  from opentelemetry.trace.span import format_span_id, format_trace_id
41
33
 
42
- _REQUEST_ID_REGEX_MATCH = r"[A-Z0-9]{52}"
34
+ _REQUEST_ID_REGEX_MATCH = r"[A-Za-z0-9]{52}"
43
35
 
44
36
 
45
37
  # pylint:disable=too-many-public-methods
@@ -102,7 +94,7 @@ class TestBotocoreInstrumentor(TestBase):
102
94
  self.assertEqual(f"{service}.{operation}", span.name)
103
95
  return span
104
96
 
105
- @mock_ec2
97
+ @mock_aws
106
98
  def test_traced_client(self):
107
99
  ec2 = self._make_client("ec2")
108
100
 
@@ -111,7 +103,7 @@ class TestBotocoreInstrumentor(TestBase):
111
103
  request_id = "fdcdcab1-ae5c-489e-9c33-4637c5dda355"
112
104
  self.assert_span("EC2", "DescribeInstances", request_id=request_id)
113
105
 
114
- @mock_ec2
106
+ @mock_aws
115
107
  def test_not_recording(self):
116
108
  mock_tracer = Mock()
117
109
  mock_span = Mock()
@@ -126,7 +118,7 @@ class TestBotocoreInstrumentor(TestBase):
126
118
  self.assertFalse(mock_span.set_attribute.called)
127
119
  self.assertFalse(mock_span.set_status.called)
128
120
 
129
- @mock_s3
121
+ @mock_aws
130
122
  def test_exception(self):
131
123
  s3 = self._make_client("s3")
132
124
 
@@ -149,14 +141,14 @@ class TestBotocoreInstrumentor(TestBase):
149
141
  self.assertIn(SpanAttributes.EXCEPTION_TYPE, event.attributes)
150
142
  self.assertIn(SpanAttributes.EXCEPTION_MESSAGE, event.attributes)
151
143
 
152
- @mock_s3
144
+ @mock_aws
153
145
  def test_s3_client(self):
154
146
  s3 = self._make_client("s3")
155
147
 
156
148
  s3.list_buckets()
157
149
  self.assert_span("S3", "ListBuckets")
158
150
 
159
- @mock_s3
151
+ @mock_aws
160
152
  def test_s3_put(self):
161
153
  s3 = self._make_client("s3")
162
154
 
@@ -174,7 +166,7 @@ class TestBotocoreInstrumentor(TestBase):
174
166
  s3.get_object(Bucket="mybucket", Key="foo")
175
167
  self.assert_span("S3", "GetObject", request_id=_REQUEST_ID_REGEX_MATCH)
176
168
 
177
- @mock_sqs
169
+ @mock_aws
178
170
  def test_sqs_client(self):
179
171
  sqs = self._make_client("sqs")
180
172
 
@@ -184,7 +176,7 @@ class TestBotocoreInstrumentor(TestBase):
184
176
  "SQS", "ListQueues", request_id=_REQUEST_ID_REGEX_MATCH
185
177
  )
186
178
 
187
- @mock_sqs
179
+ @mock_aws
188
180
  def test_sqs_send_message(self):
189
181
  sqs = self._make_client("sqs")
190
182
  test_queue_name = "test_queue_name"
@@ -205,14 +197,14 @@ class TestBotocoreInstrumentor(TestBase):
205
197
  attributes={"aws.queue_url": queue_url},
206
198
  )
207
199
 
208
- @mock_kinesis
200
+ @mock_aws
209
201
  def test_kinesis_client(self):
210
202
  kinesis = self._make_client("kinesis")
211
203
 
212
204
  kinesis.list_streams()
213
205
  self.assert_span("Kinesis", "ListStreams")
214
206
 
215
- @mock_kinesis
207
+ @mock_aws
216
208
  def test_unpatch(self):
217
209
  kinesis = self._make_client("kinesis")
218
210
 
@@ -221,7 +213,7 @@ class TestBotocoreInstrumentor(TestBase):
221
213
  kinesis.list_streams()
222
214
  self.assertEqual(0, len(self.memory_exporter.get_finished_spans()))
223
215
 
224
- @mock_ec2
216
+ @mock_aws
225
217
  def test_uninstrument_does_not_inject_headers(self):
226
218
  headers = {}
227
219
 
@@ -240,7 +232,7 @@ class TestBotocoreInstrumentor(TestBase):
240
232
 
241
233
  self.assertNotIn(TRACE_HEADER_KEY, headers)
242
234
 
243
- @mock_sqs
235
+ @mock_aws
244
236
  def test_double_patch(self):
245
237
  sqs = self._make_client("sqs")
246
238
 
@@ -252,19 +244,19 @@ class TestBotocoreInstrumentor(TestBase):
252
244
  "SQS", "ListQueues", request_id=_REQUEST_ID_REGEX_MATCH
253
245
  )
254
246
 
255
- @mock_kms
247
+ @mock_aws
256
248
  def test_kms_client(self):
257
249
  kms = self._make_client("kms")
258
250
 
259
251
  kms.list_keys(Limit=21)
260
252
 
261
253
  span = self.assert_only_span()
254
+ expected = self._default_span_attributes("KMS", "ListKeys")
255
+ expected["aws.request_id"] = ANY
262
256
  # check for exact attribute set to make sure not to leak any kms secrets
263
- self.assertEqual(
264
- self._default_span_attributes("KMS", "ListKeys"), span.attributes
265
- )
257
+ self.assertEqual(expected, dict(span.attributes))
266
258
 
267
- @mock_sts
259
+ @mock_aws
268
260
  def test_sts_client(self):
269
261
  sts = self._make_client("sts")
270
262
 
@@ -272,11 +264,11 @@ class TestBotocoreInstrumentor(TestBase):
272
264
 
273
265
  span = self.assert_only_span()
274
266
  expected = self._default_span_attributes("STS", "GetCallerIdentity")
275
- expected["aws.request_id"] = "c6104cbe-af31-11e0-8154-cbc7ccf896c7"
267
+ expected["aws.request_id"] = ANY
276
268
  # check for exact attribute set to make sure not to leak any sts secrets
277
- self.assertEqual(expected, span.attributes)
269
+ self.assertEqual(expected, dict(span.attributes))
278
270
 
279
- @mock_ec2
271
+ @mock_aws
280
272
  def test_propagator_injects_into_request(self):
281
273
  headers = {}
282
274
  previous_propagator = get_global_textmap()
@@ -316,7 +308,7 @@ class TestBotocoreInstrumentor(TestBase):
316
308
  finally:
317
309
  set_global_textmap(previous_propagator)
318
310
 
319
- @mock_ec2
311
+ @mock_aws
320
312
  def test_override_xray_propagator_injects_into_request(self):
321
313
  headers = {}
322
314
 
@@ -335,7 +327,7 @@ class TestBotocoreInstrumentor(TestBase):
335
327
  self.assertNotIn(MockTextMapPropagator.TRACE_ID_KEY, headers)
336
328
  self.assertNotIn(MockTextMapPropagator.SPAN_ID_KEY, headers)
337
329
 
338
- @mock_xray
330
+ @mock_aws
339
331
  def test_suppress_instrumentation_xray_client(self):
340
332
  xray_client = self._make_client("xray")
341
333
  with suppress_instrumentation():
@@ -343,7 +335,7 @@ class TestBotocoreInstrumentor(TestBase):
343
335
  xray_client.put_trace_segments(TraceSegmentDocuments=["str2"])
344
336
  self.assertEqual(0, len(self.get_finished_spans()))
345
337
 
346
- @mock_xray
338
+ @mock_aws
347
339
  def test_suppress_http_instrumentation_xray_client(self):
348
340
  xray_client = self._make_client("xray")
349
341
  with suppress_http_instrumentation():
@@ -351,7 +343,7 @@ class TestBotocoreInstrumentor(TestBase):
351
343
  xray_client.put_trace_segments(TraceSegmentDocuments=["str2"])
352
344
  self.assertEqual(2, len(self.get_finished_spans()))
353
345
 
354
- @mock_s3
346
+ @mock_aws
355
347
  def test_request_hook(self):
356
348
  request_hook_service_attribute_name = "request_hook.service_name"
357
349
  request_hook_operation_attribute_name = "request_hook.operation_name"
@@ -386,7 +378,7 @@ class TestBotocoreInstrumentor(TestBase):
386
378
  },
387
379
  )
388
380
 
389
- @mock_s3
381
+ @mock_aws
390
382
  def test_response_hook(self):
391
383
  response_hook_service_attribute_name = "request_hook.service_name"
392
384
  response_hook_operation_attribute_name = "response_hook.operation_name"
@@ -19,7 +19,7 @@ import zipfile
19
19
  from unittest import mock
20
20
 
21
21
  import botocore.session
22
- from moto import mock_iam, mock_lambda # pylint: disable=import-error
22
+ from moto import mock_aws # pylint: disable=import-error
23
23
  from pytest import mark
24
24
 
25
25
  from opentelemetry.instrumentation.botocore import BotocoreInstrumentor
@@ -96,12 +96,12 @@ class TestLambdaExtension(TestBase):
96
96
  mock_call_context = mock.MagicMock(operation=operation, params={})
97
97
  return _LambdaExtension(mock_call_context)
98
98
 
99
- @mock_lambda
99
+ @mock_aws
100
100
  def test_list_functions(self):
101
101
  self.client.list_functions()
102
102
  self.assert_span("ListFunctions")
103
103
 
104
- @mock_iam
104
+ @mock_aws
105
105
  def _create_role_and_get_arn(self) -> str:
106
106
  return self.iam_client.create_role(
107
107
  RoleName="my-role",
@@ -131,7 +131,7 @@ class TestLambdaExtension(TestBase):
131
131
  sys.platform == "win32",
132
132
  reason="requires docker and Github CI Windows does not have docker installed by default",
133
133
  )
134
- @mock_lambda
134
+ @mock_aws
135
135
  def test_invoke(self):
136
136
  previous_propagator = get_global_textmap()
137
137
  try:
@@ -18,7 +18,7 @@ from unittest import mock
18
18
 
19
19
  import botocore.session
20
20
  from botocore.awsrequest import AWSResponse
21
- from moto import mock_sns
21
+ from moto import mock_aws
22
22
 
23
23
  from opentelemetry.instrumentation.botocore import BotocoreInstrumentor
24
24
  from opentelemetry.semconv.trace import (
@@ -91,11 +91,11 @@ class TestSnsExtension(TestBase):
91
91
  self.assertEqual(span_context.trace_id, int(trace_parent[1], 16))
92
92
  self.assertEqual(span_context.span_id, int(trace_parent[2], 16))
93
93
 
94
- @mock_sns
94
+ @mock_aws
95
95
  def test_publish_to_topic_arn(self):
96
96
  self._test_publish_to_arn("TopicArn")
97
97
 
98
- @mock_sns
98
+ @mock_aws
99
99
  def test_publish_to_target_arn(self):
100
100
  self._test_publish_to_arn("TargetArn")
101
101
 
@@ -125,7 +125,7 @@ class TestSnsExtension(TestBase):
125
125
  span.attributes["messaging.destination.name"],
126
126
  )
127
127
 
128
- @mock_sns
128
+ @mock_aws
129
129
  def test_publish_to_phone_number(self):
130
130
  phone_number = "+10000000000"
131
131
  self.client.publish(
@@ -138,7 +138,7 @@ class TestSnsExtension(TestBase):
138
138
  phone_number, span.attributes[SpanAttributes.MESSAGING_DESTINATION]
139
139
  )
140
140
 
141
- @mock_sns
141
+ @mock_aws
142
142
  def test_publish_injects_span(self):
143
143
  message_attrs = {}
144
144
  topic_arn = self._create_topic()
@@ -1,5 +1,5 @@
1
1
  import botocore.session
2
- from moto import mock_sqs
2
+ from moto import mock_aws
3
3
 
4
4
  from opentelemetry.instrumentation.botocore import BotocoreInstrumentor
5
5
  from opentelemetry.semconv.trace import SpanAttributes
@@ -22,7 +22,7 @@ class TestSqsExtension(TestBase):
22
22
  super().tearDown()
23
23
  BotocoreInstrumentor().uninstrument()
24
24
 
25
- @mock_sqs
25
+ @mock_aws
26
26
  def test_sqs_messaging_send_message(self):
27
27
  create_queue_result = self.client.create_queue(
28
28
  QueueName="test_queue_name"
@@ -51,7 +51,7 @@ class TestSqsExtension(TestBase):
51
51
  response["MessageId"],
52
52
  )
53
53
 
54
- @mock_sqs
54
+ @mock_aws
55
55
  def test_sqs_messaging_send_message_batch(self):
56
56
  create_queue_result = self.client.create_queue(
57
57
  QueueName="test_queue_name"
@@ -85,7 +85,7 @@ class TestSqsExtension(TestBase):
85
85
  response["Successful"][0]["MessageId"],
86
86
  )
87
87
 
88
- @mock_sqs
88
+ @mock_aws
89
89
  def test_sqs_messaging_receive_message(self):
90
90
  create_queue_result = self.client.create_queue(
91
91
  QueueName="test_queue_name"
@@ -116,7 +116,7 @@ class TestSqsExtension(TestBase):
116
116
  message_result["Messages"][0]["MessageId"],
117
117
  )
118
118
 
119
- @mock_sqs
119
+ @mock_aws
120
120
  def test_sqs_messaging_failed_operation(self):
121
121
  with self.assertRaises(Exception):
122
122
  self.client.send_message(