Skip to content

chore(runtime): refresh runtime metric identity tags - #19822

Draft
litianningdatadog wants to merge 1 commit into
tianning.li/2-flask-web-request-starting-eventfrom
tianning.li/3-5-runtime-metrics-identity-refresh
Draft

chore(runtime): refresh runtime metric identity tags#19822
litianningdatadog wants to merge 1 commit into
tianning.li/2-flask-web-request-starting-eventfrom
tianning.li/3-5-runtime-metrics-identity-refresh

Conversation

@litianningdatadog

Copy link
Copy Markdown
Contributor

Description

Split from #19780.

Runtime metrics cache platform tags that include runtime identity. Refresh those tags when runtime identity changes so metrics emitted after a MicroVM /run refresh use the new runtime id.

Testing

  • scripts/lint format_check ddtrace/internal/runtime/runtime_metrics.py tests/runtime/test_runtime_metrics_api.py
  • git diff --check

Stack

Draft split branch. Stacked on #19816.

@litianningdatadog litianningdatadog added changelog/no-changelog A changelog entry is not required for this PR. aws-microvm Work related to AWS MicroVM onboarding labels Aug 23, 2026
@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

Dependency direction analysis

📈 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.symbol_db.symbols -×-> ddtrace.internal.runtime  (internal-core -> product:runtime, score=15, +1 vs base)
ddtrace.internal.ci_visibility.writer -×-> ddtrace.internal.runtime  (product:ci_visibility -> product:runtime, score=13, +1 vs base)
ddtrace._trace.tracer -×-> ddtrace.internal.runtime  (product:tracing -> product:runtime, score=13, +1 vs base)
ddtrace.internal.remoteconfig.client -×-> ddtrace.internal.runtime  (internal-core -> product:runtime, score=15, +1 vs base)
ddtrace.internal.telemetry.writer -×-> ddtrace.internal.runtime  (internal-core -> product:runtime, score=15, +1 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.internal.ci_visibility.api._base -×-> ddtrace.trace  (product:ci_visibility -> product:tracing, score=133)
ddtrace.llmobs._integrations.openai_agents -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=133)
ddtrace.profiling.scheduler -×-> ddtrace.trace  (product:profiling -> product:tracing, score=133)
ddtrace.llmobs._integrations.bedrock -×-> 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

Codeowners resolved as

Resolved from the full PR diff against tianning.li/2-flask-web-request-starting-event using the target branch CODEOWNERS file.
CODEOWNERS team requests not listed below are not required by the current file set.

ddtrace/internal/runtime/runtime_metrics.py                             @DataDog/apm-sdk-capabilities-python
tests/runtime/test_runtime_metrics_api.py                               @DataDog/apm-sdk-capabilities-python

@litianningdatadog litianningdatadog changed the title fix(runtime): refresh runtime metric identity tags chore(runtime): refresh runtime metric identity tags Aug 23, 2026
@datadog-prod-us1-4

datadog-prod-us1-4 Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Pipelines  Tests

⚠️ Warnings

🚦 6 Pipeline jobs failed

Changelog | Validate changelog

View in Datadog · View in GitHub Actions

Release note not found for this PR. Please add one or apply the 'no-changelog' label.

DataDog/apm-reliability/dd-trace-py | build linux serverless: [amd64, cp315-cp315, v113741238-d2b8243-manylinux2014_x86_64, 1]

View in Datadog · View in GitLab

DataDog/apm-reliability/dd-trace-py | build linux serverless: [arm64, cp315-cp315, v113741357-d2b8243-manylinux2014_aarch64, 1]

View in Datadog · 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: d6a1546 | Docs | View more details | Give us feedback!

@pr-commenter

pr-commenter Bot commented Aug 23, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-08-23 22:23:47

Comparing candidate commit d6a1546 in PR branch tianning.li/3-5-runtime-metrics-identity-refresh with baseline commit d59e112 in branch tianning.li/2-flask-web-request-starting-event.

📊 Benchmarking dashboard

Found 0 performance improvements and 9 performance regressions! Performance is the same for 613 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:httppropagationinject-ids_only

  • 🟥 execution_time [+1.947µs; +2.099µs] or [+10.129%; +10.917%]

scenario:iastaspects-add_aspect

  • 🟥 execution_time [+16.547µs; +19.630µs] or [+16.475%; +19.545%]

scenario:iastaspects-repr_aspect

  • 🟥 execution_time [+72.361µs; +77.945µs] or [+20.174%; +21.731%]

scenario:iastaspects-title_noaspect

  • 🟥 execution_time [+28.896µs; +32.883µs] or [+15.067%; +17.145%]

scenario:iastaspectsospath-ospathbasename_aspect

  • 🟥 execution_time [+146.404µs; +153.219µs] or [+37.870%; +39.632%]

scenario:iastaspectssplit-rsplit_aspect

  • 🟥 execution_time [+16.953µs; +21.073µs] or [+11.842%; +14.720%]

scenario:span-start

  • 🟥 execution_time [+1.526ms; +1.667ms] or [+10.378%; +11.332%]

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

  • 🟥 execution_time [+432.424ns; +484.091ns] or [+15.981%; +17.890%]

scenario:tracer-small

  • 🟥 execution_time [+26.992µs; +28.378µs] or [+7.996%; +8.407%]

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 [-744.223ns; +744.028ns] or [-6.715%; +6.714%]

scenario:coreapiscenario-core_dispatch_1_listener

  • unstable execution_time [-35.798ns; +30.567ns] or [-5.825%; +4.974%]

scenario:coreapiscenario-core_dispatch_50_listeners

  • unstable execution_time [-1786.969ns; +1546.559ns] or [-10.394%; +8.995%]

scenario:coreapiscenario-core_dispatch_exception_listeners

  • unstable execution_time [-1134.048ns; +1331.832ns] or [-8.793%; +10.326%]

scenario:coreapiscenario-core_dispatch_listeners

  • unstable execution_time [-355.754ns; +299.489ns] or [-9.625%; +8.103%]

scenario:coreapiscenario-core_dispatch_no_args_listeners

  • unstable execution_time [-318.043ns; +199.131ns] or [-10.726%; +6.716%]

scenario:coreapiscenario-core_dispatch_with_results_1_listener

  • unstable execution_time [-83.023ns; +65.132ns] or [-7.249%; +5.687%]

scenario:coreapiscenario-core_dispatch_with_results_50_listeners

  • unstable execution_time [-3466.093ns; +4415.325ns] or [-8.672%; +11.047%]

scenario:coreapiscenario-core_dispatch_with_results_listeners

  • unstable execution_time [-755.929ns; +781.546ns] or [-9.455%; +9.775%]

scenario:packagesupdateimporteddependencies-import_many_stdlib_cached

  • unstable execution_time [-62.933µs; +58.323µs] or [-9.771%; +9.055%]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aws-microvm Work related to AWS MicroVM onboarding changelog/no-changelog A changelog entry is not required for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant