26
26
27
27
28
28
class TestAwsMetricAttributesSpanExporter (TestCase ):
29
-
30
29
def setUp (self ):
31
30
self .delegate_mock : SpanExporter = MagicMock ()
32
31
self .generator_mock : _AwsMetricAttributeGenerator = MagicMock ()
@@ -44,7 +43,7 @@ def test_export_delegation_without_attributes_or_modification(self):
44
43
span_attributes : Attributes = _build_span_attributes (_CONTAINS_NO_ATTRIBUTES )
45
44
span_data_mock : ReadableSpan = _build_readable_span_mock (span_attributes )
46
45
metric_attributes : Attributes = _build_metric_attributes (_CONTAINS_NO_ATTRIBUTES )
47
- self .__configure_mock_for_export (span_data_mock , metric_attributes )
46
+ self ._configure_mock_for_export (span_data_mock , metric_attributes )
48
47
49
48
self .aws_metric_attributes_span_exporter .export ([span_data_mock ])
50
49
self .delegate_mock .assert_has_calls ([call .export ([span_data_mock ])])
@@ -57,7 +56,7 @@ def test_export_delegation_with_attributes_but_without_modification(self):
57
56
span_attributes : Attributes = _build_span_attributes (_CONTAINS_ATTRIBUTES )
58
57
span_data_mock : ReadableSpan = _build_readable_span_mock (span_attributes )
59
58
metric_attributes : Attributes = _build_metric_attributes (_CONTAINS_NO_ATTRIBUTES )
60
- self .__configure_mock_for_export (span_data_mock , metric_attributes )
59
+ self ._configure_mock_for_export (span_data_mock , metric_attributes )
61
60
62
61
self .aws_metric_attributes_span_exporter .export ([span_data_mock ])
63
62
self .delegate_mock .assert_has_calls ([call .export ([span_data_mock ])])
@@ -70,7 +69,7 @@ def test_export_delegation_without_attributes_but_with_modification(self):
70
69
span_attributes : Attributes = _build_span_attributes (_CONTAINS_NO_ATTRIBUTES )
71
70
span_data_mock : ReadableSpan = _build_readable_span_mock (span_attributes )
72
71
metric_attributes : Attributes = _build_metric_attributes (_CONTAINS_ATTRIBUTES )
73
- self .__configure_mock_for_export (span_data_mock , metric_attributes )
72
+ self ._configure_mock_for_export (span_data_mock , metric_attributes )
74
73
75
74
self .aws_metric_attributes_span_exporter .export ([span_data_mock ])
76
75
self .delegate_mock .assert_has_calls ([call .export ([span_data_mock ])])
@@ -86,7 +85,7 @@ def test_export_delegation_with_attributes_and_modification(self):
86
85
span_attributes : Attributes = _build_span_attributes (_CONTAINS_ATTRIBUTES )
87
86
span_data_mock : ReadableSpan = _build_readable_span_mock (span_attributes )
88
87
metric_attributes : Attributes = _build_metric_attributes (_CONTAINS_ATTRIBUTES )
89
- self .__configure_mock_for_export (span_data_mock , metric_attributes )
88
+ self ._configure_mock_for_export (span_data_mock , metric_attributes )
90
89
91
90
self .aws_metric_attributes_span_exporter .export ([span_data_mock ])
92
91
self .delegate_mock .assert_has_calls ([call .export ([span_data_mock ])])
@@ -109,7 +108,7 @@ def test_export_delegation_with_multiple_spans(self):
109
108
span_data_mock3 : ReadableSpan = _build_readable_span_mock (_build_span_attributes (_CONTAINS_ATTRIBUTES ))
110
109
metric_attributes3 : Attributes = _build_metric_attributes (_CONTAINS_NO_ATTRIBUTES )
111
110
112
- self .__configure_mock_for_export_with_multiple_side_effect (
111
+ self ._configure_mock_for_export_with_multiple_side_effect (
113
112
[span_data_mock1 , span_data_mock2 , span_data_mock3 ],
114
113
[metric_attributes1 , metric_attributes2 , metric_attributes3 ],
115
114
)
@@ -141,7 +140,7 @@ def test_overridden_attributes(self):
141
140
"key1" : "new value1" ,
142
141
"key3" : "new value3" ,
143
142
}
144
- self .__configure_mock_for_export (span_data_mock , metric_attributes )
143
+ self ._configure_mock_for_export (span_data_mock , metric_attributes )
145
144
146
145
self .aws_metric_attributes_span_exporter .export ([span_data_mock ])
147
146
self .delegate_mock .assert_has_calls ([call .export ([span_data_mock ])])
@@ -156,7 +155,7 @@ def test_export_delegating_span_data_behaviour(self):
156
155
span_attributes = _build_span_attributes (_CONTAINS_ATTRIBUTES )
157
156
span_data_mock = _build_readable_span_mock_without_deepcopy_support (span_attributes )
158
157
metric_attributes = _build_metric_attributes (_CONTAINS_ATTRIBUTES )
159
- self .__configure_mock_for_export (span_data_mock , metric_attributes )
158
+ self ._configure_mock_for_export (span_data_mock , metric_attributes )
160
159
161
160
self .aws_metric_attributes_span_exporter .export ([span_data_mock ])
162
161
self .delegate_mock .assert_has_calls ([call .export ([span_data_mock ])])
@@ -311,7 +310,7 @@ def generate_metric_side_effect(span, resource):
311
310
for key , value in dependency_metric ._dict .items ():
312
311
self .assertEqual (exported_span ._attributes [key ], value )
313
312
314
- def __configure_mock_for_export (self , span_data_mock : ReadableSpan , metric_attributes : Attributes ):
313
+ def _configure_mock_for_export (self , span_data_mock : ReadableSpan , metric_attributes : Attributes ):
315
314
attribute_map : Attributes = {}
316
315
if should_generate_service_metric_attributes (span_data_mock ):
317
316
attribute_map [SERVICE_METRIC ] = copy .deepcopy (metric_attributes )
@@ -327,8 +326,8 @@ def generate_metric_attribute_map_side_effect(span, resource):
327
326
generate_metric_attribute_map_side_effect
328
327
)
329
328
330
- def __configure_mock_for_export_with_multiple_side_effect (
331
- self , span_data_mocks : [ReadableSpan ], metric_attributes_list : [Attributes ]
329
+ def _configure_mock_for_export_with_multiple_side_effect (
330
+ self , span_data_mocks : [ReadableSpan ], metric_attributes_list : [Attributes ]
332
331
):
333
332
attributes_map_list : list = []
334
333
for span in span_data_mocks :
@@ -372,7 +371,7 @@ def _build_readable_span_mock(span_attributes: Attributes) -> ReadableSpan:
372
371
373
372
def _build_readable_span_mock_without_deepcopy_support (span_attributes : Attributes ) -> ReadableSpan :
374
373
class NoDeepCopyMock (MagicMock ):
375
- def __deepcopy__ (self , memo ):
374
+ def _deepcopy_ (self , memo ):
376
375
return self
377
376
378
377
mock_span_data : ReadableSpan = NoDeepCopyMock ()
0 commit comments