Skip to content

[SLES-2877] fix(traces): try to pair universal instrumentation on request id for on-demand#1250

Open
shreyamalpani wants to merge 1 commit into
mainfrom
shreya.malpani/reset-execution-info
Open

[SLES-2877] fix(traces): try to pair universal instrumentation on request id for on-demand#1250
shreyamalpani wants to merge 1 commit into
mainfrom
shreya.malpani/reset-execution-info

Conversation

@shreyamalpani

@shreyamalpani shreyamalpani commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Overview

When the tracer sends the lambda-runtime-aws-request-id header (in the start-invocation and end-invocation requests), use request ID based pairing instead of FIFO for both UniversalInstrumentationStart and UniversalInstrumentationEnd in On Demand mode in addition to Managed Instance mode. FIFO pairing is preserved as a fallback for tracers that do not send the header.

Motivation: SLES-2877

@shreyamalpani shreyamalpani requested a review from a team as a code owner June 10, 2026 16:56
@datadog-datadog-prod-us1-2

datadog-datadog-prod-us1-2 Bot commented Jun 10, 2026

Copy link
Copy Markdown

Pipelines

Fix all issues with BitsAI

⚠️ Warnings

🚦 1 Pipeline job failed

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: 3ac3d72 | Docs | Datadog PR Page | Give us feedback!

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 updates the invocation lifecycle pairing logic so that when the tracer provides the lambda-runtime-aws-request-id header, UniversalInstrumentationStart / UniversalInstrumentationEnd are paired to the correct invocation using the request ID (instead of FIFO). This extends request-id pairing to On-Demand mode (in addition to Managed Instance mode) while keeping FIFO as a fallback for On-Demand when the header is absent.

Changes:

  • In on_invoke_event, try to consume a buffered UniversalInstrumentationStart by request_id before using On-Demand FIFO fallback.
  • In on_platform_runtime_done, try to consume a buffered UniversalInstrumentationEnd by request_id before using On-Demand FIFO fallback.
  • In on_universal_instrumentation_start / on_universal_instrumentation_end, use request-id-based pairing whenever the tracer supplies a request_id, and retain FIFO fallback behavior when it does not (with warnings in Managed Instance mode).

Comment on lines +222 to +227
// Both modes: check for buffered UniversalInstrumentationStart by request_id first.
// Falls back to FIFO for on-demand when the tracer does not send the header.
if let Some(buffered_event) = self
.context_buffer
.take_universal_instrumentation_start_for_request_id(&request_id)
{
@duncanista

Copy link
Copy Markdown
Contributor

Is there a fallback since old revisions of the SDK doesn't send the lambda-runtime-aws-request-id?

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.

3 participants