@@ -307,45 +307,32 @@ def attributes_get_side_effect(key):
307
307
308
308
self .assertTrue (is_consumer_process_span (self .span_data_mock ))
309
309
310
- # check that AWS SDK v1 SQS ReceiveMessage consumer spans metrics are suppressed
311
- def test_no_metric_attributes_for_sqs_consumer_span_aws_sdk_v1 (self ):
310
+ # check that boto3 SQS spans metrics are suppressed
311
+ def test_no_metric_attributes_for_boto3sqs_producer_span (self ):
312
312
instrumentation_scope_mock : InstrumentationScope = MagicMock ()
313
- instrumentation_scope_mock .name = "io. opentelemetry.aws-sdk-1.11 "
313
+ instrumentation_scope_mock .name = "opentelemetry.instrumentation.boto3sqs "
314
314
self .span_data_mock .instrumentation_scope = instrumentation_scope_mock
315
- self .span_data_mock .kind = SpanKind .CONSUMER
316
- self .span_data_mock .name = "SQS.ReceiveMessage "
315
+ self .span_data_mock .kind = SpanKind .PRODUCER
316
+ self .span_data_mock .name = "testQueue send "
317
317
self .assertFalse (should_generate_service_metric_attributes (self .span_data_mock ))
318
318
self .assertFalse (should_generate_dependency_metric_attributes (self .span_data_mock ))
319
319
320
- # check that AWS SDK v1 SQS ReceiveMessage consumer spans metrics are suppressed
321
- def test_no_metric_attributes_for_sqs_consumer_span_aws_sdk_v2 (self ):
320
+ def test_no_metric_attributes_for_boto3sqs_consumer_span (self ):
322
321
instrumentation_scope_mock : InstrumentationScope = MagicMock ()
323
- instrumentation_scope_mock .name = "io. opentelemetry.aws-sdk-2.2 "
322
+ instrumentation_scope_mock .name = "opentelemetry.instrumentation.boto3sqs "
324
323
self .span_data_mock .instrumentation_scope = instrumentation_scope_mock
325
324
self .span_data_mock .kind = SpanKind .CONSUMER
326
- self .span_data_mock .name = "SQS.ReceiveMessage"
325
+ self .span_data_mock .name = "testQueue receive"
326
+
327
327
self .assertFalse (should_generate_service_metric_attributes (self .span_data_mock ))
328
328
self .assertFalse (should_generate_dependency_metric_attributes (self .span_data_mock ))
329
329
330
- # check that SQS ReceiveMessage consumer spans metrics are still generated for other instrumentation
331
- def test_metric_attributes_generated_for_other_instrumentation_sqs_consumer_span (self ):
330
+ def test_no_metric_attributes_for_boto3sqs_process_span (self ):
332
331
instrumentation_scope_info_mock = MagicMock ()
333
- instrumentation_scope_info_mock .name = "my- instrumentation"
332
+ instrumentation_scope_info_mock .name = "opentelemetry. instrumentation.boto3sqs "
334
333
self .span_data_mock .instrumentation_scope = instrumentation_scope_info_mock
335
334
self .span_data_mock .kind = SpanKind .CONSUMER
336
- self .span_data_mock .name = "Sqs.ReceiveMessage"
337
-
338
- self .assertTrue (should_generate_service_metric_attributes (self .span_data_mock ))
339
- self .assertTrue (should_generate_dependency_metric_attributes (self .span_data_mock ))
340
-
341
- # check that SQS ReceiveMessage consumer span metrics are suppressed if messaging operation
342
- # is process and not receive
343
- def test_no_metric_attributes_for_aws_sdk_sqs_consumer_process_span (self ):
344
- instrumentation_scope_info_mock = MagicMock ()
345
- instrumentation_scope_info_mock .name = "io.opentelemetry.aws-sdk-2.2"
346
- self .span_data_mock .instrumentation_scope = instrumentation_scope_info_mock
347
- self .span_data_mock .kind = SpanKind .CONSUMER
348
- self .span_data_mock .name = "Sqs.ReceiveMessage"
335
+ self .span_data_mock .name = "testQueue process"
349
336
350
337
def attributes_get_side_effect_process (key ):
351
338
if key == SpanAttributes .MESSAGING_OPERATION :
@@ -358,12 +345,14 @@ def attributes_get_side_effect_process(key):
358
345
self .assertFalse (should_generate_service_metric_attributes (self .span_data_mock ))
359
346
self .assertFalse (should_generate_dependency_metric_attributes (self .span_data_mock ))
360
347
361
- def attributes_get_side_effect_receive (key ):
362
- if key == SpanAttributes .MESSAGING_OPERATION :
363
- return MessagingOperationValues .RECEIVE
364
- return None
348
+ # check that consumer spans metrics are still generated for other instrumentation
349
+ def test_metric_attributes_generated_for_instrumentation_other_than_boto3sqs (self ):
350
+ instrumentation_scope_info_mock = MagicMock ()
351
+ instrumentation_scope_info_mock .name = "my-instrumentation"
352
+ self .span_data_mock .instrumentation_scope = instrumentation_scope_info_mock
353
+ self .span_data_mock .kind = SpanKind .CONSUMER
354
+ self .span_data_mock .name = "testQueue receive"
365
355
366
- self .attributes_mock .get .side_effect = attributes_get_side_effect_receive
367
356
self .assertTrue (should_generate_service_metric_attributes (self .span_data_mock ))
368
357
self .assertTrue (should_generate_dependency_metric_attributes (self .span_data_mock ))
369
358
0 commit comments