Skip to content

fix(metrics): emit init duration metric on platform report as fallback#1253

Merged
shreyamalpani merged 3 commits into
mainfrom
shreya.malpani/fix-init-duration-metric
Jun 16, 2026
Merged

fix(metrics): emit init duration metric on platform report as fallback#1253
shreyamalpani merged 3 commits into
mainfrom
shreya.malpani/fix-init-duration-metric

Conversation

@shreyamalpani

@shreyamalpani shreyamalpani commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Overview

The init duration metric is sent on the PlatformInitReport event. In the case of this event not being received / arriving late, this PR adds a fallback to use the init duration from the PlatformReport event on cold start invocations in On Demand mode.

Motivation

Saw failures on emitting the init duration metric in E2E tests.

Testing

Added unit tests and E2E tests no longer fail on sending the init duration metric on this PR.

@datadog-prod-us1-4

datadog-prod-us1-4 Bot commented Jun 12, 2026

Copy link
Copy Markdown

Pipelines

Fix all issues with BitsAI

⚠️ Warnings

🚦 4 Pipeline jobs failed

DataDog/datadog-lambda-extension | bottlecap (arm64, fips, alpine)   View in Datadog   GitLab

DataDog/datadog-lambda-extension | integration-suite: [oom]   View in Datadog   GitLab

DataDog/datadog-lambda-extension | bottlecap (amd64, fips)   View in Datadog   GitLab

View all 4 failed jobs.

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 9ae4d86 | Docs | Datadog PR Page | Give us feedback!

@shreyamalpani
shreyamalpani marked this pull request as ready for review June 12, 2026 02:55
Copilot AI review requested due to automatic review settings June 12, 2026 02:55
@shreyamalpani
shreyamalpani requested a review from a team as a code owner June 12, 2026 02:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR ensures the init duration enhanced metric is emitted reliably on on-demand cold starts by adding a platform.report-based fallback when platform.initReport is missing or arrives late, while preventing double emission.

Changes:

  • Track whether the init duration metric has already been emitted for the current sandbox (init_duration_metric_emitted).
  • Emit init duration from platform.report’s init_duration_ms as a fallback when needed, and skip subsequent emission from platform.initReport.
  • Add targeted tests covering emission from init report, fallback from report, warm invocations, and double-emission prevention.

Comment thread bottlecap/src/lifecycle/invocation/processor.rs
Comment thread bottlecap/src/lifecycle/invocation/processor.rs
Comment thread bottlecap/src/lifecycle/invocation/processor.rs
@shreyamalpani
shreyamalpani force-pushed the shreya.malpani/fix-init-duration-metric branch from aa29f22 to 9ae4d86 Compare June 16, 2026 15:44
@shreyamalpani
shreyamalpani merged commit fbac55b into main Jun 16, 2026
57 of 59 checks passed
@shreyamalpani
shreyamalpani deleted the shreya.malpani/fix-init-duration-metric branch June 16, 2026 17:16
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.

4 participants