|
30 | 30 | Dict,
|
31 | 31 | Iterator,
|
32 | 32 | List,
|
| 33 | + MutableMapping, |
33 | 34 | Optional,
|
34 | 35 | Sequence,
|
35 | 36 | Tuple,
|
@@ -745,17 +746,17 @@ def __init__(
|
745 | 746 | parent: Optional[trace_api.SpanContext] = None,
|
746 | 747 | sampler: Optional[sampling.Sampler] = None,
|
747 | 748 | trace_config: None = None, # TODO
|
748 |
| - resource: Resource = None, |
| 749 | + resource: Optional[Resource] = None, |
749 | 750 | attributes: types.Attributes = None,
|
750 |
| - events: Sequence[Event] = None, |
| 751 | + events: Optional[Sequence[Event]] = None, |
751 | 752 | links: Sequence[trace_api.Link] = (),
|
752 | 753 | kind: trace_api.SpanKind = trace_api.SpanKind.INTERNAL,
|
753 | 754 | span_processor: SpanProcessor = SpanProcessor(),
|
754 |
| - instrumentation_info: InstrumentationInfo = None, |
| 755 | + instrumentation_info: Optional[InstrumentationInfo] = None, |
755 | 756 | record_exception: bool = True,
|
756 | 757 | set_status_on_exception: bool = True,
|
757 | 758 | limits=_UnsetLimits,
|
758 |
| - instrumentation_scope: InstrumentationScope = None, |
| 759 | + instrumentation_scope: Optional[InstrumentationScope] = None, |
759 | 760 | ) -> None:
|
760 | 761 | if resource is None:
|
761 | 762 | resource = Resource.create({})
|
@@ -994,7 +995,7 @@ def record_exception(
|
994 | 995 | type(exception), value=exception, tb=exception.__traceback__
|
995 | 996 | )
|
996 | 997 | )
|
997 |
| - _attributes = { |
| 998 | + _attributes: MutableMapping[str, types.AttributeValue] = { |
998 | 999 | "exception.type": exception.__class__.__name__,
|
999 | 1000 | "exception.message": str(exception),
|
1000 | 1001 | "exception.stacktrace": stacktrace,
|
@@ -1045,7 +1046,7 @@ def start_as_current_span(
|
1045 | 1046 | context: Optional[context_api.Context] = None,
|
1046 | 1047 | kind: trace_api.SpanKind = trace_api.SpanKind.INTERNAL,
|
1047 | 1048 | attributes: types.Attributes = None,
|
1048 |
| - links: Sequence[trace_api.Link] = (), |
| 1049 | + links: Optional[Sequence[trace_api.Link]] = (), |
1049 | 1050 | start_time: Optional[int] = None,
|
1050 | 1051 | record_exception: bool = True,
|
1051 | 1052 | set_status_on_exception: bool = True,
|
@@ -1075,7 +1076,7 @@ def start_span( # pylint: disable=too-many-locals
|
1075 | 1076 | context: Optional[context_api.Context] = None,
|
1076 | 1077 | kind: trace_api.SpanKind = trace_api.SpanKind.INTERNAL,
|
1077 | 1078 | attributes: types.Attributes = None,
|
1078 |
| - links: Sequence[trace_api.Link] = (), |
| 1079 | + links: Optional[Sequence[trace_api.Link]] = (), |
1079 | 1080 | start_time: Optional[int] = None,
|
1080 | 1081 | record_exception: bool = True,
|
1081 | 1082 | set_status_on_exception: bool = True,
|
@@ -1152,15 +1153,15 @@ class TracerProvider(trace_api.TracerProvider):
|
1152 | 1153 |
|
1153 | 1154 | def __init__(
|
1154 | 1155 | self,
|
1155 |
| - sampler: sampling.Sampler = None, |
1156 |
| - resource: Resource = None, |
| 1156 | + sampler: Optional[sampling.Sampler] = None, |
| 1157 | + resource: Optional[Resource] = None, |
1157 | 1158 | shutdown_on_exit: bool = True,
|
1158 | 1159 | active_span_processor: Union[
|
1159 |
| - SynchronousMultiSpanProcessor, ConcurrentMultiSpanProcessor |
| 1160 | + SynchronousMultiSpanProcessor, ConcurrentMultiSpanProcessor, None |
1160 | 1161 | ] = None,
|
1161 |
| - id_generator: IdGenerator = None, |
1162 |
| - span_limits: SpanLimits = None, |
1163 |
| - ): |
| 1162 | + id_generator: Optional[IdGenerator] = None, |
| 1163 | + span_limits: Optional[SpanLimits] = None, |
| 1164 | + ) -> None: |
1164 | 1165 | self._active_span_processor = (
|
1165 | 1166 | active_span_processor or SynchronousMultiSpanProcessor()
|
1166 | 1167 | )
|
|
0 commit comments