Skip to content

Commit fa9d8a1

Browse files
authored
fix: Don't send duplicate logs during orphan processing (#298)
1 parent 3c4b7f8 commit fa9d8a1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

bottlecap/src/logs/lambda/processor.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,9 @@ impl LambdaProcessor {
235235
LambdaProcessor::apply_rules(&self.rules, &mut log.message.message);
236236
if should_send_log {
237237
if let Ok(serialized_log) = serde_json::to_string(&log) {
238+
// explicitly drop log so we don't accidentally re-use it and push
239+
// duplicate logs to the aggregator
240+
drop(log);
238241
to_send.push(serialized_log);
239242
}
240243
}
@@ -244,7 +247,8 @@ impl LambdaProcessor {
244247
orphan_log.message.lambda.request_id =
245248
Some(self.invocation_context.request_id.clone());
246249
if should_send_log {
247-
if let Ok(serialized_log) = serde_json::to_string(&log) {
250+
if let Ok(serialized_log) = serde_json::to_string(&orphan_log) {
251+
drop(orphan_log);
248252
to_send.push(serialized_log);
249253
}
250254
}

0 commit comments

Comments
 (0)