Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions ddtrace/profiling/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from typing import Any
from typing import Optional

from ddtrace.profiling import _product


# Native profiling extensions may be absent on some Python versions (e.g. 3.15
# until setup.py gates are lifted). Mirror the is_available pattern used by
Expand All @@ -9,6 +11,11 @@
failure_msg: str = ""


def get_remote_config() -> Optional[dict[str, Any]]:
"""Return the last APM_TRACING remote config ``lib_config`` the profiler received, or ``None``."""
return _product.last_lib_config


class _UnavailableProfiler:
"""Stub Profiler class used when native profiling extensions are not available.

Expand Down
36 changes: 36 additions & 0 deletions ddtrace/profiling/_product.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
"""Product plugin that lets the profiler react to APM_TRACING remote config payloads."""

import typing as t

from ddtrace.internal.settings.profiling import config as profiling_config


requires: list[str] = ["apm-tracing-rc"]

last_lib_config: t.Optional[dict[str, t.Any]] = None


def post_preload() -> None:
pass


def enabled() -> bool:
return profiling_config.enabled


def start() -> None:
pass


def restart(join: bool = False) -> None:
pass


def stop(join: bool = False) -> None:
pass


def apm_tracing_rc(lib_config: dict[str, t.Any], dd_config: t.Any) -> None:
global last_lib_config
last_lib_config = lib_config
print(f"[profiling] APM_TRACING RC lib_config: {lib_config}")
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "ddtrace"
version = "4.16.0rc1"
version = "4.16.0rc1+rc-experiments"
description = "Datadog APM client library"
readme = "README.md"
license = { text = "LICENSE.BSD3" }
Expand Down Expand Up @@ -86,6 +86,7 @@ datadog = "ddtrace.contrib.internal.mlflow.auth_plugin:DatadogHeaderProvider"
"code-origin-for-spans" = "ddtrace.debugging._products.code_origin.span"
"dynamic-instrumentation" = "ddtrace.debugging._products.dynamic_instrumentation"
"exception-replay" = "ddtrace.debugging._products.exception_replay"
"profiling" = "ddtrace.profiling._product"
"live-debugger" = "ddtrace.debugging._products.live_debugger"
"error-tracking" = "ddtrace.errortracking.product"
"openfeature" = "ddtrace.internal.openfeature.product"
Expand Down
Loading