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 09:42:51 UTC

[skywalking-python] branch master updated: [Core][BugFix] Add content equality of SegmentRef (#30)

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

kezhenxu94 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking-python.git


The following commit(s) were added to refs/heads/master by this push:
     new 1736c24  [Core][BugFix] Add content equality of SegmentRef (#30)
1736c24 is described below

commit 1736c2490c62b44f27e526d515551b6bca086d0b
Author: kezhenxu94 <ke...@apache.org>
AuthorDate: Thu Jul 2 17:42:45 2020 +0800

    [Core][BugFix] Add content equality of SegmentRef (#30)
---
 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..4a8d905 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 NotImplementedError
+        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