Skip to content

Commit 96fe424

Browse files
authored
Merge branch 'main' into taegyunkim/prof-11194-windows-libdd
2 parents b969696 + 9ba79f4 commit 96fe424

File tree

255 files changed

+5492
-2485
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

255 files changed

+5492
-2485
lines changed

.github/COMMIT_TEMPLATE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ feat/fix/docs/refactor/ci(xxx): commit title here
2929
# mysqlpython, openai, opentelemetry, opentracer, profile, psycopg, pylibmc, pymemcache,
3030
# pymongo, pymysql, pynamodb, pyodbc, pyramid, pytest, redis, rediscluster, requests, rq,
3131
# sanic, snowflake, sourcecode, sqlalchemy, starlette, stdlib, structlog, subprocess,
32-
# telemetry, test_logging, tornado, tracer, unittest, urllib3, vendor, vertica, wsgi,
32+
# telemetry, test_logging, tornado, tracer, unittest, urllib3, valkey, vendor, vertica, wsgi,
3333
# yaaredis

.gitlab/services.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
redis:
2929
name: registry.ddbuild.io/redis:7.0.7
3030
alias: redis
31+
valkey:
32+
name: registry.ddbuild.io/images/mirror/valkey:8.0-alpine
33+
alias: valkey
3134
kafka:
3235
name: registry.ddbuild.io/images/mirror/apache/kafka:3.8.0
3336
alias: kafka
@@ -54,6 +57,9 @@
5457
rediscluster:
5558
name: registry.ddbuild.io/images/mirror/grokzen/redis-cluster:6.2.0
5659
alias: rediscluster
60+
valkeycluster:
61+
name: registry.ddbuild.io/images/mirror/grokzen/redis-cluster:6.2.0
62+
alias: valkeycluster
5763
elasticsearch:
5864
name: registry.ddbuild.io/images/mirror/library/elasticsearch:7.17.23
5965
alias: elasticsearch

.riot/requirements/11ac941.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#
2+
# This file is autogenerated by pip-compile with Python 3.8
3+
# by the following command:
4+
#
5+
# pip-compile --allow-unsafe --no-annotate .riot/requirements/11ac941.in
6+
#
7+
async-timeout==5.0.1
8+
attrs==24.3.0
9+
coverage[toml]==7.6.1
10+
exceptiongroup==1.2.2
11+
hypothesis==6.45.0
12+
importlib-metadata==8.5.0
13+
iniconfig==2.0.0
14+
mock==5.1.0
15+
opentracing==2.4.0
16+
packaging==24.2
17+
pluggy==1.5.0
18+
pytest==8.3.4
19+
pytest-asyncio==0.23.7
20+
pytest-cov==5.0.0
21+
pytest-mock==3.14.0
22+
pytest-randomly==3.15.0
23+
sortedcontainers==2.4.0
24+
tomli==2.2.1
25+
valkey==6.0.2
26+
zipp==3.20.2

.riot/requirements/1e98e9b.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#
2+
# This file is autogenerated by pip-compile with Python 3.9
3+
# by the following command:
4+
#
5+
# pip-compile --allow-unsafe --no-annotate .riot/requirements/1e98e9b.in
6+
#
7+
async-timeout==5.0.1
8+
attrs==24.3.0
9+
coverage[toml]==7.6.10
10+
exceptiongroup==1.2.2
11+
hypothesis==6.45.0
12+
importlib-metadata==8.5.0
13+
iniconfig==2.0.0
14+
mock==5.1.0
15+
opentracing==2.4.0
16+
packaging==24.2
17+
pluggy==1.5.0
18+
pytest==8.3.4
19+
pytest-asyncio==0.23.7
20+
pytest-cov==6.0.0
21+
pytest-mock==3.14.0
22+
pytest-randomly==3.16.0
23+
sortedcontainers==2.4.0
24+
tomli==2.2.1
25+
valkey==6.0.2
26+
zipp==3.21.0

