Skip to content

Commit fbe895d

Browse files
committed
formatting
1 parent 85e0d57 commit fbe895d

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

sentry_sdk/hub.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,9 @@ def start_transaction(
511511

512512
if transaction is None:
513513
kwargs.setdefault("hub", self)
514-
kwargs['_fast_span_ids'] = client and client.options['_experiments'].get("fast_span_ids")
514+
kwargs["_fast_span_ids"] = client and client.options["_experiments"].get(
515+
"fast_span_ids"
516+
)
515517
transaction = Transaction(**kwargs)
516518

517519
if transaction.sampled is None:

sentry_sdk/tracing.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,9 @@ def __init__(
142142
self.trace_id = trace_id or uuid.uuid4().hex
143143

144144
if not span_id and _span_id_generator:
145-
span_id = "{:016x}".format(int(self.trace_id, 16) + next(_span_id_generator))
145+
span_id = "{:016x}".format(
146+
int(self.trace_id, 16) + next(_span_id_generator)
147+
)
146148

147149
if not span_id:
148150
span_id = uuid.uuid4().hex[16:]
@@ -222,7 +224,9 @@ def start_child(self, **kwargs):
222224
kwargs.setdefault("sampled", self.sampled)
223225

224226
rv = Span(
225-
trace_id=self.trace_id, span_id=None, parent_span_id=self.span_id,
227+
trace_id=self.trace_id,
228+
span_id=None,
229+
parent_span_id=self.span_id,
226230
_span_id_generator=self._span_id_generator,
227231
**kwargs
228232
)
@@ -460,7 +464,7 @@ def __init__(
460464
# next() on itertools.count() is a way to get-and-increment an integer
461465
# "atomically" on Python runtimes with a GIL
462466
if _ITERTOOLS_COUNT_IS_ATOMIC and kwargs.pop("_fast_span_ids", None):
463-
kwargs['_span_id_generator'] = itertools.count()
467+
kwargs["_span_id_generator"] = itertools.count()
464468

465469
Span.__init__(self, **kwargs)
466470
self.name = name

tests/test_tracing.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,12 @@
1616
@pytest.mark.parametrize("sample_rate", [0.0, 1.0])
1717
@pytest.mark.parametrize("num_spans", [1, 900])
1818
@pytest.mark.parametrize("fast_span_ids", [True, False])
19-
def test_basic(sentry_init, capture_events, sample_rate, num_spans, benchmark, fast_span_ids):
20-
sentry_init(traces_sample_rate=sample_rate, _experiments={"fast_span_ids": fast_span_ids})
19+
def test_basic(
20+
sentry_init, capture_events, sample_rate, num_spans, benchmark, fast_span_ids
21+
):
22+
sentry_init(
23+
traces_sample_rate=sample_rate, _experiments={"fast_span_ids": fast_span_ids}
24+
)
2125
events = capture_events()
2226

2327
@benchmark
@@ -35,7 +39,7 @@ def run():
3539
if sample_rate:
3640
event = events[0]
3741

38-
assert len(event['spans']) == num_spans + 1
42+
assert len(event["spans"]) == num_spans + 1
3943
span1, span2 = event["spans"][:2]
4044
parent_span = event
4145
assert span1["tags"]["status"] == "internal_error"

0 commit comments

Comments
 (0)