Skip to content

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

Open
shreyamalpani wants to merge 3 commits into
mainfrom
shreya.malpani/fix-init-duration-metric
Open

fix(metrics): emit init duration metric on platform report as fallback#1253
shreyamalpani wants to merge 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 set the metric using 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

@datadog-prod-us1-4

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

Copy link
Copy Markdown

Pipelines

Fix all issues with BitsAI

⚠️ Warnings

🚦 2 Pipeline jobs failed

DataDog/datadog-lambda-extension | e2e-test-status (amd64)   View in Datadog   GitLab

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

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: aa29f22 | 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 Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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