Skip to content

feat(native): implement from_owned for PyBackedString - #19849

Draft
paullegranddc wants to merge 1 commit into
mainfrom
paullgdc/rust/fix_span_to_owned
Draft

feat(native): implement from_owned for PyBackedString#19849
paullegranddc wants to merge 1 commit into
mainfrom
paullgdc/rust/fix_span_to_owned

Conversation

@paullegranddc

Copy link
Copy Markdown
Contributor

Motivation

We need to craft new strings for obfuscation. This force us to add a from_owned to SpanText.

Since we need to store bith python string and rust strings now, the PyBackedString

There are more efficient representation of this, but we can try them after benchamrking the current changes

Description

Testing

Risks

Additional Notes

# Motivation

We need to craft new strings for obfuscation. This force us to add a `from_owned` to SpanText.

Since we need to store bith python string and rust strings now, the PyBackedString

There are more efficient representation of this, but we can try them after benchamrking the current changes
@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.

src/native/py_string.rs                                                 @DataDog/apm-core-python

@datadog-datadog-prod-us1-2

datadog-datadog-prod-us1-2 Bot commented Aug 25, 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.

🚦 108 Pipeline jobs failed

Build | build_wheels / Build cp311-win_arm64 — 🔧 Needs a code fix, caused by this PR

View more details · View in GitHub Actions

Compilation error in py_string.rs:261: method from_owned is not a member of trait SpanText.

Build | build_wheels / Build cp312-win_arm64 — 🔧 Needs a code fix, caused by this PR

View more details · View in GitHub Actions

Method 'from_owned' is not a member of trait 'SpanText' in py_string.rs:261:5

Build | build_wheels / Build cp313-win_arm64 — 🔧 Needs a code fix, caused by this PR

View more details · View in GitHub Actions

Compilation error in py_string.rs:261:5: method from_owned is not a member of trait SpanText

View all 108 failed jobs.

📋 Copy fix prompt
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.

Before you start, set up the Datadog software-delivery tooling so you can
query the CI data yourself:

1. Check whether you already have the Datadog software-delivery MCP tools
   (e.g. a `search_datadog_ci_pipeline_events` tool) and the `unblock-pr` skill.
2. If either is missing, STOP and ask me for permission before installing
   anything. Do not install or run anything until I have said yes.
3. Only with my explicit approval, set up the Datadog software-delivery MCP
   server and skills by following:
     https://docs.datadoghq.com/getting_started/software_delivery_mcp_tools/
   then restart so the skill is picked up.
4. If I decline, skip all of the above and work from the context below alone.

Then run /unblock-pr — it will pull the CI data itself. The job context below is what we already know.

If /unblock-pr is not available — because I declined the setup above, or it did not install — work from the context below instead.

Datadog has already classified this failure as caused by changes in this PR.
Take that as given and work the fix:

1. Locate the change. Diff this branch against its base and find the change
   that produces this error. Explain the mechanism, don't just name a file:
     git fetch origin && git diff $(git merge-base origin/main HEAD)...HEAD
2. Reproduce it locally. Run the failing job's command or test before
   proposing anything.
3. Propose the smallest fix that addresses the root cause — not a workaround,
   not a broadened assertion, not a disabled or skipped test.
4. Re-run the same command to confirm, and say exactly what you ran.
5. If the failure turns out to be intermittent rather than deterministic, say
   so plainly instead of "fixing" it — that is a flaky test, and patching it
   hides the problem.

If the right move is to re-run the job rather than change code, use the job
link in the context below. For GitHub Actions: `gh run rerun <run-id> --failed`,
where the run ID is the number after `/runs/` in that URL (not the trailing
number, which is the job ID).

Branch: paullgdc/rust/fix_span_to_owned

Build | build_wheels / Build cp311-win_arm64
Commit: 84ee38084381717b3abe46399b8625f915283794
Error (code / build):
Compilation error in py_string.rs:261: method `from_owned` is not a member of trait `SpanText`.
CI job: https://github.com/DataDog/dd-trace-py/actions/runs/32834350652/job/97759885927

Build | build_wheels / Build cp312-win_arm64
Commit: 84ee38084381717b3abe46399b8625f915283794
Error (code / build):
Method 'from_owned' is not a member of trait 'SpanText' in py_string.rs:261:5
CI job: https://github.com/DataDog/dd-trace-py/actions/runs/32834350652/job/97759885755

Build | build_wheels / Build cp313-win_arm64
Commit: 84ee38084381717b3abe46399b8625f915283794
Error (code / build):
Compilation error in py_string.rs:261:5: method `from_owned` is not a member of trait `SpanText`
CI job: https://github.com/DataDog/dd-trace-py/actions/runs/32834350652/job/97759885732

Plus 1 more failing job not shown here.

ℹ️ Info

🔄 Datadog auto-retried 1 job - 0 passed on retry View in Datadog

Useful? React with 👍 / 👎

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

@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 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.filters -×-> ddtrace.trace  (product:ci_visibility -> product:tracing, score=133)
ddtrace.llmobs._evaluators.runner -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=133)
ddtrace.llmobs._integrations.openai -×-> ddtrace.trace  (product:llmobs -> product:tracing, score=133)
ddtrace.appsec._contrib.django -×-> 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

paullegranddc added a commit to DataDog/libdatadog that referenced this pull request Aug 25, 2026
# Motivation

Obfuscation requires modifying spans in place, and re-writing strings.
This is the most natural way to do this.

This is going to cause breaking changes in downstream implementors of the crate, python for instance can be fixed like this DataDog/dd-trace-py#19849 

# What does this PR do?

Add from_owned to SpanText
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