You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ke...@apache.org on 2020/07/02 07:01:49 UTC

[skywalking-python] 01/01: [Core][BugFix] Add content equality of SegmentRef

This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch bugfix/equality-of-segment-ref
in repository https://gitbox.apache.org/repos/asf/skywalking-python.git

commit 7083b85dbba1d0beee982ef782b314a264b539e7
Author: kezhenxu94 <ke...@163.com>
AuthorDate: Thu Jul 2 15:01:36 2020 +0800

    [Core][BugFix] Add content equality of SegmentRef
---
 skywalking/trace/segment/__init__.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/skywalking/trace/segment/__init__.py b/skywalking/trace/segment/__init__.py
index bf1a71e..8062724 100644
--- a/skywalking/trace/segment/__init__.py
+++ b/skywalking/trace/segment/__init__.py
@@ -37,6 +37,18 @@ class SegmentRef(object):
         self.endpoint = carrier.endpoint  # type: str
         self.client_address = carrier.client_address  # type: str
 
+    def __eq__(self, other):
+        if not isinstance(other, SegmentRef):
+            raise NotImplemented
+        return self.ref_type == other.ref_type and \
+            self.trace_id == other.trace_id and \
+            self.segment_id == other.segment_id and \
+            self.span_id == other.span_id and \
+            self.service == other.service and \
+            self.service_instance == other.service_instance and \
+            self.endpoint == other.endpoint and \
+            self.client_address == other.client_address
+
 
 class _NewID(ID):
     pass