Skip to content

Conversation

@wmfrov
Copy link
Contributor

@wmfrov wmfrov commented Dec 13, 2025

update configuration formatting to be consistent with docs for other tracers and increase readability

What does this PR do?

Change configuration blocks from tables to lists

Motivation:

Referencing this documentation while trying to find configurations and their actual spelling is difficult because the tables break individual configs or words across multiple lines. This table formatting is not how similar docs for other languages are formatted

Change log entry

Updated configuration formatting in documentation

Additional Notes:

How to test the change?

n/a

TonyCTHsu and others added 20 commits February 5, 2025 10:10
* [🤖] Update Latest Dependency: https://github.com/DataDog/dd-trace-rb/actions/runs/13477718964

* Remove force-executed tests and scenario from system-tests workflow after release 2.11.0

* Add AppSec RestClient instrumentation for SSRF detection

* Add type signatures for AppSec RestClient integration

* Fix type signatures for excon and faraday AppSec integrations

* Add tests for RestClient AppSec instrumentation

* Extract rest-client-latest appraisal

* [🤖] Lock Dependency: https://github.com/DataDog/dd-trace-rb/actions/runs/13455470094

* [🤖] Lock Dependency: https://github.com/DataDog/dd-trace-rb/actions/runs/13455581146

* Remove unneeded variable from RestClient SSRF integration test

* [🤖] Lock Dependency: https://github.com/DataDog/dd-trace-rb/actions/runs/13457056485

* Add rest-client gem to rake edge:update task

* [🤖] Lock Dependency: https://github.com/DataDog/dd-trace-rb/actions/runs/13496444973

* Rename RequestPatch to RequestSSRFDetectionPatch

* [🤖] Lock Dependency: https://github.com/DataDog/dd-trace-rb/actions/runs/13497053640

* Disable rubocop warning for RequestSSRFDetectionPatch

* [PROF-11151] Fix test-memory-leaks flaky behavior

**What does this PR do?**

