Skip to content

feat(runtime): refresh MicroVM identity - #19939

Draft
litianningdatadog wants to merge 1 commit into
tianning.li/2-wsgi-asgi-integrationfrom
tianning.li/3-wsgi-asgi-integration-based-refresh
Draft

feat(runtime): refresh MicroVM identity#19939
litianningdatadog wants to merge 1 commit into
tianning.li/2-wsgi-asgi-integrationfrom
tianning.li/3-wsgi-asgi-integration-based-refresh

Conversation

@litianningdatadog

Copy link
Copy Markdown
Contributor

Description

Refreshes AWS Lambda MicroVM stable identity when WSGI/ASGI applications start handling requests, and notifies identity-bound consumers so runtime ID and Remote Config client IDs can be refreshed.

Stacked on #19898.

Testing

  • Added/updated tests in tests/tracer/runtime/test_runtime_id.py, tests/contrib/wsgi/test_wsgi.py, and tests/contrib/asgi/test_asgi.py.
  • Not run in this session; opening as a draft PR.

Risks

Runtime identity refresh timing changes in the AWS Lambda MicroVM path; regular non-MicroVM paths should remain unchanged.

Additional Notes

Release note included in releasenotes/notes/aws-lambda-microvm-identity-refresh-3a672cd6bcbad16d.yaml.

@datadog-datadog-prod-us1-2

datadog-datadog-prod-us1-2 Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Pipelines  Tests

Unblock PR with BitsAI

⚠️ Warnings

Your PR has failed checks. Please review the issues below and take necessary action before merging.

🚦 6 Pipeline jobs failed

DataDog/apm-reliability/dd-trace-py | build linux serverless: [amd64, cp315-cp315, v113741238-d2b8243-manylinux2014_x86_64, 1] — 🔧 Needs a code fix, caused by this PR

View more details · View in GitLab

DataDog/apm-reliability/dd-trace-py | build linux serverless: [arm64, cp315-cp315, v113741357-d2b8243-manylinux2014_aarch64, 1] — 🔧 Needs a code fix, caused by this PR

View more details · View in GitLab

DataDog/apm-reliability/dd-trace-py | build linux: [amd64, cp315-cp315, v113741238-d2b8243-manylinux2014_x86_64] — 🔧 Needs a code fix, caused by this PR

View more details · View in GitLab

View all 6 failed jobs.

ℹ️ Info

No other issues found (see more)

🧪 All tests passed
❄️ No new flaky tests detected

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 73d9d64 | Docs | View more details | Give us feedback!

@cit-pr-commenter-54b7da

Copy link
Copy Markdown

Dependency direction analysis

🚨 New dependency direction violations detected 🚨

1 new violation(s) of the dependency direction rules have been introduced by this PR:

ddtrace.contrib.internal.web -×-> ddtrace.internal.runtime  (contrib -> product:runtime, score=15)

ddtrace.internal and ddtrace.contrib must not depend on product code, and products must not depend on each other directly. See the dependency-direction-analysis skill for how to fix this.

📈 Existing violations got worse

10 pre-existing violation(s) increased in severity (e.g. their target became more depended-on, or got pulled into an import cycle), though the edge itself isn't new:

Show violations that got worse (showing 5 of 10 highest severity)
ddtrace.internal.remoteconfig.client -×-> ddtrace.internal.runtime  (internal-core -> product:runtime, score=16, +2 vs base)
ddtrace.internal.core.crashtracking -×-> ddtrace.internal.runtime  (internal-core -> product:runtime, score=16, +2 vs base)
ddtrace.internal.symbol_db.symbols -×-> ddtrace.internal.runtime  (internal-core -> product:runtime, score=16, +2 vs base)
ddtrace._trace.tracer -×-> ddtrace.internal.runtime  (product:tracing -> product:runtime, score=14, +2 vs base)
ddtrace.internal.writer.writer -×-> ddtrace.internal.runtime  (internal-core -> product:runtime, score=16, +2 vs base)

To see all violations, download the layers-base.json and layers-pr.json artifacts from this CI job and run:

uv run --script scripts/import-analysis/layers.py compare layers-base.json layers-pr.json

⚠️ Existing dependency direction violations

There are 250 dependency direction violations that already exist on the base branch and have not been changed by this PR.

Show existing violations (showing 5 of 250 highest severity)
ddtrace.internal.tracemethods -×-> ddtrace.trace  (internal-core -> product:tracing, score=135)
ddtrace.debugging._signal.tracing -×-> ddtrace.trace  (product:debugging -> product:tracing, score=133)
ddtrace.llmobs._integrations.llama_index -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=133)
ddtrace.debugging._debugger -×-> ddtrace.trace  (product:debugging -> product:tracing, score=133)
ddtrace.llmobs._integrations.langchain -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=133)

To see all violations, download the layers-base.json and layers-pr.json artifacts from this CI job and run:

uv run --script scripts/import-analysis/layers.py compare layers-base.json layers-pr.json

@cit-pr-commenter-54b7da

Copy link
Copy Markdown

Circular import analysis

⚠️ Existing circular imports

There are 3 circular imports that already exist on the base branch and have not been changed by this PR.

