Skip to content

feat(crashtracking): send debug log when no data is received at all - #2321

Merged
gyuheon0h merged 1 commit into
mainfrom
gyuheon0h/ct-no-data-debug
Aug 6, 2026
Merged

feat(crashtracking): send debug log when no data is received at all#2321
gyuheon0h merged 1 commit into
mainfrom
gyuheon0h/ct-no-data-debug

Conversation

@gyuheon0h

@gyuheon0h gyuheon0h commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Creates a DebugLogger for use by the receiver. This debug logger has the ability to send telemetry logs always, whether CrashtrackerConfig, Metadata is received or not. As new data arrives to the receiver, the debug logger self builds itself. This allows us to send debug logs from the receiver even if no data has been received by the receiver yet.

Motivation

We have cases where customers crash and the receiver spawns, but there is not even a crash ping.

We should log this. Previously, we waited until Metadata and CrashtrackerConfig was received by the receiver before being able to send anything. However, the TelemetryCrashUploader technically needs nothing to be able to send logs -- it has fallback paths that derive the endpoint through environment variables. We should take advantage of this

Additional Notes

Anything else we should know when reviewing?

How to test the change?

Describe here in detail how the change can be validated.

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@gyuheon0h gyuheon0h changed the title Send debug log when no data is received at all feat(crashtracking): send debug log when no data is received at all Aug 5, 2026
@gyuheon0h
gyuheon0h marked this pull request as ready for review August 5, 2026 14:45
@gyuheon0h
gyuheon0h requested a review from a team as a code owner August 5, 2026 14:45
@gyuheon0h
gyuheon0h requested a review from gleocadie August 5, 2026 14:45
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

📚 Documentation Check Results

⚠️ 1106 documentation warning(s) found

📦 libdd-crashtracker - 1106 warning(s)


Updated: 2026-08-05 19:10:41 UTC | Commit: 3297eb3 | missing-docs job results

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

🔒 Cargo Deny Results

⚠️ 2 issue(s) found, showing only errors (advisories, bans, sources)

📦 libdd-crashtracker - 2 error(s)

Show output
error[vulnerability]: Invalid pointer dereference in `fmt::Pointer` impl for `Atomic` and `Shared` when the underlying pointer is invalid
   ┌─ /home/runner/work/libdatadog/libdatadog/Cargo.lock:59:1
   │
59 │ crossbeam-epoch 0.9.18 registry+https://github.com/rust-lang/crates.io-index
   │ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ security vulnerability detected
   │
   ├ ID: RUSTSEC-2026-0204
   ├ Advisory: https://rustsec.org/advisories/RUSTSEC-2026-0204
   ├ Affected versions of `fmt::Display` dereference the underlying pointer. This causes a invalid pointer dereference e.g., when a pointer created with `Atomic::null` or `Shared::null`. `fmt::Debug` impls and pre-0.9 `fmt::Display` impls, which do not dereference pointers, are not affected by this issue.
   ├ Announcement: https://github.com/crossbeam-rs/crossbeam/pull/1276
   ├ Solution: Upgrade to >=0.9.20 (try `cargo update -p crossbeam-epoch`)
   ├ crossbeam-epoch v0.9.18
     └── crossbeam-deque v0.8.5
         └── rayon-core v1.12.1
             └── rayon v1.10.0
                 └── criterion v0.5.1
                     ├── (dev) libdd-crashtracker v1.0.0
                     └── (dev) libdd-ddsketch v1.1.0
                         └── libdd-telemetry v6.0.0
                             └── libdd-crashtracker v1.0.0 (*)

error[unsound]: Rand is unsound with a custom logger using `rand::rng()`
    ┌─ /home/runner/work/libdatadog/libdatadog/Cargo.lock:204:1
    │
