Skip to content

fix(profiling): join v2 sampling thread on exit #13351

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

taegyunkim
Copy link
Contributor

Checklist

  • PR author has checked that all the criteria below are met
  • The PR description includes an overview of the change
  • The PR description articulates the motivation for the change
  • The change includes tests OR the PR description describes a testing strategy
  • The PR description notes risks associated with the change, if any
  • Newly-added code is easy to change
  • The change follows the library release note guidelines
  • The change includes or references documentation updates if necessary
  • Backport labels are set (if applicable)

Reviewer Checklist

  • Reviewer has checked that all the criteria below are met
  • Title is accurate
  • All changes are related to the pull request's stated goal
  • Avoids breaking API changes
  • Testing strategy adequately addresses listed risks
  • Newly-added code is easy to change
  • Release note makes sense to a user of the library
  • If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment
  • Backport labels are set in a manner that is consistent with the release branch maintenance policy

Copy link
Contributor

github-actions bot commented May 7, 2025

CODEOWNERS have been resolved as:

ddtrace/internal/datadog/profiling/stack_v2/include/sampler.hpp         @DataDog/profiling-python
ddtrace/internal/datadog/profiling/stack_v2/src/sampler.cpp             @DataDog/profiling-python

Copy link
Contributor

github-actions bot commented May 7, 2025

Bootstrap import analysis

Comparison of import times between this PR and base.

Summary

The average import time from this PR is: 236 ± 2 ms.

The average import time from base is: 237 ± 2 ms.

The import time difference between this PR and base is: -1.42 ± 0.08 ms.

Import time breakdown

The following import paths have shrunk:

ddtrace.auto 1.926 ms (0.82%)
ddtrace.bootstrap.sitecustomize 1.254 ms (0.53%)
ddtrace.bootstrap.preload 1.254 ms (0.53%)
ddtrace.internal.remoteconfig.client 0.629 ms (0.27%)
ddtrace 0.672 ms (0.28%)
ddtrace.internal._unpatched 0.022 ms (0.01%)

@pr-commenter
Copy link

pr-commenter bot commented May 7, 2025

Benchmarks

Benchmark execution time: 2025-05-30 22:03:32

Comparing candidate commit d409710 in PR branch taegyunkim/v2-join with baseline commit 7425abd in branch main.

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

scenario:iastaspectsospath-ospathnormcase_aspect

  • 🟥 execution_time [+393.990ns; +449.270ns] or [+11.413%; +13.015%]

scenario:telemetryaddmetric-1-distribution-metric-1-times

  • 🟥 execution_time [+267.473ns; +330.014ns] or [+9.324%; +11.504%]

@taegyunkim taegyunkim marked this pull request as ready for review May 23, 2025 15:48
@taegyunkim taegyunkim requested a review from a team as a code owner May 23, 2025 15:48
Copy link
Contributor

@nsrip-dd nsrip-dd left a comment

Choose a reason for hiding this comment

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

IIRC @P403n1x87 had some concern about whether this would slow down application exit too much? So we probably want his review on this.

@taegyunkim
Copy link
Contributor Author

@nsrip-dd Yeah, I'm also debating whether this is really necessary or not. I initially had thought whether this would fix some of the read-after-free problems we see from segfaults, but don't really have clear evidences.

@realFlowControl
Copy link
Member

IIRC @P403n1x87 had some concern about whether this would slow down application exit too much? So we probably want his review on this.

Just my two cents: IMHO it is the right thing to join this thread.
From a quick scan over the code, it looks like we're delaying the end of the application by a maximum of a two-digit number of milliseconds? That sounds reasonable to me.

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.

3 participants