ddtrace.llmobs -> ddtrace.llmobs._evaluators -> ddtrace.llmobs._evaluators.format -> ddtrace.llmobs._experiment -> ddtrace.llmobs
ddtrace.errortracking._handled_exceptions.bytecode_injector -> ddtrace.errortracking._handled_exceptions.callbacks -> ddtrace.errortracking._handled_exceptions.collector -> ddtrace.errortracking._handled_exceptions.bytecode_reporting -> ddtrace.errortracking._handled_exceptions.bytecode_injector
ddtrace.appsec._asm_request_context -> ddtrace.appsec._iast._iast_request_context_base -> ddtrace.appsec._iast._iast_env -> ddtrace.appsec._iast.reporter -> ddtrace.appsec._exploit_prevention.stack_traces -> ddtrace.appsec._asm_request_context

@cit-pr-commenter-54b7da

Copy link
Copy Markdown

Codeowners resolved as

Resolved from the full PR diff against tianning.li/2-wsgi-asgi-integration using the target branch CODEOWNERS file.
CODEOWNERS team requests not listed below are not required by the current file set.

ddtrace/__init__.py                                                     @DataDog/python-guild
ddtrace/contrib/_events/web_framework.py                                @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/contrib/internal/web.py                                         @DataDog/apm-core-python @DataDog/apm-idm-python
ddtrace/internal/runtime/__init__.py                                    @DataDog/apm-sdk-capabilities-python
releasenotes/notes/aws-lambda-microvm-identity-refresh-3a672cd6bcbad16d.yaml  @DataDog/apm-python
tests/contrib/asgi/test_asgi.py                                         @DataDog/apm-core-python @DataDog/apm-idm-python
tests/contrib/wsgi/test_wsgi.py                                         @DataDog/apm-core-python @DataDog/apm-idm-python
tests/tracer/runtime/test_runtime_id.py                                 @DataDog/apm-sdk-capabilities-python

@pr-commenter

pr-commenter Bot commented Aug 28, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-08-28 20:33:28

Comparing candidate commit 73d9d64 in PR branch tianning.li/3-wsgi-asgi-integration-based-refresh with baseline commit 3bb9ecd in branch main.

📊 Benchmarking dashboard

Found 0 performance improvements and 9 performance regressions! Performance is the same for 609 metrics, 10 unstable metrics.

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

scenario:httppropagationextract-wsgi_valid_headers_all

  • 🟥 execution_time [+421.938ns; +457.475ns] or [+7.866%; +8.528%]

scenario:httppropagationinject-ids_only

  • 🟥 execution_time [+2.006µs; +2.131µs] or [+10.650%; +11.310%]

scenario:iastaspects-add_aspect

  • 🟥 execution_time [+20.339µs; +23.578µs] or [+20.668%; +23.959%]

scenario:iastaspects-upper_aspect

  • 🟥 execution_time [+64.442µs; +70.185µs] or [+28.397%; +30.927%]

scenario:iastaspectsospath-ospathbasename_aspect

  • 🟥 execution_time [+141.744µs; +150.809µs] or [+36.836%; +39.192%]

scenario:iastaspectssplit-rsplit_aspect

  • 🟥 execution_time [+25.408µs; +29.402µs] or [+19.032%; +22.024%]

scenario:span-start

  • 🟥 execution_time [+1.622ms; +1.770ms] or [+11.149%; +12.164%]

scenario:telemetryaddmetric-1-count-metric-1-times

  • 🟥 execution_time [+434.138ns; +493.474ns] or [+15.954%; +18.135%]

scenario:tracer-small

  • 🟥 execution_time [+28.722µs; +31.048µs] or [+8.856%; +9.574%]

Unstable benchmarks

These benchmarks have a confidence interval too wide to call a change; treat them as noise rather than signal.

scenario:coreapiscenario-context_with_data_listeners

  • unstable execution_time [-796.821ns; +683.836ns] or [-7.175%; +6.157%]

scenario:coreapiscenario-core_dispatch_1_listener

  • unstable execution_time [-31.226ns; +35.139ns] or [-5.143%; +5.787%]

scenario:coreapiscenario-core_dispatch_50_listeners

  • unstable execution_time [-1758.055ns; +1585.680ns] or [-10.224%; +9.222%]

scenario:coreapiscenario-core_dispatch_exception_listeners

  • unstable execution_time [-1398.267ns; +1090.271ns] or [-10.704%; +8.346%]

scenario:coreapiscenario-core_dispatch_listeners

  • unstable execution_time [-322.602ns; +335.493ns] or [-8.753%; +9.103%]

scenario:coreapiscenario-core_dispatch_no_args_listeners

  • unstable execution_time [-262.801ns; +243.332ns] or [-9.006%; +8.338%]

scenario:coreapiscenario-core_dispatch_with_results_1_listener

  • unstable execution_time [-72.049ns; +77.132ns] or [-6.338%; +6.785%]

scenario:coreapiscenario-core_dispatch_with_results_50_listeners

  • unstable execution_time [-4049.129ns; +3760.215ns] or [-10.128%; +9.406%]

scenario:coreapiscenario-core_dispatch_with_results_listeners

  • unstable execution_time [-805.078ns; +725.235ns] or [-10.001%; +9.009%]

scenario:packagesupdateimporteddependencies-import_many_stdlib_cached

  • unstable execution_time [-64.265µs; +56.649µs] or [-9.969%; +8.787%]

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.

1 participant