Skip to content
This repository has been archived by the owner on Jul 11, 2022. It is now read-only.

Commit

Permalink
Change default for one_span_per_rpc to False (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
yurishkuro authored Dec 12, 2017
1 parent c4908a4 commit 7ebd5e0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion jaeger_client/tracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def __init__(self, service_name, reporter, sampler, metrics=None,
trace_id_header=constants.TRACE_ID_HEADER,
baggage_header_prefix=constants.BAGGAGE_HEADER_PREFIX,
debug_id_header=constants.DEBUG_ID_HEADER_KEY,
one_span_per_rpc=True, extra_codecs=None,
one_span_per_rpc=False, extra_codecs=None,
tags=None):
self.service_name = service_name
self.reporter = reporter
Expand Down
17 changes: 16 additions & 1 deletion tests/test_tracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def test_forced_sampling(tracer):
assert span.is_debug()


@pytest.mark.parametrize('mode', ['arg', 'ref'])
@pytest.mark.parametrize('mode,', ['arg', 'ref'])
def test_start_child(tracer, mode):
root = tracer.start_span("test")
if mode == 'arg':
Expand All @@ -90,6 +90,21 @@ def test_start_child(tracer, mode):
tracer.reporter.assert_called_once()
tracer.close()

@pytest.mark.parametrize('one_span_per_rpc,', [True, False])
def test_one_span_per_rpc(tracer, one_span_per_rpc):
tracer.one_span_per_rpc = one_span_per_rpc
span = tracer.start_span("client")
span.set_tag(ext_tags.SPAN_KIND, ext_tags.SPAN_KIND_RPC_CLIENT)
child = tracer.start_span(
"server",
references=child_of(span.context),
tags={ext_tags.SPAN_KIND: ext_tags.SPAN_KIND_RPC_SERVER},
)
assert span.trace_id == child.trace_id, "Must have the same trace ids"
if one_span_per_rpc:
assert span.span_id == child.span_id, "Must have the same span ids"
else:
assert span.span_id != child.span_id, "Must have different span ids"

def test_child_span(tracer):
span = tracer.start_span("test")
Expand Down

0 comments on commit 7ebd5e0

Please sign in to comment.