Skip to content

Commit d75de50

Browse files
committed
Move trace_id to 64 bits
ujson doesn't support the serialization of long integers (it fails if it is bigger than 2 ** 63).
1 parent bf8dd49 commit d75de50

File tree

3 files changed

+5
-12
lines changed

3 files changed

+5
-12
lines changed

ddtrace/compat.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,9 @@
2121

2222

2323
try:
24-
import ujson as json
24+
import simplejson as json
2525
except ImportError:
26-
try:
27-
import simplejson as json
28-
except ImportError:
29-
import json
26+
import json
3027

3128
def iteritems(obj, **kwargs):
3229
func = getattr(obj, "iteritems", None)

ddtrace/sampler.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@
22
33
Any `sampled = False` trace won't be written, and can be ignored by the instrumentation.
44
"""
5-
65
import logging
76
import array
87
import threading
98

10-
from .span import MAX_TRACE_ID
11-
129
log = logging.getLogger(__name__)
1310

11+
MAX_TRACE_ID = 2 ** 64
1412

1513
class AllSampler(object):
1614
"""Sampler sampling all the traces"""

ddtrace/span.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,6 @@ def __repr__(self):
274274
self.name,
275275
)
276276

277-
MAX_TRACE_ID = 2 ** 63
278277
def _new_id():
279-
"""Generate a random trace_id"""
280-
return random.getrandbits(63)
281-
278+
"""Generate a random trace_id or span_id"""
279+
return random.getrandbits(64)

0 commit comments

Comments
 (0)