Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add isSizeLimited in SegmentObject #367

Merged
merged 1 commit into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions skywalking/agent/protocol/grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions skywalking/agent/protocol/grpc_aio.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions skywalking/agent/protocol/kafka.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions skywalking/agent/protocol/kafka_aio.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions skywalking/client/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions skywalking/client/http_aio.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
9 changes: 5 additions & 4 deletions skywalking/trace/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand Down Expand Up @@ -136,15 +136,15 @@ 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

parent = self.peek()
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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions skywalking/trace/segment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading