Skip to content

refactor(sampling): replace in-tree sampling with libdd-sampling#233

Closed
Aaalibaba42 wants to merge 1 commit into
mainfrom
jwiriath/adopt-libdatadog-shared-sampler
Closed

refactor(sampling): replace in-tree sampling with libdd-sampling#233
Aaalibaba42 wants to merge 1 commit into
mainfrom
jwiriath/adopt-libdatadog-shared-sampler

Conversation

@Aaalibaba42
Copy link
Copy Markdown

What

Replace dd-trace-rs' local sampling implementation with the shared libdd-sampling crate from libdatadog (introduced in #1927).

Why

The sampling logic was hoisted into libdatadog so it can be reused across tracers. Keeping a
duplicate copy in dd-trace-rs means divergence risk and double maintenance burden.

How

  • Deleted files that duplicated logic now in libdd-sampling
  • Replaced core::sampling module with direct imports from libdd_sampling.
  • Replaced core::constants with a re-export of libdd_sampling::dd_constants.
  • Re-exported SamplingRuleConfig from libdd_sampling in the configuration module.
  • Adapted otel_mappings.rs to the new trait API:
    • ValueLike method renames (extract_float -> as_float, extract_string -> as_str).
    • SpanProperties::Attribute is now a GAT (type Attribute<'a>).
    • Introduced #[repr(transparent)] newtype wrappers (OtelKeyValue, OtelValue,
      OtelTraceId) to satisfy orphan rules when implementing libdd-sampling traits for
      OpenTelemetry types.
  • Removed the lru direct dependency (now transitive via libdd-sampling).
  • Updated all import sites across propagation, sampler, span processor, and benchmarks.

Additional Notes

@datadog-datadog-prod-us1
Copy link
Copy Markdown

datadog-datadog-prod-us1 Bot commented May 20, 2026

Pipelines  Tests

Fix all issues with BitsAI

⚠️ Warnings

🚦 5 Pipeline jobs failed

Test (AWS integrations) | build x86_64-unknown-linux-gnu (AL2023)   View in Datadog   GitHub Actions

🔧 Fix in code (Fix with Cursor). Failed to update the lock file Cargo.lock due to the --locked flag.

Test (AWS integrations) | test aarch64-unknown-linux-gnu (AL2023)   View in Datadog   GitHub Actions

🔧 Fix in code (Fix with Cursor). Cannot update the lock file Cargo.lock because --locked was passed to prevent this. Consider using --offline instead.

Test (AWS integrations) | test x86_64-unknown-linux-gnu (AL2023)   View in Datadog   GitHub Actions

🔧 Fix in code (Fix with Cursor). Cannot update the lock file Cargo.lock because --locked was passed to prevent this. Consider using --offline instead.

View all 5 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: 3b9b289 | Docs | Datadog PR Page | Give us feedback!

@Aaalibaba42 Aaalibaba42 force-pushed the jwiriath/adopt-libdatadog-shared-sampler branch from 21a376f to 3b9b289 Compare May 20, 2026 13:39
@paullegranddc
Copy link
Copy Markdown
Collaborator

Closing this as it is a duplicata of #154

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.

2 participants