Skip to content

Commit

Permalink
Removed casting of fields
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonXZLiu committed Sep 17, 2020
1 parent 053b2b1 commit 02d7b3f
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions opentelemetry-api/src/opentelemetry/trace/span.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,9 @@ def get_default(cls) -> "TraceState":
DEFAULT_TRACE_STATE = TraceState.get_default()


class SpanContext(typing.Tuple[int, int, bool, "TraceFlags", "TraceState", bool]):
class SpanContext(
typing.Tuple[int, int, bool, "TraceFlags", "TraceState", bool]
):
"""The state of a Span to propagate between processes.
This class includes the immutable attributes of a :class:`.Span` that must
Expand Down Expand Up @@ -179,27 +181,27 @@ def __new__(

@property
def trace_id(self) -> int:
return int(self[0])
return self[0]

@property
def span_id(self) -> int:
return int(self[1])
return self[1]

@property
def is_remote(self) -> bool:
return bool(self[2])
return self[2]

@property
def trace_flags(self) -> "TraceFlags":
return TraceFlags(self[3])
return self[3]

@property
def trace_state(self) -> "TraceState":
return TraceState(self[4])
return self[4]

@property
def is_valid(self) -> bool:
return bool(self[5])
return self[5]

def __getattr__(self, *args: str) -> None:
raise TypeError
Expand Down

0 comments on commit 02d7b3f

Please sign in to comment.