You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: aws-opentelemetry-distro/src/amazon/opentelemetry/distro/exporter/otlp/aws/logs/_aws_cw_otlp_batch_log_record_processor.py
+44-7Lines changed: 44 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -136,10 +136,33 @@ def _estimate_log_size(self, log: LogData, depth: int = 3) -> int: # pylint: di
136
136
"""
137
137
Estimates the size in bytes of a log by calculating the size of its body and its attributes
138
138
and adding a buffer amount to account for other log metadata information.
139
-
Will process complex log structures up to the specified depth limit.
140
-
Includes cycle detection to prevent processing the log content more than once.
141
-
If the depth limit of the log structure is exceeded, returns the truncated calculation
142
-
to everything up to that point.
139
+
140
+
Features:
141
+
- Processes complex log structures up to the specified depth limit
142
+
- Includes cycle detection to prevent processing the same content more than once
143
+
- Returns truncated calculation if depth limit is exceeded
144
+
145
+
We set depth to 3 as this is the minimum required depth to estimate our consolidated Gen AI log events:
146
+
147
+
Example structure:
148
+
{
149
+
"output": {
150
+
"messages": [
151
+
{
152
+
"content": "Hello, World!",
153
+
"role": "assistant"
154
+
}
155
+
]
156
+
},
157
+
"input": {
158
+
"messages": [
159
+
{
160
+
"content": "Say Hello, World!",
161
+
"role": "user"
162
+
}
163
+
]
164
+
}
165
+
}
143
166
144
167
Args:
145
168
log: The Log object to calculate size for
@@ -175,12 +198,12 @@ def _estimate_log_size(self, log: LogData, depth: int = 3) -> int: # pylint: di
Copy file name to clipboardExpand all lines: aws-opentelemetry-distro/tests/amazon/opentelemetry/distro/exporter/otlp/aws/common/test_aws_auth_session.py
Copy file name to clipboardExpand all lines: aws-opentelemetry-distro/tests/amazon/opentelemetry/distro/exporter/otlp/aws/logs/test_aws_cw_otlp_batch_log_record_processor.py
Copy file name to clipboardExpand all lines: aws-opentelemetry-distro/tests/amazon/opentelemetry/distro/exporter/otlp/aws/logs/test_otlp_aws_logs_exporter.py
0 commit comments