Skip to content

Commit

Permalink
chore(tracing): move mini agent out of tracing (#11814)
Browse files Browse the repository at this point in the history
## Description

No idea where we should put starting the mini-agent but doing it in
tracer initialization feels wrong. The mini agent should only be started
once (at most).

## Checklist
- [x] 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](https://ddtrace.readthedocs.io/en/stable/releasenotes.html)
- The change includes or references documentation updates if necessary
- Backport labels are set (if
[applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting))

## Reviewer Checklist
- [x] 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](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces)
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](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)
  • Loading branch information
mabdinur authored Dec 23, 2024
1 parent d46206c commit 998ee2c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 5 additions & 0 deletions ddtrace/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
from .version import get_version # noqa: E402


# TODO(mabdinur): Remove this once we have a better way to start the mini agent
from ddtrace.internal.serverless.mini_agent import maybe_start_serverless_mini_agent as _start_mini_agent

_start_mini_agent()

# DEV: Import deprecated tracer module in order to retain side-effect of package
# initialization, which added this module to sys.modules. We catch deprecation
# warnings as this is only to retain a side effect of the package
Expand Down
3 changes: 0 additions & 3 deletions ddtrace/_trace/tracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
from ddtrace.internal.serverless import in_aws_lambda
from ddtrace.internal.serverless import in_azure_function
from ddtrace.internal.serverless import in_gcp_function
from ddtrace.internal.serverless.mini_agent import maybe_start_serverless_mini_agent
from ddtrace.internal.service import ServiceStatusError
from ddtrace.internal.utils import _get_metas_to_propagate
from ddtrace.internal.utils.deprecations import DDTraceDeprecationWarning
Expand Down Expand Up @@ -211,8 +210,6 @@ def __init__(
:param dogstatsd_url: The DogStatsD URL.
"""

maybe_start_serverless_mini_agent()

self._filters: List[TraceFilter] = []

# globally set tags
Expand Down

0 comments on commit 998ee2c

Please sign in to comment.