Skip to content

Conversation

@sanchda
Copy link
Contributor

@sanchda sanchda commented Mar 24, 2025

I still don't know how it happens, but customers are reporting that with the introduction of stack v2 as the default stack collector(and hence, the libdatadog-based collection and export) a lot of log spam related to profiler not having the right sample types (these logs originate from within libdatadog and show an uninitialized Profiling object).

My best guess is that this is related to early forking, so this PR mostly tries to address that by re-initializing even more things on fork.

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

@github-actions
Copy link
Contributor

github-actions bot commented Mar 24, 2025

CODEOWNERS have been resolved as:

releasenotes/notes/fix-profiling-types-2bc311c08b879255.yaml            @DataDog/apm-python
ddtrace/internal/datadog/profiling/build_standalone.sh                  @DataDog/profiling-python
ddtrace/internal/datadog/profiling/dd_wrapper/include/profile.hpp       @DataDog/profiling-python
ddtrace/internal/datadog/profiling/dd_wrapper/include/sample.hpp        @DataDog/profiling-python
ddtrace/internal/datadog/profiling/dd_wrapper/include/types.hpp         @DataDog/profiling-python
ddtrace/internal/datadog/profiling/dd_wrapper/src/profile.cpp           @DataDog/profiling-python
ddtrace/internal/datadog/profiling/dd_wrapper/src/sample.cpp            @DataDog/profiling-python
ddtrace/internal/datadog/profiling/dd_wrapper/src/sample_manager.cpp    @DataDog/profiling-python

@github-actions
Copy link
Contributor

github-actions bot commented Mar 24, 2025

Bootstrap import analysis

Comparison of import times between this PR and base.

Summary

The average import time from this PR is: 232 ± 3 ms.

The average import time from base is: 241 ± 7 ms.

The import time difference between this PR and base is: -8.5 ± 0.2 ms.

Import time breakdown

The following import paths have shrunk:

ddtrace.auto 4.346 ms (1.87%)
ddtrace.bootstrap.sitecustomize 2.518 ms (1.08%)
ddtrace.bootstrap.preload 2.467 ms (1.06%)
ddtrace.internal.products 2.116 ms (0.91%)
ddtrace.internal.remoteconfig.client 0.765 ms (0.33%)
importlib.metadata 0.196 ms (0.08%)
importlib.abc 0.149 ms (0.06%)
importlib.resources 0.149 ms (0.06%)
importlib.resources._common 0.149 ms (0.06%)
zipfile 0.047 ms (0.02%)
ddtrace.internal.symbol_db.remoteconfig 0.095 ms (0.04%)
ddtrace.internal.symbol_db.symbols 0.039 ms (0.02%)
gzip 0.039 ms (0.02%)
multiprocessing 0.048 ms (0.02%)
multiprocessing.context 0.048 ms (0.02%)
multiprocessing.reduction 0.048 ms (0.02%)
pickle 0.048 ms (0.02%)
ddtrace.internal.remoteconfig._connectors 0.043 ms (0.02%)
ctypes 0.043 ms (0.02%)
_ctypes 0.043 ms (0.02%)
ddtrace.settings.profiling 0.239 ms (0.10%)
ddtrace.vendor.psutil 0.239 ms (0.10%)
ddtrace.vendor.psutil._common 0.239 ms (0.10%)
ddtrace.settings.crashtracker 0.063 ms (0.03%)
ddtrace.internal.datadog.profiling.crashtracker 0.063 ms (0.03%)
ddtrace.internal.datadog.profiling.crashtracker._crashtracker 0.063 ms (0.03%)
ddtrace.internal.flare.flare 0.049 ms (0.02%)
logging.handlers 0.049 ms (0.02%)
ddtrace._trace.trace_handlers 0.050 ms (0.02%)
ddtrace._trace._inferred_proxy 0.029 ms (0.01%)
ddtrace.propagation.http 0.029 ms (0.01%)
ddtrace.internal._tagset 0.029 ms (0.01%)
ddtrace.contrib.trace_utils 0.022 ms (0.01%)
ddtrace.contrib.internal.trace_utils 0.022 ms (0.01%)
ddtrace.contrib.internal.trace_utils_base 0.022 ms (0.01%)
ddtrace 1.829 ms (0.79%)
ddtrace._logger 0.656 ms (0.28%)
ddtrace.internal.telemetry 0.527 ms (0.23%)
ddtrace.internal.telemetry.writer 0.480 ms (0.21%)
ddtrace.internal.encoding 0.141 ms (0.06%)
http.client 0.126 ms (0.05%)
ddtrace.internal.utils.version 0.093 ms (0.04%)
ddtrace.vendor.packaging.version 0.093 ms (0.04%)
ddtrace.internal.telemetry.metrics_namespaces 0.047 ms (0.02%)
ddtrace.internal.telemetry.data 0.043 ms (0.02%)
ddtrace.internal.packages 0.043 ms (0.02%)
_sysconfigdata__linux_x86_64-linux-gnu 0.043 ms (0.02%)
ddtrace.settings._agent 0.030 ms (0.01%)
ddtrace.settings._core 0.030 ms (0.01%)
ddtrace.internal.native 0.030 ms (0.01%)
ddtrace.internal.native._native 0.030 ms (0.01%)
logging 0.128 ms (0.06%)
traceback 0.128 ms (0.06%)
contextlib 0.128 ms (0.06%)
ddtrace.settings._config 0.233 ms (0.10%)
ddtrace.trace 0.187 ms (0.08%)
ddtrace._trace.filters 0.082 ms (0.04%)
ddtrace._trace.processor 0.082 ms (0.04%)
ddtrace.internal.dogstatsd 0.049 ms (0.02%)
ddtrace.vendor.dogstatsd 0.049 ms (0.02%)
ddtrace.vendor.dogstatsd.base 0.049 ms (0.02%)
ddtrace._trace.sampler 0.033 ms (0.01%)
ddtrace._trace.span 0.033 ms (0.01%)
ddtrace.internal._rand 0.033 ms (0.01%)
ddtrace._trace.tracer 0.036 ms (0.02%)
ddtrace._monkey 0.065 ms (0.03%)
ddtrace.settings.asm 0.033 ms (0.01%)

@pr-commenter
Copy link

pr-commenter bot commented Apr 16, 2025

Benchmarks

Benchmark execution time: 2025-04-17 18:50:22

Comparing candidate commit 51400ad in PR branch sanchda/profiler_type_setup with baseline commit 310f148 in branch main.

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

@sanchda sanchda marked this pull request as ready for review April 17, 2025 18:05
@sanchda sanchda requested review from a team as code owners April 17, 2025 18:05
@sanchda sanchda requested review from quinna-h and sabrenner April 17, 2025 18:05
@sanchda sanchda force-pushed the sanchda/profiler_type_setup branch from 38fbc7f to 0589d5e Compare April 24, 2025 13:13
@sanchda
Copy link
Contributor Author

sanchda commented May 23, 2025

@taegyunkim cleaning up old PRs, notice that this one is still hanging. Not sure what your plan is, but didn't want to risk leaving it ignored if it was wanted. 🥂

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants