Skip to content

Commit f6fdfc1

Browse files
authored
fix: cold start tag (#685)
Fixes #682 In #636 we changed this method and inserted the invocation into the context buffer before setting the init tags: [link](94cebb9#diff-689befe07a6fb7b65e3a7ed5c8949970e0fbbc74e0356f56ea8d829159ae5f14R119). Fix: ![image](https://github.com/user-attachments/assets/443c6776-b221-4247-b08e-70eefd802625) This caused the cold start logic to always return false, as it's looking for that buffer to be empty. A safer implementation could be to check if the length is 1 and the current request ID matches the item in the buffer, but this works.
1 parent f1fadd6 commit f6fdfc1

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

bottlecap/src/lifecycle/invocation/processor.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ impl Processor {
115115
pub fn on_invoke_event(&mut self, request_id: String) {
116116
let invocation_span =
117117
create_empty_span(String::from("aws.lambda"), &self.resource, &self.service);
118+
// Important! Call set_init_tags() before additing the invocation to the context buffer
119+
self.set_init_tags();
118120
self.context_buffer
119121
.start_context(&request_id, invocation_span);
120122

@@ -124,7 +126,6 @@ impl Processor {
124126
.as_secs()
125127
.try_into()
126128
.unwrap_or_default();
127-
self.set_init_tags();
128129

129130
if self.config.lambda_proc_enhanced_metrics {
130131
// Collect offsets for network and cpu metrics

0 commit comments

Comments
 (0)