This PR will hopefully fix almost [all of the the
flakiness](https://github.com/DataDog/dd-trace-rb/pulls?q=is%3Apr+asan)
we've seen from the test-memory-leaks GitHub workflow.

The previous "asan" builds we were using were built from ruby-head,
which means that any instability or early breakage in ruby-head would
make test-memory-leaks fail.

To fix this, I've worked with upstream to create these 3.4-asan builds:
these are Ruby builds that are built **from the latest 3.4 stable Ruby**
with asan. Thus any breakages we see in them, should also exist in
regular 3.4 builds.

**Motivation:**

With this change, the test-memory-leaks workflow becomes a lot more
valuable, since it's now never expected to fail.

Thus, any failures we see in it are worth investigating.

**Additional Notes:**

For context, asan (or ASan) is the "AddressSanitizer" tool, see
https://github.com/google/sanitizers/wiki/AddressSanitizer for more
details.

**How to test the change?**

Validate that the updated workflow is running on ruby-3.4.2 and that
it still has the diagnostic output from asan.

* DEBUG-3535 use core transport for DI to support unix domain sockets (#4426)

* Composite action

* Fix publish

* Fix doc step with branch

* Dependency inject logger (partial) (#4432)

* Add 2.12.0 to CHANGELOG.md

* Bump version 2.11.0 to 2.12.0

* Update lockfiles for release 2.12.0

---------

Co-authored-by: TonyCTHsu <[email protected]>
Co-authored-by: Yury Lebedev <[email protected]>
Co-authored-by: y9v <[email protected]>
Co-authored-by: Yury Lebedev <[email protected]>
Co-authored-by: Ivo Anjo <[email protected]>
Co-authored-by: Oleg Pudeyev <[email protected]>
* Bump DeterminateSystems/nix-installer-action

Bumps the gh-actions-packages group with 1 update in the / directory: [DeterminateSystems/nix-installer-action](https://github.com/determinatesystems/nix-installer-action).


Updates `DeterminateSystems/nix-installer-action` from 78d714f6f717f43be9f3f5b867a2ce6ab84db093 to 0d28deea2bab0f135fcdbb0bd8e4c6ba469c7b32
- [Release notes](https://github.com/determinatesystems/nix-installer-action/releases)
- [Commits](DeterminateSystems/nix-installer-action@78d714f...0d28dee)

---
updated-dependencies:
- dependency-name: DeterminateSystems/nix-installer-action
  dependency-version: 0d28deea2bab0f135fcdbb0bd8e4c6ba469c7b32
  dependency-type: direct:production
  dependency-group: gh-actions-packages
...

Signed-off-by: dependabot[bot] <[email protected]>

* [🤖] Update Latest Dependency: https://github.com/DataDog/dd-trace-rb/actions/runs/14306657516

* Update libddwaf to 1.22.0

* [🤖] Lock Dependency: https://github.com/DataDog/dd-trace-rb/actions/runs/14307053734

* Update OpenSearch resource names to be relative instead of full path

* Use specified index name in specs

* Lint

* Add feature flag for resource name and update specs.

* Add documentation for new env var

* Change env var name

* Add case for incorrectly set variable

* Change to o.setter implementation

* Extract processors and scanners from WAF rules

* Introduce `EncodedProfile` class to wrap profiling data

Instead of returning an encoded profile as a bunch of bytes, let's use
a new `EncodedProfile` class to contain this data. For now, we
immediately turn the `EncodedProfile` into a string again once
we get to `stack_recorder.rb`.

This is the first step in a bigger refactoring:
The objective of this refactoring is to get the `EncodedProfile`
instance itself to the `Profiling::HttpTransport`, as starting with
libdatadog 17.0, it takes in directly an `ddog_prof_EncodedProfile`
instead of the profile bytes.

* Update gitignore in tribute to our new AI overlords

* Pipe `EncodedProfile` object directly to `HttpTransport`

This change is a bit noisy since the `pprof_data` was referred in
a bunch of places, but it's mostly about switching one argument for
the other.

I explicitly decided to rename the argument to a) reflect it's no
longer pprof data that's being shipped, but our new object and
b) easily catch any leftover code/assumptions about the old argument.

This step finishes the refactoring to get the `EncodedProfile` to
`HttpTransport`. While with libdatadog 16 we had more flexibility
in how we did this, with 17 we actually need to hand libdatadog
the `ddog_prof_EncodedProfile` instead of the profile bytes.

* Replace `Check_TypedStruct` with nicer version

* Fix profiler specs breaking on JRuby

While the profiler doesn't support JRuby, we still run a small subset
of specs because... why not? We might find out some weird corner case,
even on the pure-Ruby code.

* Fix leaking threads when test gets skipped after threads are created

* Temporarily disable benchmark due to API changes

Will revert in the next PR

* Temporarily remove instead of comment out

Sigh shell scripting...

* Remove extra indirections during reporting of profiles

All this indirection was somewhat of a vestige of my first forays into
native extensions, and they created a lot of boilerplate whenever we
want to change something in the flush object, because there's now
many places to change, rather than just adding it to the flush, and
retrieving it from the flush.

The timespecs are on purpose not touched as they will be refactored
once we move to libdatadog 17, so I decided to not spend any time
on them for now.

* Revert "Temporarily disable benchmark due to API changes"

This reverts commit 98ca66f.

* Minor code simplification

* Minor cleanups

* [PROF-11524] Refactor: Avoid reading profile start_time

**What does this PR do?**

This PR changes the `StackRecorder` so that instead of relying on
libdatadog to track a profile's `start_time` (by passing `NULL` --
aka "use current timestamp") it now explicitly gets the current
timestamp and passes it along to libdatadog.

This then means that we no longer need to read the `start_time`
from libdatadog, because we're tracking it on our side.

**Motivation:**

Starting with libdatadog 17, we'll no longer be able to read
the `start_time` from libdatadog, and this PR leaves us ready for that
change.

**Additional Notes:**

N/A

**How to test the change?**

We had some existing test coverage, and I've added a bit more;
I've also injected some bugs locally on purpose to validate that the
test coverage is good. You can try doing the same ;)

* [NO-TICKET] Fix profiling flaky tests due to time conversions, second try

**What does this PR do?**

This PR fixes flaky tests such as
[this one](https://github.com/DataDog/dd-trace-rb/actions/runs/14359324310/job/40256546138?pr=4570):

```
Failures:

  1) Datadog::Profiling::Collectors::ThreadContext#sample timeline support when timeline is enabled when thread starts Waiting for GVL records a second sample to represent the time spent Waiting for GVL
     Failure/Error:
       expect(second_sample.labels).to include(
         state: "waiting for gvl",
         end_timestamp_ns: be_between(time_before_sample, time_after_sample),
       )

       expected {:end_timestamp_ns => 1744208274700408014, :state => "waiting for gvl", :"thread id" => "10030 (29328)", :"thread name" => "/__w/dd-trace-rb/dd-trace-rb/spec/spec_helper.rb:276"} to include {end_timestamp_ns: (be between 1744208274700440756 and 1744208274700556813 (inclusive))}
       Diff:
       @@ -1,3 +1,5 @@
       -:end_timestamp_ns => (be between 1744208274700440756 and 1744208274700556813 (inclusive)),
       +:"thread id" => "10030 (29328)",
       +:"thread name" => "/__w/dd-trace-rb/dd-trace-rb/spec/spec_helper.rb:276",
       +:end_timestamp_ns => 1744208274700408014,
        :state => "waiting for gvl",
     # ./spec/datadog/profiling/collectors/thread_context_spec.rb:1205:in 'block (6 levels) in <top (required)>'
     # ./spec/spec_helper.rb:261:in 'block (2 levels) in <top (required)>'
     # ./spec/spec_helper.rb:146:in 'block (2 levels) in <top (required)>'
     # /usr/local/bundle/gems/webmock-3.24.0/lib/webmock/rspec.rb:39:in 'block (2 levels) in <top (required)>'
     # /usr/local/bundle/gems/rspec-wait-0.0.10/lib/rspec/wait.rb:47:in 'block (2 levels) in <top (required)>'

Finished in 20.91 seconds (files took 1.01 seconds to load)
764 examples, 1 failure, 19 pending

Failed examples:

rspec ./spec/datadog/profiling/collectors/thread_context_spec.rb:1196 # Datadog::Profiling::Collectors::ThreadContext#sample timeline support when timeline is enabled when thread starts Waiting for GVL records a second sample to represent the time spent Waiting for GVL

Randomized with seed 49054
```

We previously tried to solve this problem in #4495 but the previous
attempt was clearly not entirely successful.

The core of the issue is that internally the profiler uses a monotonic
clock when measuring wall-time, and then needs to turn it into system time.

Since there's no way (that I know of) to get both a monotonic and a
system clock timestamp at once, our conversion code gets both in
sequence and then uses that for the conversions.

Prior to this PR, our tests used
`Datadog::Core::Utils::Time.as_utc_epoch_ns(Time.now)` and then tried to
compare it with what the profiler saw.

This was the source of the flakiness: sometimes the conversion was
slightly off from the measurements we got when reading the system clock
directly.

For instance, here's an example of a situation where this can happen:
1. Test code reads system_clock = 100
2. Profiler code reads monotonic_clock = 2000
3. Profiler code wants to convert to system clock, and needs to
   initialize the conversion code.
  3.1 Profiler reads system_clock = 105
  3.2 Profiler reads monotonic_clock = 2010
  3.3 Profiler delta to epoch ns is 105-2010 => −1905
4. Profiler converts monotonic_clock = 2000 to system using delta:
  2000-1905 => 95
5. Test code expected 95 > 100 => failure

I suspect a variant of this is what happened in the test above.

To solve this flakiness once and for all, the tests were changed to
**use the same clock source** as the profiler, thus guaranteeing that if the tests
get a timestamp (call it t1), and then call the profiler and it gets a timestamp
(call it t2), that t2 >= t1 (and vice-versa).

**Motivation:**

Get profiler to zero flaky tests!

**Additional Notes:**

This isn't the only way to solve this issue... We could for instance
inject the timestamps from the tests to inside the profiler, which
would kind-of be the reverse of this solution: get the profiler to
use the Ruby-level test timestamps.

But, that would need a lot more plumbing and changing of production code
which doesn't seem like the right trade-off for this problem.

Finally we could always move the profiler to use system clock directly,
but that's a whole can of worms too, and arguably it wouldn't be any
better than it is now.

**How to test the change?**

The tests should be green and remain green and not be flaky!

* Use Core::Utils::Time.now instead of Time.now (#4571)

Co-authored-by: Oleg Pudeyev <[email protected]>

* Add reporting of incompatible FFI gem version to Telemetry

* extract http_server helper

* use queue to reduce wait time

* convert crashtracker test to use the helper

* convert remaining tests to use the helper

* dry webrick logging code

* rubocop

* rubocop

* no rubocop, I mean what I type

* Extract derivative schema compression into module

* Exclude non-schema derivative keys from being compressed

* Add fingerprint tests to run in system-tests

* Add marking of spans as blocked on redirect_request action

* Fix AppSec::Component spec description

* Enable AppSec auto-patching of ActiveRecord

* fix test

* [🤖] Update Latest Dependency: https://github.com/DataDog/dd-trace-rb/actions/runs/14424496591

* Bump the gh-actions-packages group across 1 directory with 3 updates

Bumps the gh-actions-packages group with 3 updates in the / directory: [ruby/setup-ruby](https://github.com/ruby/setup-ruby), [github/codeql-action](https://github.com/github/codeql-action) and [DeterminateSystems/nix-installer-action](https://github.com/determinatesystems/nix-installer-action).


Updates `ruby/setup-ruby` from 1.229.0 to 1.230.0
- [Release notes](https://github.com/ruby/setup-ruby/releases)
- [Changelog](https://github.com/ruby/setup-ruby/blob/master/release.rb)
- [Commits](ruby/setup-ruby@354a1ad...e5ac7b0)

Updates `github/codeql-action` from 3.28.13 to 3.28.15
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](github/codeql-action@1b549b9...45775bd)

Updates `DeterminateSystems/nix-installer-action` from 0d28deea2bab0f135fcdbb0bd8e4c6ba469c7b32 to 17a3ce76e01f3e740f8011a70e0d79f9720fc942
- [Release notes](https://github.com/determinatesystems/nix-installer-action/releases)
- [Commits](DeterminateSystems/nix-installer-action@0d28dee...17a3ce7)

---
updated-dependencies:
- dependency-name: ruby/setup-ruby
  dependency-version: 1.230.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: gh-actions-packages
- dependency-name: github/codeql-action
  dependency-version: 3.28.15
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: gh-actions-packages
- dependency-name: DeterminateSystems/nix-installer-action
  dependency-version: 17a3ce76e01f3e740f8011a70e0d79f9720fc942
  dependency-type: direct:production
  dependency-group: gh-actions-packages
...

Signed-off-by: dependabot[bot] <[email protected]>

* Add AppSec server-side request forgery remote capability

* Switch system-tests ref to a temporary branch

* Switch system-tests ref back to main

* Add AppSec RASP SQLI remote capability

* Switch system tests ref to a temporary branch

* Switch system-tests ref back to main

* Fix AppSec::Remote tests

* clean up DI transport code (#4583)

Co-authored-by: Oleg Pudeyev <[email protected]>

* Add handling of Encoding::UndefinedConversionError

In response to dd-trace-rb <-> libddwaf communication bug we
are going to handle exceptions before fix arrives

* check if @resolver is defined before accessing it to eliminate a Ruby… (#4582)

* Update libddwaf dependency to 1.22.0.0.2

It contains fix for non-ASCII characters strings
returned by libddwaf-rb binding

* [🤖] Lock Dependency: https://github.com/DataDog/dd-trace-rb/actions/runs/14472674223

* Add telemetry report when ffi gem is not loaded

* Use telemetry.error for error reporting in AppSec::Component

* Remove automerge

* Implement `force`

* Verify draft and milestone

* Add 2.15.0 to CHANGELOG.md

* Bump version 2.14.0 to 2.15.0

* Update lockfiles for release 2.15.0

* Update changelog

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: TonyCTHsu <[email protected]>
Co-authored-by: Yury Lebedev <[email protected]>
Co-authored-by: y9v <[email protected]>
Co-authored-by: Sarah Chen <[email protected]>
Co-authored-by: Yury Lebedev <[email protected]>
Co-authored-by: Sergey Fedorov <[email protected]>
Co-authored-by: Sergey Fedorov <[email protected]>
Co-authored-by: Ivo Anjo <[email protected]>
Co-authored-by: Oleg Pudeyev <[email protected]>
Co-authored-by: Oleg Pudeyev <[email protected]>
Co-authored-by: Strech <[email protected]>
I am merging this - benchmark is failing since there is no error tracking in `release` branch.
update configuration formatting to be consistent with docs for other tracers and increase readability
@wmfrov wmfrov requested a review from a team as a code owner December 13, 2025 00:46
@github-actions
Copy link

👋 Hey @DataDog/ruby-guild, please fill "Change log entry" section in the pull request description.

If changes need to be present in CHANGELOG.md you can state it this way

**Change log entry**

Yes. A brief summary to be placed into the CHANGELOG.md

(possible answers Yes/Yep/Yeah)

Or you can opt out like that

**Change log entry**

None.

(possible answers No/Nope/None)

Visited at: 2025-12-13 00:46:29 UTC

@github-actions github-actions bot added the docs Involves documentation label Dec 13, 2025
@pr-commenter
Copy link

pr-commenter bot commented Dec 13, 2025

Benchmarks

Benchmark execution time: 2025-12-13 01:14:32

Comparing candidate commit 269ce20 in PR branch wmfrov-patch-1 with baseline commit 08aad66 in branch release.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 44 metrics, 2 unstable metrics.

@p-datadog
Copy link
Member

Hi @wmfrov , is the new version rendered somewhere to take a look ?

@ivoanjo
Copy link
Member

ivoanjo commented Jan 5, 2026

Hey @wmfrov if this can wait for the next release of the Ruby library, would you mind targetting this PR to the master branch?

We have a bit of a complicated setup where applying changes to release directly does make them live immediately for the docs, but then we need to manually apply it to master too, and if there's no rush, it's way easier to apply it to master directly and wait until the next release.

(If this can't wait, we can always do it the other way -- just asking)

@wmfrov wmfrov changed the base branch from release to master January 6, 2026 18:49
@wmfrov wmfrov requested a review from a team as a code owner January 6, 2026 18:49
@wmfrov wmfrov closed this Jan 6, 2026
@wmfrov wmfrov deleted the wmfrov-patch-1 branch January 6, 2026 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Involves documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants