diff --git a/contrib/opencensus-ext-jaeger/tests/test_jaeger_exporter.py b/contrib/opencensus-ext-jaeger/tests/test_jaeger_exporter.py index d0e853786..5e6daddba 100644 --- a/contrib/opencensus-ext-jaeger/tests/test_jaeger_exporter.py +++ b/contrib/opencensus-ext-jaeger/tests/test_jaeger_exporter.py @@ -311,7 +311,7 @@ def test_translate_to_jaeger(self): operationName='test1', startTime=1502820146071158, duration=10000000, - flags=1, + flags=0, tags=[ jaeger.Tag( key='key_bool', vType=jaeger.TagType.BOOL, diff --git a/opencensus/trace/span_context.py b/opencensus/trace/span_context.py index a16b2d892..d2bbfc33a 100644 --- a/opencensus/trace/span_context.py +++ b/opencensus/trace/span_context.py @@ -19,7 +19,7 @@ import six import uuid -from opencensus.trace import trace_options +from opencensus.trace import trace_options as trace_options_module _INVALID_TRACE_ID = '0' * 32 INVALID_SPAN_ID = '0' * 16 @@ -27,11 +27,8 @@ TRACE_ID_PATTERN = re.compile('[0-9a-f]{32}?') SPAN_ID_PATTERN = re.compile('[0-9a-f]{16}?') -# Default options, enable tracing -DEFAULT_OPTIONS = 1 - -# Default trace options -DEFAULT = trace_options.TraceOptions(DEFAULT_OPTIONS) +# Default options, don't force sampling +DEFAULT_OPTIONS = '0' class SpanContext(object): @@ -65,7 +62,7 @@ def __init__( trace_id = generate_trace_id() if trace_options is None: - trace_options = DEFAULT + trace_options = trace_options_module.TraceOptions(DEFAULT_OPTIONS) self.from_header = from_header self.trace_id = self._check_trace_id(trace_id) diff --git a/tests/unit/trace/test_tracer.py b/tests/unit/trace/test_tracer.py index 32d303c07..1dd8412fd 100644 --- a/tests/unit/trace/test_tracer.py +++ b/tests/unit/trace/test_tracer.py @@ -91,9 +91,8 @@ def test_should_sample_not_sampled(self): self.assertFalse(sampled) - def get_tracer_noop_tracer(self): + def test_get_tracer_noop_tracer(self): from opencensus.trace.tracers import noop_tracer - sampler = mock.Mock() sampler.should_sample.return_value = False tracer = tracer_module.Tracer(sampler=sampler) @@ -102,7 +101,7 @@ def get_tracer_noop_tracer(self): assert isinstance(result, noop_tracer.NoopTracer) - def get_tracer_context_tracer(self): + def test_get_tracer_context_tracer(self): from opencensus.trace.tracers import context_tracer sampler = mock.Mock()