From 7a796e16fb15a22a3b97085db3dbca480657ccbf Mon Sep 17 00:00:00 2001 From: Chris Kleinknecht Date: Mon, 5 Aug 2019 12:00:30 -0700 Subject: [PATCH] s/trace/trace_/ --- .../src/opentelemetry/trace/__init__.py | 22 +++++++++---------- .../tests/trace/test_defaultspan.py | 4 ++-- .../src/opentelemetry/sdk/trace/__init__.py | 4 ++-- opentelemetry-sdk/tests/trace/test_trace.py | 16 +++++++------- 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/opentelemetry-api/src/opentelemetry/trace/__init__.py b/opentelemetry-api/src/opentelemetry/trace/__init__.py index 34580c81b9a..6c873002e49 100644 --- a/opentelemetry-api/src/opentelemetry/trace/__init__.py +++ b/opentelemetry-api/src/opentelemetry/trace/__init__.py @@ -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]): @@ -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: @@ -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={})" @@ -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) diff --git a/opentelemetry-api/tests/trace/test_defaultspan.py b/opentelemetry-api/tests/trace/test_defaultspan.py index 9e6b57dc3df..b3155d32615 100644 --- a/opentelemetry-api/tests/trace/test_defaultspan.py +++ b/opentelemetry-api/tests/trace/test_defaultspan.py @@ -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()) diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py b/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py index 13a1fff1196..d6af5779654 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py @@ -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 diff --git a/opentelemetry-sdk/tests/trace/test_trace.py b/opentelemetry-sdk/tests/trace/test_trace.py index f0432f08ca7..7a91d23765e 100644 --- a/opentelemetry-sdk/tests/trace/test_trace.py +++ b/opentelemetry-sdk/tests/trace/test_trace.py @@ -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. @@ -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.