.riot/requirements/4aa2a2a.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#
2+
# This file is autogenerated by pip-compile with Python 3.11
3+
# by the following command:
4+
#
5+
# pip-compile --allow-unsafe --no-annotate .riot/requirements/4aa2a2a.in
6+
#
7+
async-timeout==5.0.1
8+
attrs==24.3.0
9+
coverage[toml]==7.6.10
10+
hypothesis==6.45.0
11+
iniconfig==2.0.0
12+
mock==5.1.0
13+
opentracing==2.4.0
14+
packaging==24.2
15+
pluggy==1.5.0
16+
pytest==8.3.4
17+
pytest-asyncio==0.23.7
18+
pytest-cov==6.0.0
19+
pytest-mock==3.14.0
20+
pytest-randomly==3.16.0
21+
sortedcontainers==2.4.0
22+
valkey==6.0.2

.riot/requirements/7219cf4.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#
2+
# This file is autogenerated by pip-compile with Python 3.13
3+
# by the following command:
4+
#
5+
# pip-compile --allow-unsafe --no-annotate .riot/requirements/7219cf4.in
6+
#
7+
attrs==24.3.0
8+
coverage[toml]==7.6.10
9+
hypothesis==6.45.0
10+
iniconfig==2.0.0
11+
mock==5.1.0
12+
opentracing==2.4.0
13+
packaging==24.2
14+
pluggy==1.5.0
15+
pytest==8.3.4
16+
pytest-asyncio==0.23.7
17+
pytest-cov==6.0.0
18+
pytest-mock==3.14.0
19+
pytest-randomly==3.16.0
20+
sortedcontainers==2.4.0
21+
valkey==6.0.2

.riot/requirements/b96b665.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#
2+
# This file is autogenerated by pip-compile with Python 3.12
3+
# by the following command:
4+
#
5+
# pip-compile --allow-unsafe --no-annotate .riot/requirements/b96b665.in
6+
#
7+
attrs==24.3.0
8+
coverage[toml]==7.6.10
9+
hypothesis==6.45.0
10+
iniconfig==2.0.0
11+
mock==5.1.0
12+
opentracing==2.4.0
13+
packaging==24.2
14+
pluggy==1.5.0
15+
pytest==8.3.4
16+
pytest-asyncio==0.23.7
17+
pytest-cov==6.0.0
18+
pytest-mock==3.14.0
19+
pytest-randomly==3.16.0
20+
sortedcontainers==2.4.0
21+
valkey==6.0.2

.riot/requirements/dd68acc.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#
2+
# This file is autogenerated by pip-compile with Python 3.10
3+
# by the following command:
4+
#
5+
# pip-compile --allow-unsafe --no-annotate .riot/requirements/dd68acc.in
6+
#
7+
async-timeout==5.0.1
8+
attrs==24.3.0
9+
coverage[toml]==7.6.10
10+
exceptiongroup==1.2.2
11+
hypothesis==6.45.0
12+
iniconfig==2.0.0
13+
mock==5.1.0
14+
opentracing==2.4.0
15+
packaging==24.2
16+
pluggy==1.5.0
17+
pytest==8.3.4
18+
pytest-asyncio==0.23.7
19+
pytest-cov==6.0.0
20+
pytest-mock==3.14.0
21+
pytest-randomly==3.16.0
22+
sortedcontainers==2.4.0
23+
tomli==2.2.1
24+
valkey==6.0.2

ddtrace/_monkey.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@
105105
"unittest": True,
106106
"coverage": False,
107107
"selenium": True,
108+
"valkey": True,
108109
}
109110

110111

ddtrace/_trace/pin.py

Lines changed: 39 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import wrapt
77

88
import ddtrace
9-
from ddtrace.vendor.debtcollector import deprecate
109

1110
from ..internal.logger import get_logger
1211

