Skip to content

Commit

Permalink
chore(tracing): deprecate DD_TRACE_SPAN_AGGREGATOR_RLOCK (#10725)
Browse files Browse the repository at this point in the history
DD_TRACE_SPAN_AGGREGATOR_RLOCK configuration exposes tracer
implementation details. ddtrace user's should not care about what type
of lock is acquired to aggregate span data. This functionality should
just work.

## 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](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
- [ ] 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 Sep 23, 2024
1 parent 219ecbd commit 0a9453b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 18 deletions.
8 changes: 8 additions & 0 deletions ddtrace/settings/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,14 @@ def __init__(self):
self._ddtrace_bootstrapped = False
self._subscriptions = [] # type: List[Tuple[List[str], Callable[[Config, List[str]], None]]]
self._span_aggregator_rlock = asbool(os.getenv("DD_TRACE_SPAN_AGGREGATOR_RLOCK", True))
if self._span_aggregator_rlock is False:
deprecate(
"DD_TRACE_SPAN_AGGREGATOR_RLOCK is deprecated",
message="Soon the ddtrace library will only support using threading.Rlock to "
"aggregate and encode span data. If you need to disable the re-entrant lock and "
"revert to using threading.Lock, please contact Datadog support.",
removal_version="3.0.0",
)

self.trace_methods = os.getenv("DD_TRACE_METHODS")

Expand Down
8 changes: 0 additions & 8 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -462,14 +462,6 @@ The following environment variables for the tracer are supported:
default: True
description: Send query strings in http.url tag in http server integrations.

DD_TRACE_SPAN_AGGREGATOR_RLOCK:
type: Boolean
default: True
description: Whether the ``SpanAggregator`` should use an RLock or a Lock.
version_added:
v1.16.2: added with default of False
v1.19.0: default changed to True

DD_TRACE_METHODS:
type: String
default: ""
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
deprecations:
- |
tracing: Deprecates the ``DD_TRACE_SPAN_AGGREGATOR_RLOCK`` environment variable. It will be removed in 3.0.0.
10 changes: 0 additions & 10 deletions tests/contrib/gunicorn/test_gunicorn.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ def _gunicorn_settings_factory(
debug_mode=False, # type: bool
dd_service=None, # type: Optional[str]
schema_version=None, # type: Optional[str]
rlock=True, # type: bool
):
# type: (...) -> GunicornServerSettings
"""Factory for creating gunicorn settings with simple defaults if settings are not defined."""
Expand All @@ -75,8 +74,6 @@ def _gunicorn_settings_factory(
env["DD_SERVICE"] = dd_service
if schema_version is not None:
env["DD_TRACE_SPAN_ATTRIBUTE_SCHEMA"] = schema_version
if rlock is not None:
env["DD_TRACE_SPAN_AGGREGATOR_RLOCK"] = "true"
return GunicornServerSettings(
env=env,
directory=directory,
Expand Down Expand Up @@ -168,12 +165,6 @@ def gunicorn_server(gunicorn_server_settings, tmp_path):
debug_mode=True,
enable_module_cloning=True,
)
SETTINGS_GEVENT_SPANAGGREGATOR_NO_RLOCK = _gunicorn_settings_factory(
worker_class="gevent",
use_ddtracerun=False,
import_auto_in_app=True,
rlock=False,
)


@flaky(until=1706677200)
Expand All @@ -185,7 +176,6 @@ def test_no_known_errors_occur(tmp_path):
SETTINGS_GEVENT_DDTRACERUN,
SETTINGS_GEVENT_DDTRACERUN_MODULE_CLONE,
SETTINGS_GEVENT_DDTRACERUN_DEBUGMODE_MODULE_CLONE,
SETTINGS_GEVENT_SPANAGGREGATOR_NO_RLOCK,
]:
with gunicorn_server(gunicorn_server_settings, tmp_path) as context:
_, client = context
Expand Down

0 comments on commit 0a9453b

Please sign in to comment.