示例#1
0
    def __init__(
            self,
            name=None,
            parent_span=None,
            attributes=None,
            start_time=None,
            end_time=None,
            span_id=None,
            stack_trace=None,
            annotations=None,
            message_events=None,
            links=None,
            status=None,
            same_process_as_parent_span=None,
            context_tracer=None,
            span_kind=None):
        self.name = name
        self.parent_span = parent_span
        self.start_time = start_time
        self.end_time = end_time

        self.span_id = generate_span_id()
        self.parent_span = base.NullContextManager()

        self.attributes = {}
        self.stack_trace = stack_trace
        self.annotations = annotations
        self.message_events = message_events
        self.links = []
        self.status = status
        self.same_process_as_parent_span = same_process_as_parent_span
        self._child_spans = []
        self.context_tracer = context_tracer
        self.span_kind = span_kind
示例#2
0
    def __init__(self,
                 name,
                 parent_span=None,
                 attributes=None,
                 start_time=None,
                 end_time=None,
                 span_id=None,
                 stack_trace=None,
                 annotations=None,
                 message_events=None,
                 links=None,
                 status=None,
                 same_process_as_parent_span=None,
                 context_tracer=None,
                 span_kind=SpanKind.UNSPECIFIED):
        self.name = name
        self.parent_span = parent_span
        self.start_time = start_time
        self.end_time = end_time

        if span_id is None:
            span_id = generate_span_id()

        if attributes is None:
            self.attributes = BoundedDict(MAX_NUM_ATTRIBUTES)
        else:
            self.attributes = BoundedDict.from_map(MAX_NUM_ATTRIBUTES,
                                                   attributes)

        # Do not manipulate spans directly using the methods in Span Class,
        # make sure to use the Tracer.
        if parent_span is None:
            parent_span = base.NullContextManager()

        if annotations is None:
            self.annotations = BoundedList(MAX_NUM_ANNOTATIONS)
        else:
            self.annotations = BoundedList.from_seq(MAX_NUM_LINKS, annotations)

        if message_events is None:
            self.message_events = BoundedList(MAX_NUM_MESSAGE_EVENTS)
        else:
            self.message_events = BoundedList.from_seq(MAX_NUM_LINKS,
                                                       message_events)

        if links is None:
            self.links = BoundedList(MAX_NUM_LINKS)
        else:
            self.links = BoundedList.from_seq(MAX_NUM_LINKS, links)

        self.status = status_module.Status.as_ok(
        ) if status is None else status
        self.span_id = span_id
        self.stack_trace = stack_trace
        self.same_process_as_parent_span = same_process_as_parent_span
        self._child_spans = []
        self.context_tracer = context_tracer
        self.span_kind = span_kind
        for callback in Span._on_create_callbacks:
            callback(self)
示例#3
0
    def __init__(
            self,
            name,
            parent_span=None,
            attributes=None,
            start_time=None,
            end_time=None,
            span_id=None,
            stack_trace=None,
            time_events=None,
            links=None,
            status=None,
            same_process_as_parent_span=None,
            context_tracer=None,
            span_kind=SpanKind.UNSPECIFIED):
        self.name = name
        self.parent_span = parent_span
        self.start_time = start_time
        self.end_time = end_time

        if span_id is None:
            span_id = generate_span_id()

        if attributes is None:
            attributes = {}

        # Do not manipulate spans directly using the methods in Span Class,
        # make sure to use the Tracer.
        if parent_span is None:
            parent_span = base.NullContextManager()

        if time_events is None:
            time_events = []

        if links is None:
            links = []

        self.attributes = attributes
        self.span_id = span_id
        self.stack_trace = stack_trace
        self.time_events = time_events
        self.links = links
        self.status = status
        self.same_process_as_parent_span = same_process_as_parent_span
        self._child_spans = []
        self.context_tracer = context_tracer
        self.span_kind = span_kind
        for callback in Span._on_create_callbacks:
            callback(self)