Skip to content

Conversation

@TonyCTHsu
Copy link
Contributor

This is an auto-generated PR to update documentation from here. Please merge (with a merge commit) when ready.

ZStriker19 and others added 30 commits February 11, 2025 17:37
…k conversions

**What does this PR do?**

This PR fixes flaky test DataDog/ruby-guild#220:

```
Failures:

  1) Datadog::Profiling::Collectors::ThreadContext#sample timeline support when timeline is enabled when thread starts Waiting for GVL records a first sample to represent the time between the previous sample and the start of Waiting for GVL
     Failure/Error:
       expect(first_sample.labels).to include(
         state: "sleeping",
         end_timestamp_ns: be_between(@time_before_gvl_waiting, @time_after_gvl_waiting),
       )

       expected {:end_timestamp_ns => 1741859359178414403, :state => "sleeping", :"thread id" => "11298 (22400)", :"thread name" => "/__w/dd-trace-rb/dd-trace-rb/spec/spec_helper.rb:253"} to include {end_timestamp_ns: (be between 1741859359178419843 and 1741859359178427868 (inclusive))}
       Diff:
       @@ -1,2 +1,4 @@
       -:end_timestamp_ns => (be between 1741859359178419843 and 1741859359178427868 (inclusive)),
       +:"thread id" => "11298 (22400)",
       +:"thread name" => "/__w/dd-trace-rb/dd-trace-rb/spec/spec_helper.rb:253",
       +:end_timestamp_ns => 1741859359178414403,
        :state => "sleeping",
     # ./spec/datadog/profiling/collectors/thread_context_spec.rb:1168:in 'block (6 levels) in <top (required)>'
     # ./spec/spec_helper.rb:238:in 'block (2 levels) in <top (required)>'
     # ./spec/spec_helper.rb:123:in 'block (2 levels) in <top (required)>'
     # /usr/local/bundle/gems/webmock-3.25.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 19.02 seconds (files took 0.92371 seconds to load)
763 examples, 1 failure, 19 pending
```

by making sure our monotonic-to-system clock conversion cache does
not affect these specs.

**Motivation:**

Keep profiling at zero known flaky tests!

**Additional Notes:**

In c8f2338 we had already fixed
a very similar issue.

TL;DR there's a cache in the monotonic-to-system-clock conversion code
inside the profiler.

Because this conversion includes a cache, any tests that compare
timestamps in profiles to `Time.now` could become flaky because of drift
between clocks.

That is, because the profiler is **estimating** the system clock based
on this cache, it may say that something happened a few nanos before
`Time.now` when in fact it happened a few nanos after.
Thus, all tests comparing timestamps to `Time.now` must be careful around
resetting this cache to avoid running into this issue.

**How to test the change?**

Since this is a flaky test that depends on drift between clocks
to trigger, I wasn't able to trigger it. But, other than that, the
existing test coverage should be enough to cover this change.
Strech and others added 12 commits March 31, 2025 12:14
* Refactor data extractor
* Rename event name for user lifecycle
* Change span tags from strings to constants
* Fix mistypes in tests and method names
* Refactor devise integration tests
* Refactor tracking middleware
* Change initialization interface of the data extractor
* Remove Datadog::Kit dependency from tracking patches
…-user-instrumentation-to-v3

[APPSEC-56683] Introduce automated user tracking V3
APMS-15322 Reproducer for loading core only and configuring the library
@TonyCTHsu TonyCTHsu added the docs Involves documentation label Apr 2, 2025
@TonyCTHsu TonyCTHsu requested review from a team as code owners April 2, 2025 16:17
@github-actions
Copy link

github-actions bot commented Apr 2, 2025

👋 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-04-02 16:17:27 UTC

@github-actions github-actions bot added core Involves Datadog core libraries integrations Involves tracing integrations profiling Involves Datadog profiling appsec Application Security monitoring product tracing otel OpenTelemetry-related changes labels Apr 2, 2025
@TonyCTHsu TonyCTHsu merged commit e0f153c into release Apr 3, 2025
608 checks passed
@TonyCTHsu TonyCTHsu deleted the update-document-v2.13.0 branch April 3, 2025 10:37
@github-actions github-actions bot added this to the 2.14.0 milestone Apr 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

appsec Application Security monitoring product core Involves Datadog core libraries docs Involves documentation integrations Involves tracing integrations otel OpenTelemetry-related changes profiling Involves Datadog profiling tracing

Projects

None yet

Development

Successfully merging this pull request may close these issues.