diff --git a/CHANGELOG.md b/CHANGELOG.md index da064e23..fb073318 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,8 @@ - Feature: - Drop support for 3.7 (#356) - Support sampling rate setup. Provide `SW_SAMPLE_N_PER_3_SECS` environment variable to control it (#357) - - Add suport for 3.13 (#366) + - Add support for 3.13 (#366) + - Add isSizeLimited in SegmentObject (#367) - Plugins: - Add gRPC plugin (#362) diff --git a/skywalking/agent/protocol/grpc.py b/skywalking/agent/protocol/grpc.py index b70240ee..bd669d7a 100644 --- a/skywalking/agent/protocol/grpc.py +++ b/skywalking/agent/protocol/grpc.py @@ -119,6 +119,7 @@ def generator(): traceSegmentId=str(segment.segment_id), service=config.agent_name, serviceInstance=config.agent_instance_name, + isSizeLimited=segment.is_size_limited, spans=[SpanObject( spanId=span.sid, parentSpanId=span.pid, diff --git a/skywalking/agent/protocol/grpc_aio.py b/skywalking/agent/protocol/grpc_aio.py index 7b95a33a..54198c4c 100644 --- a/skywalking/agent/protocol/grpc_aio.py +++ b/skywalking/agent/protocol/grpc_aio.py @@ -108,6 +108,7 @@ async def generator(): traceSegmentId=str(segment.segment_id), service=config.agent_name, serviceInstance=config.agent_instance_name, + isSizeLimited=segment.is_size_limited, spans=[SpanObject( spanId=span.sid, parentSpanId=span.pid, diff --git a/skywalking/agent/protocol/kafka.py b/skywalking/agent/protocol/kafka.py index 8c3df5c5..11e82f1f 100644 --- a/skywalking/agent/protocol/kafka.py +++ b/skywalking/agent/protocol/kafka.py @@ -73,6 +73,7 @@ def generator(): traceSegmentId=str(segment.segment_id), service=config.agent_name, serviceInstance=config.agent_instance_name, + isSizeLimited=segment.is_size_limited, spans=[SpanObject( spanId=span.sid, parentSpanId=span.pid, diff --git a/skywalking/agent/protocol/kafka_aio.py b/skywalking/agent/protocol/kafka_aio.py index 321bde1d..bd9933c6 100644 --- a/skywalking/agent/protocol/kafka_aio.py +++ b/skywalking/agent/protocol/kafka_aio.py @@ -60,6 +60,7 @@ async def generator(): traceSegmentId=str(segment.segment_id), service=config.agent_name, serviceInstance=config.agent_instance_name, + isSizeLimited=segment.is_size_limited, spans=[SpanObject( spanId=span.sid, parentSpanId=span.pid, diff --git a/skywalking/client/http.py b/skywalking/client/http.py index bc35fd64..d880cd2f 100644 --- a/skywalking/client/http.py +++ b/skywalking/client/http.py @@ -72,6 +72,7 @@ def report(self, generator): 'traceSegmentId': str(segment.segment_id), 'service': config.agent_name, 'serviceInstance': config.agent_instance_name, + 'isSizeLimited': segment.is_size_limited, 'spans': [{ 'spanId': span.sid, 'parentSpanId': span.pid, diff --git a/skywalking/client/http_aio.py b/skywalking/client/http_aio.py index cbf3bbaa..899ecb0a 100644 --- a/skywalking/client/http_aio.py +++ b/skywalking/client/http_aio.py @@ -78,6 +78,7 @@ async def report(self, generator): 'traceSegmentId': str(segment.segment_id), 'service': config.agent_name, 'serviceInstance': config.agent_instance_name, + 'isSizeLimited': segment.is_size_limited, 'spans': [{ 'spanId': span.sid, 'parentSpanId': span.pid, diff --git a/skywalking/trace/context.py b/skywalking/trace/context.py index 11ec3da9..3a86a869 100644 --- a/skywalking/trace/context.py +++ b/skywalking/trace/context.py @@ -104,7 +104,7 @@ def __init__(self): self.primary_endpoint: Optional[PrimaryEndpoint] = None @staticmethod - def ignore_check(op: str, kind: Kind, carrier: Optional[Carrier] = None): + def ignore_check(op: str, carrier: Optional[Carrier] = None): if config.RE_IGNORE_PATH.match(op) or agent.is_segment_queue_full() or (carrier is not None and carrier.is_suppressed): return NoopSpan(context=NoopContext()) @@ -136,7 +136,7 @@ def new_span(self, parent: Optional[Span], SpanType: type, **kwargs) -> Span: # return span def new_local_span(self, op: str) -> Span: - span = self.ignore_check(op, Kind.Local) + span = self.ignore_check(op) if span is not None: return span @@ -144,7 +144,7 @@ def new_local_span(self, op: str) -> Span: return self.new_span(parent, Span, op=op, kind=Kind.Local) def new_entry_span(self, op: str, carrier: Optional[Carrier] = None, inherit: Optional[Component] = None) -> Span: - span = self.ignore_check(op, Kind.Entry, carrier) + span = self.ignore_check(op, carrier) if span is not None: return span @@ -173,7 +173,7 @@ def new_entry_span(self, op: str, carrier: Optional[Carrier] = None, inherit: Op def new_exit_span(self, op: str, peer: str, component: Optional[Component] = None, inherit: Optional[Component] = None) -> Span: - span = self.ignore_check(op, Kind.Exit) + span = self.ignore_check(op) if span is not None: return span @@ -222,6 +222,7 @@ def stop(self, span: Span) -> bool: self._nspans -= 1 if self._nspans == 0: + self.segment.is_size_limited = agent.is_segment_queue_full() agent.archive_segment(self.segment) return True diff --git a/skywalking/trace/segment.py b/skywalking/trace/segment.py index 31ebddd0..54e241bd 100644 --- a/skywalking/trace/segment.py +++ b/skywalking/trace/segment.py @@ -81,6 +81,7 @@ def __init__(self): self.spans = [] # type: List[Span] self.timestamp = int(time.time() * 1000) # type: int self.related_traces = [_NewID()] # type: List[ID] + self.is_size_limited = False # type: bool def archive(self, span: 'Span'): self.spans.append(span)