Skip to content

refactor(libdd-telemetry)!: avoid leaking libdd-common types in the public API#2152

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits into
mainfrom
julio/decouple-public-api
Jul 2, 2026
Merged

refactor(libdd-telemetry)!: avoid leaking libdd-common types in the public API#2152
gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits into
mainfrom
julio/decouple-public-api

Conversation

@hoolioh

@hoolioh hoolioh commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Break down endpoint settings into smaller functions which accept primitive types in order not to leak libdd-common types through the public API.

Motivation

Most of downstream projects don't use the Endpoint abstraction because it's thought to handle connections with intake/agent so forcing them to import libdd-common just to configure the connection doesn't seem right.

@datadog-datadog-prod-us1-2

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

Copy link
Copy Markdown

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 69.06%
Overall Coverage: 74.02% (-0.03%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 7fac55c | Docs | Datadog PR Page | Give us feedback!

@github-actions

Copy link
Copy Markdown
Contributor

Clippy Allow Annotation Report

Comparing clippy allow annotations between branches:

  • Base Branch: origin/main
  • PR Branch: origin/julio/decouple-public-api

Summary by Rule

Rule Base Branch PR Branch Change
expect_used 2 2 No change (0%)
unwrap_used 19 19 No change (0%)
Total 21 21 No change (0%)

Annotation Counts by File

File Base Branch PR Branch Change
datadog-sidecar/src/service/sidecar_server.rs 6 6 No change (0%)
libdd-data-pipeline/src/telemetry/mod.rs 1 1 No change (0%)
libdd-telemetry/src/worker/mod.rs 14 14 No change (0%)

Annotation Stats by Crate

Crate Base Branch PR Branch Change
clippy-annotation-reporter 5 5 No change (0%)
datadog-ffe-ffi 1 1 No change (0%)
datadog-ipc 22 22 No change (0%)
datadog-live-debugger 4 4 No change (0%)
datadog-live-debugger-ffi 10 10 No change (0%)
datadog-profiling-replayer 4 4 No change (0%)
datadog-sidecar 45 45 No change (0%)
libdd-common 13 13 No change (0%)
libdd-common-ffi 12 12 No change (0%)
libdd-data-pipeline 6 6 No change (0%)
libdd-ddsketch 2 2 No change (0%)
libdd-dogstatsd-client 1 1 No change (0%)
libdd-profiling 13 13 No change (0%)
libdd-remote-config 3 3 No change (0%)
libdd-telemetry 20 20 No change (0%)
libdd-tinybytes 4 4 No change (0%)
libdd-trace-normalization 2 2 No change (0%)
libdd-trace-obfuscation 3 3 No change (0%)
libdd-trace-stats 1 1 No change (0%)
libdd-trace-utils 11 11 No change (0%)
Total 182 182 No change (0%)

About This Report

This report tracks Clippy allow annotations for specific rules, showing how they've changed in this PR. Decreasing the number of these annotations generally improves code quality.

@dd-octo-sts

dd-octo-sts Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Artifact Size Benchmark Report

aarch64-alpine-linux-musl
Artifact Baseline Commit Change
/aarch64-alpine-linux-musl/lib/libdatadog_profiling.a 85.14 MB 85.14 MB +0% (+3.66 KB) 👌
/aarch64-alpine-linux-musl/lib/libdatadog_profiling.so 7.82 MB 7.82 MB 0% (0 B) 👌
aarch64-unknown-linux-gnu
Artifact Baseline Commit Change
/aarch64-unknown-linux-gnu/lib/libdatadog_profiling.so 10.51 MB 10.51 MB +0% (+304 B) 👌
/aarch64-unknown-linux-gnu/lib/libdatadog_profiling.a 96.27 MB 96.28 MB +0% (+9.65 KB) 👌
libdatadog-x64-windows
Artifact Baseline Commit Change
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.dll 25.14 MB 25.14 MB +.01% (+3.00 KB) 🔍
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.lib 88.04 KB 88.04 KB 0% (0 B) 👌
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.pdb 183.34 MB 183.36 MB +0% (+16.00 KB) 👌
/libdatadog-x64-windows/debug/static/datadog_profiling_ffi.lib 938.86 MB 938.83 MB -0% (-36.19 KB) 👌
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.dll 8.22 MB 8.22 MB +.01% (+1.00 KB) 🔍
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.lib 88.04 KB 88.04 KB 0% (0 B) 👌
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.pdb 24.30 MB 24.31 MB +.03% (+8.00 KB) 🔍
/libdatadog-x64-windows/release/static/datadog_profiling_ffi.lib 48.47 MB 48.47 MB +0% (+2.69 KB) 👌
libdatadog-x86-windows
Artifact Baseline Commit Change
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.dll 21.79 MB 21.80 MB +.01% (+2.50 KB) 🔍
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.lib 89.42 KB 89.42 KB 0% (0 B) 👌
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.pdb 187.39 MB 187.37 MB -0% (-16.00 KB) 👌
/libdatadog-x86-windows/debug/static/datadog_profiling_ffi.lib 927.44 MB 927.43 MB -0% (-17.63 KB) 👌
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.dll 6.35 MB 6.35 MB +0% (+512 B) 👌
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.lib 89.42 KB 89.42 KB 0% (0 B) 👌
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.pdb 26.09 MB 26.10 MB +.02% (+8.00 KB) 🔍
/libdatadog-x86-windows/release/static/datadog_profiling_ffi.lib 46.11 MB 46.11 MB +0% (+2.71 KB) 👌
x86_64-alpine-linux-musl
Artifact Baseline Commit Change
/x86_64-alpine-linux-musl/lib/libdatadog_profiling.a 75.88 MB 75.89 MB +.01% (+9.28 KB) 🔍
/x86_64-alpine-linux-musl/lib/libdatadog_profiling.so 8.70 MB 8.70 MB 0% (0 B) 👌
x86_64-unknown-linux-gnu
Artifact Baseline Commit Change
/x86_64-unknown-linux-gnu/lib/libdatadog_profiling.a 91.34 MB 91.36 MB +.01% (+14.66 KB) 🔍
/x86_64-unknown-linux-gnu/lib/libdatadog_profiling.so 10.59 MB 10.59 MB +0% (+416 B) 👌

@hoolioh hoolioh force-pushed the julio/decouple-public-api branch from 276e7c6 to 2064bd2 Compare June 23, 2026 15:09
@hoolioh hoolioh changed the title WIP: prevent libdd-telemetry from leaking libdd-common types refactor(libdd-telemetry)!: avoid leaking libdd-common types in the public API. Jun 23, 2026
@hoolioh hoolioh marked this pull request as ready for review June 23, 2026 15:18
@hoolioh hoolioh requested review from a team as code owners June 23, 2026 15:18
@hoolioh hoolioh force-pushed the julio/decouple-public-api branch from 2064bd2 to d482c08 Compare June 23, 2026 15:18

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d482c08f56

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread libdd-telemetry-ffi/src/builder.rs Outdated
@hoolioh hoolioh changed the title refactor(libdd-telemetry)!: avoid leaking libdd-common types in the public API. refactor(libdd-telemetry)!: avoid leaking libdd-common types in the public API Jun 23, 2026

@yannham yannham left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I initially thought you wanted to get rid of the libdd-common dependency for libdd-telemetry. But if I understand correctly, there's still a Endpoint lurking there internally, is that correct? Then I'm not sure I understand the motivation. Is it just to avoid having to add explicitly libdd-common for end-user crates just to import Endpoint? Then why not just re-export it from libdd-telemetry, if it's there anyway?

Comment thread libdd-telemetry-ffi/src/builder.rs Outdated
Comment on lines +197 to +201
url: ffi::CharSlice,
api_key: ffi::CharSlice,
timeout_ms: u64,
test_token: ffi::CharSlice,
use_system_resolver: bool,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The endpoint seems to carry quite a bit of different fields, that now have to be set manually one by one and inflate function arguments (there's a risk to forget about one field when setting the endpoint now instead of cfg.set_endpoint previously). I'm just thinking out loud, but would it make sense to re-introduce an Endpoint (or a different name) but stand-alone in libdd-telemetry that packs url, api_key, timeout_ms, together ? At least if we always want to set them all at once.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about that but I ended up adding more parameters here. However you have a point here, maybe taking the same approach as in TelemetryClientConfig would be better? WDYT?

Comment thread libdd-telemetry/examples/tm-send-sketch.rs
@hoolioh

hoolioh commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

I initially thought you wanted to get rid of the libdd-common dependency for libdd-telemetry. But if I understand correctly, there's still a Endpoint lurking there internally, is that correct? Then I'm not sure I understand the motivation. Is it just to avoid having to add explicitly libdd-common for end-user crates just to import Endpoint? Then why not just re-export it from libdd-telemetry, if it's there anyway?

The aim is to reduce the ways a crate can consume a type. If the consumer only uses telemetry it would be more than ok re-exporting the symbols through telemetry so there is only one source for them. Hoewever in our current situation we would be coupling telemetry to common and that will cascade into releasing major versions for multiple crates across the workspace.
Anyway, since the topic is dense and the examples are not straightforward, we can chat about this more in depth, having another angle would help us to figure out to minimize the problem we're having with releases.

@hoolioh hoolioh force-pushed the julio/decouple-public-api branch from dd135ff to 7fac55c Compare June 29, 2026 08:01
@hoolioh

hoolioh commented Jun 30, 2026

Copy link
Copy Markdown
Contributor Author

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Jun 30, 2026

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-06-30 11:17:30 UTC ℹ️ Start processing command /merge


2026-06-30 11:17:35 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in main is approximately 1h (p90).


2026-06-30 12:02:32 UTC 🚨 MergeQueue: This merge request is in error

error while getting head build completion result

Details

Error: GET https://api.github.com/repos/DataDog/libdatadog/commits/cf109e6a4722bb2648f369aec8532f016ed0d667/status?per_page=100: 401 Bad credentials [] (Request ID: CC58:20CB56:202344C:75038DE:6A43B052)

FullStacktrace:
child workflow execution error (type: mergequeue_private.MergeQueue_WaitForChecksOrUntilIsFinal, workflowID: wait_checks_cf109e6a4722bb2648f369aec8532f016ed0d667, runID: 019f1840-0d6f-786f-8dce-3c4b8e379d55, initiatedEventID: 59, startedEventID: 61): child workflow execution error (type: mergequeue.MergeQueue_WaitForCompletionOfRef, workflowID: 019f1840-0d6f-786f-8dce-3c4b8e379d55_8, runID: 019f1840-0da9-7910-a98e-49041c42eccd, initiatedEventID: 8, startedEventID: 10): activity error (type: github.GithubService_ListStatuses, scheduledEventID: 285, startedEventID: 286, identity: 1@github-worker-66cd4ddccb-qkfh7@): GET https://api.github.com/repos/DataDog/libdatadog/commits/cf109e6a4722bb2648f369aec8532f016ed0d667/status?per_page=100: 401 Bad credentials [] (Request ID: CC58:20CB56:202344C:75038DE:6A43B052) (type: GitFailure, retryable: false): GET https://api.github.com/repos/DataDog/libdatadog/commits/cf109e6a4722bb2648f369aec8532f016ed0d667/status?per_page=100: 401 Bad credentials [] (type: ErrorResponse, retryable: true)

@hoolioh

hoolioh commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Jul 2, 2026

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-07-02 08:02:13 UTC ℹ️ Start processing command /merge


2026-07-02 08:02:18 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in main is approximately 1h (p90).


2026-07-02 08:37:16 UTC ℹ️ MergeQueue: This merge request was merged

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants