Skip to content

Commit cb21d39

Browse files
committed
add comment about termination of loop
1 parent 93e2836 commit cb21d39

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

aws-opentelemetry-distro/src/amazon/opentelemetry/distro/exporter/otlp/aws/logs/otlp_aws_logs_exporter.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ def export(self, batch: Sequence[LogData]) -> LogExportResult:
6161
6262
Key behaviors:
6363
1. Always compresses data with gzip before sending
64-
2. Adds truncatable fields header for large Gen AI logs (>1MB)
65-
3. Implements Retry-After header support for throttling responses
64+
2. Implements Retry-After header support for throttling responses
6665
"""
6766

6867
if self._shutdown:
@@ -77,6 +76,11 @@ def export(self, batch: Sequence[LogData]) -> LogExportResult:
7776

7877
backoff = _create_exp_backoff_generator(max_value=self._MAX_RETRY_TIMEOUT)
7978

79+
# This loop will eventually terminate because:
80+
# 1) The export request will eventually either succeed or fail permanently
81+
# 2) The exponential backoff generator has a max value of _MAX_RETRY_TIMEOUT (64s)
82+
# 3) After enough retries, delay will equal _MAX_RETRY_TIMEOUT, forcing exit
83+
# 4) Non-retryable errors (4xx except 429) immediately exit the loop
8084
while True:
8185
resp = self._send(data)
8286

0 commit comments

Comments
 (0)