Skip to content

chore(telemetry): rebuild worker on identity refresh - #19821

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

chore(telemetry): rebuild worker on identity refresh#19821
litianningdatadog wants to merge 1 commit into
tianning.li/2-flask-web-request-starting-eventfrom
tianning.li/3-4-telemetry-identity-refresh

Conversation

@litianningdatadog

Copy link
Copy Markdown
Contributor

Description

Split from #19780.

Telemetry's native worker captures identity when it is created. Stop and rebuild the worker after runtime identity refresh so telemetry emitted after a MicroVM /run refresh uses the refreshed identity.

Testing

  • scripts/lint format_check ddtrace/internal/telemetry/writer.py tests/telemetry/test_writer.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.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.llmobs -> ddtrace.llmobs._evaluators -> ddtrace.llmobs._evaluators.format -> ddtrace.llmobs._experiment -> ddtrace.llmobs
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 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.llmobs._integrations.bedrock -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=133)
ddtrace.internal.ci_visibility.git_client -×-> ddtrace.trace  (product:ci_visibility -> product:tracing, score=133)
ddtrace.llmobs._integrations.langgraph -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=133)
ddtrace.appsec._listeners -×-> ddtrace.trace  (product:appsec -> 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/telemetry/writer.py                                    @DataDog/apm-python
tests/telemetry/test_writer.py                                          @DataDog/apm-python

@litianningdatadog litianningdatadog changed the title fix(telemetry): rebuild worker on identity refresh chore(telemetry): rebuild worker on identity refresh Aug 23, 2026
@datadog-datadog-prod-us1-2

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

Copy link
Copy Markdown
Contributor

Pipelines  Tests

Unblock PR with BitsAI

⚠️ Warnings

🚦 83 Pipeline jobs failed

System Tests | tracer-release / End-to-end #2 / uwsgi-poc 2 — ❌ 2 tests failed · 🔧 Needs a code fix, caused by this PR

View in Datadog · View in GitHub Actions

2 failed tests. AssertionError: /spawn_child did not succeed: status None in tests/test_telemetry.py:597 and status None in tests/appsec/api_security_testing/test_headers_collection.py:40.

Showing tests most relevant to this failure.

❌ tests.test_telemetry.Test_Telemetry.test_session_id_headers_across_forks[uwsgi-poc] from system_tests_suite   View in Datadog
AssertionError: /spawn_child did not succeed: status None
assert None == 200
 +  where None = HttpResponse(status_code:None, headers:{}, text:None).status_code
 +    where HttpResponse(status_code:None, headers:{}, text:None) = <tests.test_telemetry.Test_Telemetry object at 0x7efd281fcf20>.spawn_child_response

self = <tests.test_telemetry.Test_Telemetry object at 0x7efd281fcf20>

    def test_session_id_headers_across_forks(self):
        """Test session ID headers in telemetry (fork=true). Stable Service Instance Identifier RFC."""
>       self._validate_session_id_headers_across_processes()
...
❄️ tests.appsec.api_security_testing.test_headers_collection.Test_SecurityTestingHeaders.test_not_propagated_downstream[uwsgi-poc] from system_tests_suite   View in Datadog
assert None == 200
 +  where None = HttpResponse(status_code:None, headers:{}, text:None).status_code

self = <tests.appsec.api_security_testing.test_headers_collection.Test_SecurityTestingHeaders object at 0x7efd215214c0>

    def test_not_propagated_downstream(self):
        """The security testing headers must not be propagated to downstream services.
    
        Asserts directly on the outbound request headers reported back by /make_distant_call,
        rather than counting tagged spans across the distributed trace -- the latter false-passes
...
DataDog/apm-reliability/dd-trace-py | K8S_LIB_INJECTION_NO_AC: [dd-lib-python-init-test-django-gunicorn, ${PRIVATE_DOCKER_REGISTRY}/system-tests/dd-lib-python-init-test-django-gunicorn, 235494822917.dkr.ecr.us-east-1.amazonaws.com/ssi/dd-lib-python-init:glci132648616] — 🔧 Needs a code fix, caused by this PR

View in Datadog · View in GitLab

DataDog/apm-reliability/dd-trace-py | K8S_LIB_INJECTION_NO_AC: [dd-lib-python-init-test-django-gunicorn-alpine, ${PRIVATE_DOCKER_REGISTRY}/system-tests/dd-lib-python-init-test-django-gunicorn-alpine, 235494822917.dkr.ecr.us-east-1.amazonaws.com/ssi/dd-lib-python-init:glci132648616] — 🔧 Needs a code fix, caused by this PR

View in Datadog · View in GitLab

View all 83 failed jobs.

📋 Copy prompt for your agent
CI on my pull request is failing. Help me find and fix the root cause of each failing job below — they were flagged as caused by changes in this PR, so focus on the diff. For each job, explain the failure and propose a fix.

Branch: tianning.li/3-4-telemetry-identity-refresh

System Tests | tracer-release / End-to-end #2 / uwsgi-poc 2
Commit: 13b55e8fe35e424d13d4b1150f93f2f37839110c
Error (code / test):
2 failed tests. AssertionError: /spawn_child did not succeed: status None in tests/test_telemetry.py:597 and status None in tests/appsec/api_security_testing/test_headers_collection.py:40.
CI job: https://github.com/DataDog/dd-trace-py/actions/runs/32668830920/job/97275776081

ℹ️ Info

No other issues found (see more)

❄️ No new flaky tests detected

🔄 Datadog auto-retried 60 jobs - 0 passed on retry View in Datadog

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 2165d36 | 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:06:36

Comparing candidate commit 2165d36 in PR branch tianning.li/3-4-telemetry-identity-refresh with baseline commit d59e112 in branch tianning.li/2-flask-web-request-starting-event.

📊 Benchmarking dashboard

Found 0 performance improvements and 1 performance regressions! Performance is the same for 29 metrics, 0 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:telemetryaddmetric-1-count-metric-1-times

  • 🟥 execution_time [+427.595ns; +463.635ns] or [+15.756%; +17.084%]

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