Skip to content

feat(co): add in-product enablement support #13633

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 1 commit into
base: main
Choose a base branch
from
Open
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
32 changes: 26 additions & 6 deletions ddtrace/debugging/_products/code_origin/span.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import enum

from ddtrace.settings.code_origin import config


Expand All @@ -9,23 +11,41 @@ def post_preload():
pass


def _start():
from ddtrace.debugging._origin.span import SpanCodeOriginProcessor

SpanCodeOriginProcessor.enable()
Copy link
Contributor

Choose a reason for hiding this comment

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

When you rebase this, we should either remove or separate exit spans into a separate path per agent sync discussion



def start():
if config.span.enabled:
from ddtrace.debugging._origin.span import SpanCodeOriginProcessor

SpanCodeOriginProcessor.enable()
_start()


def restart(join=False):
pass


def _stop():
from ddtrace.debugging._origin.span import SpanCodeOriginProcessor

SpanCodeOriginProcessor.disable()


def stop(join=False):
if config.span.enabled:
from ddtrace.debugging._origin.span import SpanCodeOriginProcessor

SpanCodeOriginProcessor.disable()
_stop()


def at_exit(join=False):
stop(join=join)


class APMCapabilities(enum.IntFlag):
APM_TRACING_ENABLE_CODE_ORIGIN = 1 << 40


def apm_tracing_rc(lib_config, _config):
if (enabled := lib_config.get("code_origin_enabled")) is not None:
should_start = (config.span.spec.enabled.full_name not in config.source or config.span.enabled) and enabled
_start() if should_start else _stop()
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
features:
- |
code origin: added support for in-product enablement.
Loading