Superskyyy commented on code in PR #231:
URL: https://github.com/apache/skywalking-python/pull/231#discussion_r951745533


##########
skywalking/meter/meter.py:
##########
@@ -0,0 +1,115 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+from abc import ABC, abstractmethod
+from skywalking.protocol.language_agent.Meter_pb2 import Label
+
+from enum import Enum
+class MeterType(Enum):
+     GAUGE = 1
+     COUNTER = 2
+     HISTOGRAM = 3
+
+class MeterTag():
+    def __init__(self, key: str, value: str):
+        self.key = key
+        self.value = value
+    
+    def __lt__(self, other):
+        if self.key != other.key:
+            return self.key < other.key
+        else:
+            return self.value < other.value
+    
+    def getKey(self):
+        return self.key
+    
+    def getValue(self):
+        return self.value
+
+    def __hash__(self) -> int:
+        return hash((self.key, self.value))
+
+class MeterId():
+    def __init__(self, name: str, type, tags: list) -> None:
+        self.name = name
+        self.type = type
+        self.tags = tags
+        self.labels = None
+    
+    def transformTags(self):
+        if self.labels != None:
+            return self.labels
+
+        self.labels = list(map(lambda tag: Label(name=tag.key, 
value=tag.value), self.tags))
+        return self.labels
+    
+    def getName(self):
+        return self.name
+    
+    def getTags(self):
+        return self.tags
+    
+    def getType(self):
+        return self.type
+    
+    def __hash__(self):
+        return hash((self.name, self.type, tuple(self.tags)))
+
+
+class BaseMeter():

Review Comment:
   Missing a ABC here, otherwise the @abstractmethod won't work as expected



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to