@@ -32,25 +31,17 @@ class Pin(object):
3231
>>> conn = sqlite.connect('/tmp/image.db')
3332
"""
3433

35-
__slots__ = ["tags", "tracer", "_target", "_config", "_initialized"]
34+
__slots__ = ["tags", "_tracer", "_target", "_config", "_initialized"]
3635

3736
def __init__(
3837
self,
3938
service=None, # type: Optional[str]
4039
tags=None, # type: Optional[Dict[str, str]]
41-
tracer=None,
4240
_config=None, # type: Optional[Dict[str, Any]]
4341
):
4442
# type: (...) -> None
45-
if tracer is not None and tracer is not ddtrace.tracer:
46-
deprecate(
47-
"Initializing ddtrace.trace.Pin with `tracer` argument is deprecated",
48-
message="All Pin instances should use the global tracer instance",
49-
removal_version="3.0.0",
50-
)
51-
tracer = tracer or ddtrace.tracer
5243
self.tags = tags
53-
self.tracer = tracer
44+
self._tracer = ddtrace.tracer
5445
self._target = None # type: Optional[int]
5546
# keep the configuration attribute internal because the
5647
# public API to access it is not the Pin class
@@ -68,10 +59,14 @@ def service(self):
6859
return self._config["service_name"]
6960

7061
def __setattr__(self, name, value):
71-
if getattr(self, "_initialized", False) and name != "_target":
62+
if getattr(self, "_initialized", False) and name not in ("_target", "_tracer"):
7263
raise AttributeError("can't mutate a pin, use override() or clone() instead")
7364
super(Pin, self).__setattr__(name, value)
7465

66+
@property
67+
def tracer(self):
68+
return self._tracer
69+
7570
def __repr__(self):
7671
return "Pin(service=%s, tags=%s, tracer=%s)" % (self.service, self.tags, self.tracer)
7772

@@ -127,7 +122,6 @@ def override(
127122
obj, # type: Any
128123
service=None, # type: Optional[str]
129124
tags=None, # type: Optional[Dict[str, str]]
130-
tracer=None,
131125
):
132126
# type: (...) -> None
133127
"""Override an object with the given attributes.
@@ -139,20 +133,32 @@ def override(
139133
>>> # Override a pin for a specific connection
140134
>>> Pin.override(conn, service='user-db')
141135
"""
142-
if tracer is not None:
143-
deprecate(
144-
"Calling ddtrace.trace.Pin.override(...) with the `tracer` argument is deprecated",
145-
message="All Pin instances should use the global tracer instance",
146-
removal_version="3.0.0",
147-
)
136+
Pin._override(obj, service=service, tags=tags)
137+
138+
@classmethod
139+
def _override(
140+
cls,
141+
obj, # type: Any
142+
service=None, # type: Optional[str]
143+
tags=None, # type: Optional[Dict[str, str]]
144+
tracer=None,
145+
):
146+
# type: (...) -> None
147+
"""
148+
Internal method that allows overriding the global tracer in tests
149+
"""
148150
if not obj:
149151
return
150152

151153
pin = cls.get_from(obj)
152154
if pin is None:
153-
Pin(service=service, tags=tags, tracer=tracer).onto(obj)
155+
pin = Pin(service=service, tags=tags)
154156
else:
155-
pin.clone(service=service, tags=tags, tracer=tracer).onto(obj)
157+
pin = pin.clone(service=service, tags=tags)
158+
159+
if tracer:
160+
pin._tracer = tracer
161+
pin.onto(obj)
156162

157163
def enabled(self):
158164
# type: () -> bool
@@ -198,21 +204,22 @@ def clone(
198204
self,
199205
service=None, # type: Optional[str]
200206
tags=None, # type: Optional[Dict[str, str]]
201-
tracer=None,
202207
):
203208
# type: (...) -> Pin
204209
"""Return a clone of the pin with the given attributes replaced."""
210+
return self._clone(service=service, tags=tags)
211+
212+
def _clone(
213+
self,
214+
service=None, # type: Optional[str]
215+
tags=None, # type: Optional[Dict[str, str]]
216+
tracer=None,
217+
):
218+
"""Internal method that can clone the tracer from an existing Pin. This is used in tests"""
205219
# do a shallow copy of Pin dicts
206220
if not tags and self.tags:
207221
tags = self.tags.copy()
208222

209-
if tracer is not None:
210-
deprecate(
211-
"Initializing ddtrace.trace.Pin with `tracer` argument is deprecated",
212-
message="All Pin instances should use the global tracer instance",
213-
removal_version="3.0.0",
214-
)
215-
216223
# we use a copy instead of a deepcopy because we expect configurations
217224
# to have only a root level dictionary without nested objects. Using
218225
# deepcopy introduces a big overhead:
@@ -221,9 +228,10 @@ def clone(
221228
# deepcopy: 0.2787208557128906
222229
config = self._config.copy()
223230

224-
return Pin(
231+
pin = Pin(
225232
service=service or self.service,
226233
tags=tags,
227-
tracer=tracer or self.tracer, # do not clone the Tracer
228234
_config=config,
229235
)
236+
pin._tracer = tracer or self.tracer
237+
return pin

ddtrace/_trace/trace_handlers.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,11 @@ def _on_redis_command_post(ctx: core.ExecutionContext, rowcount):
688688
ctx.span.set_metric(db.ROWCOUNT, rowcount)
689689

690690

691+
def _on_valkey_command_post(ctx: core.ExecutionContext, rowcount):
692+
if rowcount is not None:
693+
ctx.span.set_metric(db.ROWCOUNT, rowcount)
694+
695+
691696
def _on_test_visibility_enable(config) -> None:
692697
from ddtrace.internal.ci_visibility import CIVisibility
693698

@@ -797,6 +802,8 @@ def listen():
797802
core.on("botocore.kinesis.GetRecords.post", _on_botocore_kinesis_getrecords_post)
798803
core.on("redis.async_command.post", _on_redis_command_post)
799804
core.on("redis.command.post", _on_redis_command_post)
805+
core.on("valkey.async_command.post", _on_valkey_command_post)
806+
core.on("valkey.command.post", _on_valkey_command_post)
800807
core.on("azure.functions.request_call_modifier", _on_azure_functions_request_span_modifier)
801808
core.on("azure.functions.start_response", _on_azure_functions_start_response)
802809

@@ -838,6 +845,7 @@ def listen():
838845
"botocore.patched_stepfunctions_api_call",
839846
"botocore.patched_bedrock_api_call",
840847
"redis.command",
848+
"valkey.command",
841849
"rq.queue.enqueue_job",
842850
"rq.traced_queue_fetch_job",
843851
"rq.worker.perform_job",

ddtrace/_trace/tracer.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
from ddtrace.internal.serverless import in_gcp_function
6060
from ddtrace.internal.service import ServiceStatusError
6161
from ddtrace.internal.utils import _get_metas_to_propagate
62-
from ddtrace.internal.utils.deprecations import DDTraceDeprecationWarning
6362
from ddtrace.internal.utils.formats import format_trace_id
6463
from ddtrace.internal.utils.http import verify_url
6564
from ddtrace.internal.writer import AgentResponse
@@ -69,7 +68,6 @@
6968
from ddtrace.settings import Config
7069
from ddtrace.settings.asm import config as asm_config
7170
from ddtrace.settings.peer_service import _ps_config
72-
from ddtrace.vendor.debtcollector import deprecate
7371

7472

7573
log = get_logger(__name__)
@@ -217,16 +215,8 @@ def __init__(
217215
if Tracer._instance is None:
218216
Tracer._instance = self
219217
else:
220-
# ddtrace library does not support context propagation for multiple tracers.
221-
# All instances of ddtrace ContextProviders share the same ContextVars. This means that
222-
# if you create multiple instances of Tracer, spans will be shared between them creating a
223-
# broken experience.
224-
# TODO(mabdinur): Convert this warning to an ValueError in 3.0.0
225-
deprecate(
226-
"Support for multiple Tracer instances is deprecated",
227-
". Use ddtrace.tracer instead.",
228-
category=DDTraceDeprecationWarning,
229-
removal_version="3.0.0",
218+
log.error(
219+
"Multiple Tracer instances can not be initialized. Use ``ddtrace.trace.tracer`` instead.",
230220
)
231221

232222
self._user_trace_processors: List[TraceProcessor] = []

0 commit comments

Comments
 (0)