5
5
from typing import List
6
6
from unittest .mock import MagicMock , patch
7
7
8
- from amazon .opentelemetry .distro .exporter .otlp .aws .logs .aws_batch_log_record_processor import (
8
+ from amazon .opentelemetry .distro .exporter .otlp .aws .logs ._aws_cw_otlp_batch_log_record_processor import (
9
9
AwsCloudWatchOtlpBatchLogRecordProcessor ,
10
10
BatchLogExportStrategy ,
11
11
)
@@ -117,7 +117,7 @@ def test_process_log_data_nested_structure_size_exceeds_max_log_size(self):
117
117
def test_process_log_data_primitive (self ):
118
118
119
119
primitives : List [AnyValue ] = ["test" , b"test" , 1 , 1.2 , True , False , None , "深入 Python" , "café" ]
120
- expected_sizes = [4 , 4 , 1 , 3 , 4 , 5 , 0 , 2 * 4 + len (" Python" ), 1 * 4 + len ("caf " )]
120
+ expected_sizes = [4 , 4 , 1 , 3 , 4 , 5 , 0 , 2 * 4 + len (" Python" ), 1 * 4 + len ("calf " )]
121
121
122
122
for index , primitive in enumerate (primitives ):
123
123
log = self .generate_test_log_data (log_body = primitive , count = 1 )
@@ -136,11 +136,11 @@ def test_process_log_data_with_cycle(self):
136
136
self .assertEqual (actual_size , expected_size )
137
137
138
138
@patch (
139
- "amazon.opentelemetry.distro.exporter.otlp.aws.logs.aws_batch_log_record_processor .attach" ,
139
+ "amazon.opentelemetry.distro.exporter.otlp.aws.logs._aws_cw_otlp_batch_log_record_processor .attach" ,
140
140
return_value = MagicMock (),
141
141
)
142
- @patch ("amazon.opentelemetry.distro.exporter.otlp.aws.logs.aws_batch_log_record_processor .detach" )
143
- @patch ("amazon.opentelemetry.distro.exporter.otlp.aws.logs.aws_batch_log_record_processor .set_value" )
142
+ @patch ("amazon.opentelemetry.distro.exporter.otlp.aws.logs._aws_cw_otlp_batch_log_record_processor .detach" )
143
+ @patch ("amazon.opentelemetry.distro.exporter.otlp.aws.logs._aws_cw_otlp_batch_log_record_processor .set_value" )
144
144
def test_export_single_batch_under_size_limit (self , _ , __ , ___ ):
145
145
"""Tests that export is only called once if a single batch is under the size limit"""
146
146
log_count = 10
@@ -163,11 +163,11 @@ def test_export_single_batch_under_size_limit(self, _, __, ___):
163
163
self .mock_exporter .export .assert_called_once ()
164
164
165
165
@patch (
166
- "amazon.opentelemetry.distro.exporter.otlp.aws.logs.aws_batch_log_record_processor .attach" ,
166
+ "amazon.opentelemetry.distro.exporter.otlp.aws.logs._aws_cw_otlp_batch_log_record_processor .attach" ,
167
167
return_value = MagicMock (),
168
168
)
169
- @patch ("amazon.opentelemetry.distro.exporter.otlp.aws.logs.aws_batch_log_record_processor .detach" )
170
- @patch ("amazon.opentelemetry.distro.exporter.otlp.aws.logs.aws_batch_log_record_processor .set_value" )
169
+ @patch ("amazon.opentelemetry.distro.exporter.otlp.aws.logs._aws_cw_otlp_batch_log_record_processor .detach" )
170
+ @patch ("amazon.opentelemetry.distro.exporter.otlp.aws.logs._aws_cw_otlp_batch_log_record_processor .set_value" )
171
171
def test_export_single_batch_all_logs_over_size_limit (self , _ , __ , ___ ):
172
172
"""Should make multiple export calls of batch size 1 to export logs of size > 1 MB."""
173
173
@@ -188,11 +188,11 @@ def test_export_single_batch_all_logs_over_size_limit(self, _, __, ___):
188
188
self .assertEqual (len (batch [0 ]), 1 )
189
189
190
190
@patch (
191
- "amazon.opentelemetry.distro.exporter.otlp.aws.logs.aws_batch_log_record_processor .attach" ,
191
+ "amazon.opentelemetry.distro.exporter.otlp.aws.logs._aws_cw_otlp_batch_log_record_processor .attach" ,
192
192
return_value = MagicMock (),
193
193
)
194
- @patch ("amazon.opentelemetry.distro.exporter.otlp.aws.logs.aws_batch_log_record_processor .detach" )
195
- @patch ("amazon.opentelemetry.distro.exporter.otlp.aws.logs.aws_batch_log_record_processor .set_value" )
194
+ @patch ("amazon.opentelemetry.distro.exporter.otlp.aws.logs._aws_cw_otlp_batch_log_record_processor .detach" )
195
+ @patch ("amazon.opentelemetry.distro.exporter.otlp.aws.logs._aws_cw_otlp_batch_log_record_processor .set_value" )
196
196
def test_export_single_batch_some_logs_over_size_limit (self , _ , __ , ___ ):
197
197
"""Should make calls to export smaller sub-batch logs"""
198
198
large_log_body = "X" * (self .processor ._MAX_LOG_REQUEST_BYTE_SIZE + 1 )
0 commit comments