Skip to content

Commit

Permalink
s/trace/trace_/
Browse files Browse the repository at this point in the history
  • Loading branch information
c24t committed Aug 5, 2019
1 parent 89f1a0c commit 7a796e1
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 23 deletions.
22 changes: 11 additions & 11 deletions opentelemetry-api/src/opentelemetry/trace/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def get_default(cls) -> 'TraceOptions':
return cls(cls.DEFAULT)


DEFAULT_TRACEOPTIONS = TraceOptions.get_default()
DEFAULT_TRACE_OPTIONS = TraceOptions.get_default()


class TraceState(typing.Dict[str, str]):
Expand All @@ -141,7 +141,7 @@ def get_default(cls) -> 'TraceState':
return cls()


DEFAULT_TRACESTATE = TraceState.get_default()
DEFAULT_TRACE_STATE = TraceState.get_default()


def format_trace_id(trace_id: int) -> str:
Expand All @@ -168,17 +168,17 @@ class SpanContext:
def __init__(self,
trace_id: int,
span_id: int,
traceoptions: 'TraceOptions' = None,
tracestate: 'TraceState' = None
trace_options: 'TraceOptions' = None,
trace_state: 'TraceState' = None
) -> None:
if traceoptions is None:
traceoptions = DEFAULT_TRACEOPTIONS
if tracestate is None:
tracestate = DEFAULT_TRACESTATE
if trace_options is None:
trace_options = DEFAULT_TRACE_OPTIONS
if trace_state is None:
trace_state = DEFAULT_TRACE_STATE
self.trace_id = trace_id
self.span_id = span_id
self.traceoptions = traceoptions
self.tracestate = tracestate
self.trace_options = trace_options
self.trace_state = trace_state

def __repr__(self) -> str:
return ("{}(trace_id={}, span_id={})"
Expand Down Expand Up @@ -216,7 +216,7 @@ def get_context(self) -> 'SpanContext':
INVALID_SPAN_ID = 0x0000000000000000
INVALID_TRACE_ID = 0x00000000000000000000000000000000
INVALID_SPAN_CONTEXT = SpanContext(INVALID_TRACE_ID, INVALID_SPAN_ID,
DEFAULT_TRACEOPTIONS, DEFAULT_TRACESTATE)
DEFAULT_TRACE_OPTIONS, DEFAULT_TRACE_STATE)
INVALID_SPAN = DefaultSpan(INVALID_SPAN_CONTEXT)


Expand Down
4 changes: 2 additions & 2 deletions opentelemetry-api/tests/trace/test_defaultspan.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
class TestDefaultSpan(unittest.TestCase):
def test_ctor(self):
context = trace.SpanContext(1, 1,
trace.DEFAULT_TRACEOPTIONS,
trace.DEFAULT_TRACESTATE)
trace.DEFAULT_TRACE_OPTIONS,
trace.DEFAULT_TRACE_STATE)
span = trace.DefaultSpan(context)
self.assertEqual(context, span.get_context())

Expand Down
4 changes: 2 additions & 2 deletions opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,8 @@ def create_span(self,
context = trace_api.SpanContext(
parent_context.trace_id,
span_id,
parent_context.traceoptions,
parent_context.tracestate)
parent_context.trace_options,
parent_context.trace_state)
return Span(name=name, context=context, parent=parent)

@contextmanager
Expand Down
16 changes: 8 additions & 8 deletions opentelemetry-sdk/tests/trace/test_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ def test_start_span_implicit(self):
self.assertEqual(root_context.trace_id, child_context.trace_id)
self.assertNotEqual(root_context.span_id,
child_context.span_id)
self.assertEqual(root_context.tracestate,
child_context.tracestate)
self.assertEqual(root_context.traceoptions,
child_context.traceoptions)
self.assertEqual(root_context.trace_state,
child_context.trace_state)
self.assertEqual(root_context.trace_options,
child_context.trace_options)

# After exiting the child's scope the parent should become the
# current span again.
Expand Down Expand Up @@ -103,10 +103,10 @@ def test_start_span_explicit(self):
self.assertEqual(other_parent.trace_id, child_context.trace_id)
self.assertNotEqual(other_parent.span_id,
child_context.span_id)
self.assertEqual(other_parent.tracestate,
child_context.tracestate)
self.assertEqual(other_parent.traceoptions,
child_context.traceoptions)
self.assertEqual(other_parent.trace_state,
child_context.trace_state)
self.assertEqual(other_parent.trace_options,
child_context.trace_options)

# After exiting the child's scope the last span on the stack should
# become current, not the child's parent.
Expand Down

0 comments on commit 7a796e1

Please sign in to comment.