Skip to content

Commit

Permalink
Add some repr()s to basic trace types. (#1485)
Browse files Browse the repository at this point in the history
  • Loading branch information
Oberon00 authored Dec 18, 2020
1 parent 1cc23e0 commit 753ec6c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#1420](https://github.com/open-telemetry/opentelemetry-python/pull/1420))
- `opentelemetry-exporter-zipkin` Add support for array attributes in Span and Resource exports
([#1285](https://github.com/open-telemetry/opentelemetry-python/pull/1285))
- Added `__repr__` for `DefaultSpan`, added `trace_flags` to `__repr__` of
`SpanContext` ([#1485](https://github.com/open-telemetry/opentelemetry-python/pull/1485)])

## [0.16b1](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v0.16b1) - 2020-11-26
### Added
Expand Down
6 changes: 5 additions & 1 deletion opentelemetry-api/src/opentelemetry/trace/span.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,12 @@ def __delattr__(self, *args: str) -> None:

def __repr__(self) -> str:
return (
"{}(trace_id={}, span_id={}, trace_state={!r}, is_remote={})"
"{}(trace_id={}, span_id={}, trace_flags=0x{:02x}, trace_state={!r}, is_remote={})"
).format(
type(self).__name__,
format_trace_id(self.trace_id),
format_span_id(self.span_id),
self.trace_flags,
self.trace_state,
self.is_remote,
)
Expand Down Expand Up @@ -291,6 +292,9 @@ def record_exception(
) -> None:
pass

def __repr__(self) -> str:
return "DefaultSpan({!r})".format(self._context)


INVALID_SPAN_ID = 0x0000000000000000
INVALID_TRACE_ID = 0x00000000000000000000000000000000
Expand Down

0 comments on commit 753ec6c

Please sign in to comment.