Skip to content

feat(bottlecap): add Cold Start Span + Tags#450

Merged
duncanista merged 19 commits intojordan.gonzalez/bottlecap/universal-instrumentationfrom
jordan.gonzalez/bottlecap/cold-start-span
Nov 15, 2024
Merged

feat(bottlecap): add Cold Start Span + Tags#450
duncanista merged 19 commits intojordan.gonzalez/bottlecap/universal-instrumentationfrom
jordan.gonzalez/bottlecap/cold-start-span

Conversation

@duncanista
Copy link
Copy Markdown
Contributor

@duncanista duncanista commented Nov 12, 2024

What?

  • Creates an aws.lambda.cold_start span on Cold Starts (or proactive inits), adds the correct tags to the aws.lambda span for cold starts.
  • Adds tags for cold start to enhanced metrics

image
image

How?

  • Calculate cold start span given the telemetry API events.
  • Calculate the cold start / proactive init based on the invoke.
  • Adding a set of dynamic value tags for enhanced metrics, so we can append the cold start or proactive init tags.

Notes

  • ContextBuffer now doesn't remove on on_platform_report, instead, we held all invocations and await for the 6th one to remove some space. This is so we can calculate properly the tags on cold start.

@duncanista duncanista changed the base branch from main to jordan.gonzalez/bottlecap/universal-instrumentation November 12, 2024 22:42
@duncanista duncanista marked this pull request as ready for review November 13, 2024 21:40
@duncanista duncanista requested a review from a team as a code owner November 13, 2024 21:40
self.enhanced_metrics.set_report_log_metrics(&metrics);

if let Some(context) = self.context_buffer.remove(request_id) {
if let Some(context) = self.context_buffer.get(request_id) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing a get since I wanna make sure that only when the buffer is empty, we can calculate the init tags correctly

…to jordan.gonzalez/bottlecap/cold-start-span
@duncanista duncanista merged commit 81d1d62 into jordan.gonzalez/bottlecap/universal-instrumentation Nov 15, 2024
@duncanista duncanista deleted the jordan.gonzalez/bottlecap/cold-start-span branch November 15, 2024 00:51
duncanista added a commit that referenced this pull request Nov 15, 2024
* add some helper functions to `invocation::lifecycle` mod

* create cold start span on processor

* move `generate_span_id` to father module

* send `platform_init_start` data to processor

* send `PlatformInitStart` to main bus

* update cold start `parent_id`

* fix start time of cold start span

* enhanced metrics now have a `dynamic_value_tags` for tags which we have to calculate at points in time

* `AwsConfig` now has a `sandbox_init_time` value

* add `is_empty` to `ContextBuffer`

* calculate init tags on invoke

also add a method to reset processor invocation state

* restart init tags on set

* set tags properly for proactive init

* fix unit test

* remove debug line

* make sure `cold_start` tag is only set in one place
duncanista added a commit that referenced this pull request Nov 19, 2024
* add some helper functions to `invocation::lifecycle` mod

* create cold start span on processor

* move `generate_span_id` to father module

* send `platform_init_start` data to processor

* send `PlatformInitStart` to main bus

* update cold start `parent_id`

* fix start time of cold start span

* enhanced metrics now have a `dynamic_value_tags` for tags which we have to calculate at points in time

* `AwsConfig` now has a `sandbox_init_time` value

* add `is_empty` to `ContextBuffer`

* calculate init tags on invoke

also add a method to reset processor invocation state

* restart init tags on set

* set tags properly for proactive init

* fix unit test

* remove debug line

* make sure `cold_start` tag is only set in one place
duncanpharvey pushed a commit that referenced this pull request Mar 10, 2026
* add some helper functions to `invocation::lifecycle` mod

* create cold start span on processor

* move `generate_span_id` to father module

* send `platform_init_start` data to processor

* send `PlatformInitStart` to main bus

* update cold start `parent_id`

* fix start time of cold start span

* enhanced metrics now have a `dynamic_value_tags` for tags which we have to calculate at points in time

* `AwsConfig` now has a `sandbox_init_time` value

* add `is_empty` to `ContextBuffer`

* calculate init tags on invoke

also add a method to reset processor invocation state

* restart init tags on set

* set tags properly for proactive init

* fix unit test

* remove debug line

* make sure `cold_start` tag is only set in one place
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants