File tree Expand file tree Collapse file tree 3 files changed +28
-3
lines changed
src/opentelemetry/sdk/trace Expand file tree Collapse file tree 3 files changed +28
-3
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
11
11
12
12
## [ 1.6.1-0.25b1] ( https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.6.1-0.25b1 ) - 2021-10-18
13
13
14
+ - Fix ReadableSpan property types attempting to create a mapping from a list
15
+ ([ #2215 ] ( https://github.com/open-telemetry/opentelemetry-python/pull/2215 ) )
14
16
- Upgrade GRPC/protobuf related dependency and regenerate otlp protobufs
15
17
([ #2201 ] ( https://github.com/open-telemetry/opentelemetry-python/pull/2201 ) )
16
18
- Propagation: only warn about oversized baggage headers when headers exist
Original file line number Diff line number Diff line change @@ -350,7 +350,7 @@ def __init__(
350
350
parent : Optional [trace_api .SpanContext ] = None ,
351
351
resource : Resource = Resource .create ({}),
352
352
attributes : types .Attributes = None ,
353
- events : Sequence [Event ] = None ,
353
+ events : Sequence [Event ] = () ,
354
354
links : Sequence [trace_api .Link ] = (),
355
355
kind : trace_api .SpanKind = trace_api .SpanKind .INTERNAL ,
356
356
instrumentation_info : InstrumentationInfo = None ,
@@ -426,11 +426,11 @@ def attributes(self) -> types.Attributes:
426
426
427
427
@property
428
428
def events (self ) -> Sequence [Event ]:
429
- return MappingProxyType ( self ._events )
429
+ return tuple ( event for event in self ._events )
430
430
431
431
@property
432
432
def links (self ) -> Sequence [trace_api .Link ]:
433
- return MappingProxyType ( self ._links )
433
+ return tuple ( link for link in self ._links )
434
434
435
435
@property
436
436
def resource (self ) -> Resource :
Original file line number Diff line number Diff line change @@ -569,6 +569,29 @@ def test_surplus_span_attributes(self):
569
569
self .assertEqual (len (root .attributes ), max_attrs )
570
570
571
571
572
+ class TestReadableSpan (unittest .TestCase ):
573
+ def test_links (self ):
574
+ span = trace .ReadableSpan ()
575
+ self .assertEqual (span .links , ())
576
+
577
+ span = trace .ReadableSpan (
578
+ links = [trace_api .Link (context = trace_api .INVALID_SPAN_CONTEXT )] * 2 ,
579
+ )
580
+ self .assertEqual (len (span .links ), 2 )
581
+ for link in span .links :
582
+ self .assertFalse (link .context .is_valid )
583
+
584
+ def test_events (self ):
585
+ span = trace .ReadableSpan ()
586
+ self .assertEqual (span .events , ())
587
+ events = [
588
+ trace .Event ("foo1" , {"bar1" : "baz1" }),
589
+ trace .Event ("foo2" , {"bar2" : "baz2" }),
590
+ ]
591
+ span = trace .ReadableSpan (events = events )
592
+ self .assertEqual (span .events , tuple (events ))
593
+
594
+
572
595
class TestSpan (unittest .TestCase ):
573
596
# pylint: disable=too-many-public-methods
574
597
You can’t perform that action at this time.
0 commit comments