Пример #1
0
    def stop(self, span: Span) -> bool:
        assert span is self.spans[-1]

        span.finish(self.segment) and self.spans.pop()

        if len(self.spans) == 0:
            _thread_local.context = None
            agent.archive(self.segment)

        return len(self.spans) == 0
Пример #2
0
    def stop(self, span: Span) -> bool:
        spans = _spans()
        span.finish(self.segment)
        del spans[spans.index(span)]

        self._nspans -= 1
        if self._nspans == 0:
            _local().context = None
            agent.archive(self.segment)
            return True

        return False
Пример #3
0
    def stop(self, span: Span) -> bool:
        spans = _spans()
        span.finish(self.segment)

        try:
            spans.remove(span)
        except Exception:
            pass

        self._nspans -= 1
        if self._nspans == 0:
            agent.archive(self.segment)
            return True

        return False
Пример #4
0
    def new_local_span(self, op: str) -> Span:
        parent = self.spans[-1] if self.spans else None  # type: Span

        return Span(
            context=self,
            sid=self._sid.next(),
            pid=parent.sid if parent else -1,
            op=op,
            kind=Kind.Local,
        )
Пример #5
0
    def stop(self, span: Span) -> bool:
        spans = _spans()
        idx = spans.index(
            span
        )  # span SHOULD now always be at end even in async-world, but just in case

        if span.finish(self.segment):
            del spans[idx]

        if len(spans) == 0:
            _local().context = None
            agent.archive(self.segment)

        return len(spans) == 0
Пример #6
0
    def new_local_span(self, op: str) -> Span:
        span = self.ignore_check(op, Kind.Local)
        if span is not None:
            return span

        parent = self.spans[-1] if self.spans else None  # type: Span

        return Span(
            context=self,
            sid=self._sid.next(),
            pid=parent.sid if parent else -1,
            op=op,
            kind=Kind.Local,
        )