204 │ rand 0.8.5 registry+https://github.com/rust-lang/crates.io-index
    │ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ unsound advisory detected
    │
    ├ ID: RUSTSEC-2026-0097
    ├ Advisory: https://rustsec.org/advisories/RUSTSEC-2026-0097
    ├ It has been reported (by [@lopopolo](https://github.com/lopopolo)) that the `rand` library is [unsound](https://rust-lang.github.io/unsafe-code-guidelines/glossary.html#soundness-of-code--of-a-library) (i.e. that safe code using the public API can cause Undefined Behaviour) when all the following conditions are met:
      
      - The `log` and `thread_rng` features are enabled
      - A [custom logger](https://docs.rs/log/latest/log/#implementing-a-logger) is defined
      - The custom logger accesses `rand::rng()` (previously `rand::thread_rng()`) and calls any `TryRng` (previously `RngCore`) methods on `ThreadRng`
      - The `ThreadRng` (attempts to) reseed while called from the custom logger (this happens every 64 kB of generated data)
      - Trace-level logging is enabled or warn-level logging is enabled and the random source (the `getrandom` crate) is unable to provide a new seed
      
      `TryRng` (previously `RngCore`) methods for `ThreadRng` use `unsafe` code to cast `*mut BlockRng<ReseedingCore>` to `&mut BlockRng<ReseedingCore>`. When all the above conditions are met this results in an aliased mutable reference, violating the Stacked Borrows rules. Miri is able to detect this violation in sample code. Since construction of [aliased mutable references is Undefined Behaviour](https://doc.rust-lang.org/stable/nomicon/references.html), the behaviour of optimized builds is hard to predict.
    ├ Announcement: https://github.com/rust-random/rand/pull/1763
    ├ Solution: Upgrade to >=0.10.1 OR <0.10.0, >=0.9.3 OR <0.9.0, >=0.8.6 (try `cargo update -p rand`)
    ├ rand v0.8.5
      ├── libdd-common v5.1.0
      │   ├── libdd-capabilities-impl v3.0.0
      │   │   ├── libdd-crashtracker v1.0.0
      │   │   ├── libdd-shared-runtime v2.0.0
      │   │   │   └── libdd-telemetry v6.0.0
      │   │   │       └── libdd-crashtracker v1.0.0 (*)
      │   │   └── (dev) libdd-telemetry v6.0.0 (*)
      │   ├── (build) libdd-crashtracker v1.0.0 (*)
      │   ├── libdd-shared-runtime v2.0.0 (*)
      │   └── libdd-telemetry v6.0.0 (*)
      ├── libdd-crashtracker v1.0.0 (*)
      └── (dev) libdd-ddsketch v1.1.0
          └── libdd-telemetry v6.0.0 (*)

advisories FAILED, bans ok, sources ok

Updated: 2026-08-05 19:12:08 UTC | Commit: 3297eb3 | dependency-check job results

@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: a8e6a53de3

ℹ️ 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-crashtracker/src/receiver/receive_report.rs Outdated
Comment thread libdd-crashtracker/src/receiver/receive_report.rs Outdated
@pr-commenter

pr-commenter Bot commented Aug 5, 2026

Copy link
Copy Markdown

Benchmarks

Comparison

Benchmark execution time: 2026-08-05 19:19:32

Comparing candidate commit 6dc1fe2 in PR branch gyuheon0h/ct-no-data-debug with baseline commit 9ac89b9 in branch main.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 1 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 ----------------------------------'

Candidate

Candidate benchmark details

Group 1

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 6dc1fe2 1785956872 gyuheon0h/ct-no-data-debug
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
receiver_entry_point/report/2644 execution_time 3.586ms 3.621ms ± 0.017ms 3.618ms ± 0.010ms 3.631ms 3.650ms 3.671ms 3.692ms 2.04% 1.142 1.947 0.47% 0.001ms 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
receiver_entry_point/report/2644 execution_time [3.619ms; 3.623ms] or [-0.065%; +0.065%] None None None

Baseline

Baseline benchmark details

Group 1

cpu_model git_commit_sha git_commit_date git_branch
Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz 9ac89b9 1785954810 main
scenario metric min mean ± sd median ± mad p75 p95 p99 max peak_to_median_ratio skewness kurtosis cv sem runs sample_size
receiver_entry_point/report/2644 execution_time 3.492ms 3.561ms ± 0.060ms 3.528ms ± 0.020ms 3.635ms 3.663ms 3.680ms 3.691ms 4.62% 0.763 -1.122 1.68% 0.004ms 1 200
scenario metric 95% CI mean Shapiro-Wilk pvalue Ljung-Box pvalue (lag=1) Dip test pvalue
receiver_entry_point/report/2644 execution_time [3.553ms; 3.569ms] or [-0.234%; +0.234%] None None None

@datadog-official

datadog-official Bot commented Aug 5, 2026

Copy link
Copy Markdown

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 94.15%
Overall Coverage: 75.21% (+0.07%)

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

@dd-octo-sts

dd-octo-sts Bot commented Aug 5, 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 88.12 MB 88.15 MB +.03% (+27.79 KB) 🔍
/aarch64-alpine-linux-musl/lib/libdatadog_profiling.so 8.14 MB 8.14 MB 0% (0 B) 👌
aarch64-unknown-linux-gnu
Artifact Baseline Commit Change
/aarch64-unknown-linux-gnu/lib/libdatadog_profiling.a 99.26 MB 99.29 MB +.03% (+30.84 KB) 🔍
/aarch64-unknown-linux-gnu/lib/libdatadog_profiling.so 10.89 MB 10.90 MB +.02% (+2.79 KB) 🔍
libdatadog-x64-windows
Artifact Baseline Commit Change
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.dll 26.30 MB 26.30 MB 0% (0 B) 👌
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.lib 93.16 KB 93.16 KB 0% (0 B) 👌
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.pdb 189.27 MB 189.25 MB --.01% (-24.00 KB) 💪
/libdatadog-x64-windows/debug/static/datadog_profiling_ffi.lib 986.51 MB 986.51 MB 0% (0 B) 👌
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.dll 8.60 MB 8.60 MB 0% (0 B) 👌
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.lib 93.16 KB 93.16 KB 0% (0 B) 👌
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.pdb 25.29 MB 25.29 MB 0% (0 B) 👌
/libdatadog-x64-windows/release/static/datadog_profiling_ffi.lib 50.38 MB 50.38 MB 0% (0 B) 👌
libdatadog-x86-windows
Artifact Baseline Commit Change
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.dll 22.92 MB 22.92 MB 0% (0 B) 👌
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.lib 94.62 KB 94.62 KB 0% (0 B) 👌
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.pdb 194.07 MB 194.08 MB +0% (+8.00 KB) 👌
/libdatadog-x86-windows/debug/static/datadog_profiling_ffi.lib 975.94 MB 975.94 MB 0% (0 B) 👌
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.dll 6.64 MB 6.64 MB 0% (0 B) 👌
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.lib 94.62 KB 94.62 KB 0% (0 B) 👌
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.pdb 27.20 MB 27.20 MB 0% (0 B) 👌
/libdatadog-x86-windows/release/static/datadog_profiling_ffi.lib 47.98 MB 47.98 MB 0% (0 B) 👌
x86_64-alpine-linux-musl
Artifact Baseline Commit Change
/x86_64-alpine-linux-musl/lib/libdatadog_profiling.a 78.49 MB 78.51 MB +.03% (+27.30 KB) 🔍
/x86_64-alpine-linux-musl/lib/libdatadog_profiling.so 9.03 MB 9.04 MB +.08% (+8.00 KB) 🔍
x86_64-unknown-linux-gnu
Artifact Baseline Commit Change
/x86_64-unknown-linux-gnu/lib/libdatadog_profiling.a 94.12 MB 94.15 MB +.02% (+27.63 KB) 🔍
/x86_64-unknown-linux-gnu/lib/libdatadog_profiling.so 11.01 MB 11.01 MB +.01% (+1.75 KB) 🔍

@gyuheon0h
gyuheon0h requested a review from a team as a code owner August 5, 2026 16:49
@gyuheon0h
gyuheon0h force-pushed the gyuheon0h/ct-no-data-debug branch from 2238baa to ba607a3 Compare August 5, 2026 16:51
@gyuheon0h

Copy link
Copy Markdown
Contributor Author

@codex r

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@gyuheon0h

Copy link
Copy Markdown
Contributor Author

@codex r

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@gyuheon0h
gyuheon0h force-pushed the gyuheon0h/ct-no-data-debug branch from ba607a3 to f9468bc Compare August 5, 2026 16:59
@gyuheon0h
gyuheon0h marked this pull request as draft August 5, 2026 17:09
@gyuheon0h
gyuheon0h force-pushed the gyuheon0h/ct-no-data-debug branch 2 times, most recently from 9439a82 to 0c64e83 Compare August 5, 2026 18:20
@gyuheon0h
gyuheon0h force-pushed the gyuheon0h/ct-no-data-debug branch from 0c64e83 to 6dc1fe2 Compare August 5, 2026 19:08
@gyuheon0h
gyuheon0h marked this pull request as ready for review August 5, 2026 19:16

@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: 6dc1fe271a

ℹ️ 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 on lines +658 to +661
std::env::set_var(
"DD_TRACE_AGENT_URL",
format!("http://{}", listener.local_addr().unwrap()),
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Restore the agent URL after the no-data test

When these tests are run by cargo test/libtest or any harness that does not isolate environment per test, this set_var changes a process-global endpoint and never restores it. Other receiver tests now create DebugLogger::new(None, None) and can emit via the env-derived endpoint on timeout/incomplete paths, so they may race with this mock listener or inherit its closed address after this test, causing order-dependent telemetry failures; please guard and restore the variable or serialize env users.

AGENTS.md reference: AGENTS.md:L70-L75

Useful? React with 👍 / 👎.

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.

nextest isolates env per test

Comment on lines +444 to +451
debug_logger
.emit_and_wait(
ReceiverIssue::NoData,
&builder.uuid.to_string(),
"Receiver received no data".to_string(),
LogLevel::Warn,
)
.await;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Avoid blocking the long-lived receiver on empty connections

For a long-lived socket receiver (async_receiver_entry_point_unix_socket(..., one_shot=false)), the accept loop handles one connection at a time, so an empty connect/close now awaits this best-effort telemetry upload before accepting another report. If the agent endpoint is slow or unreachable, each empty connection can stall the receiver for the telemetry timeout and delay subsequent crash reports; the no-data signal needs to be spawned or otherwise bounded for that mode.

AGENTS.md reference: AGENTS.md:L70-L75

Useful? React with 👍 / 👎.

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.

There can only be one report from one process? Or is this referring to sidecar process listening to many processes??

@gleocadie gleocadie 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.

LGTM
leave the AI comments and Rust thingy to experts :)

@gyuheon0h
gyuheon0h merged commit 194becd into main Aug 6, 2026
78 of 80 checks passed
@gyuheon0h
gyuheon0h deleted the gyuheon0h/ct-no-data-debug branch August 6, 2026 13:18
bwoebi added a commit that referenced this pull request Aug 7, 2026
…mote_config/agentless_fetcher

* 'main' of github.com:DataDog/libdatadog:
  feat(data-pipeline)!: add flush_and_close to the trace buffer (#2313)
  refactor(rc)!: make conversion from RemoteConfigProduct back and forth generally available (#2325)
  chore: release v40.0.0 (#2326)
  feat(datadog-ffe): server-side EVP flagevaluation payload + bincode-safe sidecar delivery (#2117)
  feat(data-pipeline): set structured span values (#2300)
  feat(telemetry)!: Add Installation signature and AppProduct changes payloads (#2213)
  fix(libdd-trace-utils): apply SpanLink flags masking when v0.5 json encoding (#2314)
  feat(data-pipeline): encode structured values (#2304)
  feat(crashtracking): send debug log when no data is received at all (#2321)
  chore: release v39.0.0 (#2324)
  feat(data-pipeline): add span links FFI (#2305)
  fix(crashtracking): check fields and exclude uuid for `has_data` (#2322)
  feat(data-pipeline): add span events FFI (#2301)
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