Skip to content

fix(debugging): support probes on declarations - #19873

Draft
tylfin wants to merge 2 commits into
mainfrom
tyler.finethy/fix-di-line-probe-declarations
Draft

fix(debugging): support probes on declarations#19873
tylfin wants to merge 2 commits into
mainfrom
tyler.finethy/fix-di-line-probe-declarations

Conversation

@tylfin

@tylfin tylfin commented Aug 26, 2026

Copy link
Copy Markdown
Member

Description

Allow Dynamic Instrumentation line probes placed on function or method declarations to install successfully. Function discovery records code-object header ranges and redirects these probes to the first executable line without parsing application source. The configured source line remains unchanged in emitted probe metadata and the effective line is retained for probe removal.

Testing

  • Dynamic Instrumentation debugging suite on Python 3.12: 528 passed, 4 skipped
  • scripts/lint checks
  • Targeted formatting and type checks
  • Reno lint and release-note spelling checks

Risks

Code-object line metadata can differ between Python versions. The fallback is limited to locations that resolve to exactly one function header, while ordinary executable-line probes retain their existing behavior.

@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Aug 26, 2026

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

cit-pr-commenter-54b7da Bot commented Aug 26, 2026

Copy link
Copy Markdown

Dependency direction analysis

⚠️ Existing dependency direction violations

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

Show existing violations (showing 5 of 249 highest severity)
ddtrace.internal.tracemethods -×-> ddtrace.trace  (internal-core -> product:tracing, score=135)
ddtrace.llmobs._integrations.anthropic -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=133)
ddtrace.appsec._listeners -×-> ddtrace.trace  (product:appsec -> product:tracing, score=133)
ddtrace.llmobs._integrations.openai -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=133)
ddtrace.internal.ci_visibility.filters -×-> ddtrace.trace  (product:ci_visibility -> 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 main using the target branch CODEOWNERS file.
CODEOWNERS team requests not listed below are not required by the current file set.

ddtrace/debugging/_debugger.py                                          @DataDog/debugger-python
ddtrace/debugging/_function/discovery.py                                @DataDog/debugger-python
ddtrace/debugging/_probe/model.py                                       @DataDog/debugger-python
releasenotes/notes/fix-di-line-probe-method-declaration-e13fdd953806edc3.yaml  @DataDog/apm-python
tests/debugging/function/test_discovery.py                              @DataDog/debugger-python
tests/debugging/test_debugger.py                                        @DataDog/debugger-python

Comment thread ddtrace/debugging/_function/discovery.py Outdated
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