Browse Source

HUE-8704 [jb] Update generated thrift for profile.

jdesjean 6 years ago
parent
commit
3ea64aa7b0

+ 2 - 2
desktop/libs/libanalyze/gen-py/Metrics/constants.py

@@ -1,9 +1,9 @@
 #
-# Autogenerated by Thrift Compiler (0.9.0)
+# Autogenerated by Thrift Compiler (0.9.3)
 #
 # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 #
-#  options string: py
+#  options string: py:new_style
 #
 
 from thrift.Thrift import TType, TMessageType, TException, TApplicationException

+ 7 - 4
desktop/libs/libanalyze/gen-py/Metrics/ttypes.py

@@ -1,9 +1,9 @@
 #
-# Autogenerated by Thrift Compiler (0.9.0)
+# Autogenerated by Thrift Compiler (0.9.3)
 #
 # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 #
-#  options string: py
+#  options string: py:new_style
 #
 
 from thrift.Thrift import TType, TMessageType, TException, TApplicationException
@@ -16,7 +16,7 @@ except:
   fastbinary = None
 
 
-class TUnit:
+class TUnit(object):
   UNIT = 0
   UNIT_PER_SECOND = 1
   CPU_TICKS = 2
@@ -27,6 +27,7 @@ class TUnit:
   NONE = 7
   TIME_MS = 8
   TIME_S = 9
+  TIME_US = 10
 
   _VALUES_TO_NAMES = {
     0: "UNIT",
@@ -39,6 +40,7 @@ class TUnit:
     7: "NONE",
     8: "TIME_MS",
     9: "TIME_S",
+    10: "TIME_US",
   }
 
   _NAMES_TO_VALUES = {
@@ -52,9 +54,10 @@ class TUnit:
     "NONE": 7,
     "TIME_MS": 8,
     "TIME_S": 9,
+    "TIME_US": 10,
   }
 
-class TMetricKind:
+class TMetricKind(object):
   GAUGE = 0
   COUNTER = 1
   PROPERTY = 2

+ 2 - 2
desktop/libs/libanalyze/gen-py/RuntimeProfile/constants.py

@@ -1,9 +1,9 @@
 #
-# Autogenerated by Thrift Compiler (0.9.0)
+# Autogenerated by Thrift Compiler (0.9.3)
 #
 # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 #
-#  options string: py
+#  options string: py:new_style
 #
 
 from thrift.Thrift import TType, TMessageType, TException, TApplicationException

+ 255 - 50
desktop/libs/libanalyze/gen-py/RuntimeProfile/ttypes.py

@@ -1,9 +1,9 @@
 #
-# Autogenerated by Thrift Compiler (0.9.0)
+# Autogenerated by Thrift Compiler (0.9.3)
 #
 # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 #
-#  options string: py
+#  options string: py:new_style
 #
 
 from thrift.Thrift import TType, TMessageType, TException, TApplicationException
@@ -19,7 +19,7 @@ except:
 
 
 
-class TCounter:
+class TCounter(object):
   """
   Attributes:
    - name
@@ -50,17 +50,17 @@ class TCounter:
         break
       if fid == 1:
         if ftype == TType.STRING:
-          self.name = iprot.readString();
+          self.name = iprot.readString()
         else:
           iprot.skip(ftype)
       elif fid == 2:
         if ftype == TType.I32:
-          self.unit = iprot.readI32();
+          self.unit = iprot.readI32()
         else:
           iprot.skip(ftype)
       elif fid == 3:
         if ftype == TType.I64:
-          self.value = iprot.readI64();
+          self.value = iprot.readI64()
         else:
           iprot.skip(ftype)
       else:
@@ -98,6 +98,13 @@ class TCounter:
     return
 
 
+  def __hash__(self):
+    value = 17
+    value = (value * 31) ^ hash(self.name)
+    value = (value * 31) ^ hash(self.unit)
+    value = (value * 31) ^ hash(self.value)
+    return value
+
   def __repr__(self):
     L = ['%s=%r' % (key, value)
       for key, value in self.__dict__.iteritems()]
@@ -109,7 +116,7 @@ class TCounter:
   def __ne__(self, other):
     return not (self == other)
 
-class TEventSequence:
+class TEventSequence(object):
   """
   Attributes:
    - name
@@ -140,7 +147,7 @@ class TEventSequence:
         break
       if fid == 1:
         if ftype == TType.STRING:
-          self.name = iprot.readString();
+          self.name = iprot.readString()
         else:
           iprot.skip(ftype)
       elif fid == 2:
@@ -148,7 +155,7 @@ class TEventSequence:
           self.timestamps = []
           (_etype3, _size0) = iprot.readListBegin()
           for _i4 in xrange(_size0):
-            _elem5 = iprot.readI64();
+            _elem5 = iprot.readI64()
             self.timestamps.append(_elem5)
           iprot.readListEnd()
         else:
@@ -158,7 +165,7 @@ class TEventSequence:
           self.labels = []
           (_etype9, _size6) = iprot.readListBegin()
           for _i10 in xrange(_size6):
-            _elem11 = iprot.readString();
+            _elem11 = iprot.readString()
             self.labels.append(_elem11)
           iprot.readListEnd()
         else:
@@ -204,6 +211,13 @@ class TEventSequence:
     return
 
 
+  def __hash__(self):
+    value = 17
+    value = (value * 31) ^ hash(self.name)
+    value = (value * 31) ^ hash(self.timestamps)
+    value = (value * 31) ^ hash(self.labels)
+    return value
+
   def __repr__(self):
     L = ['%s=%r' % (key, value)
       for key, value in self.__dict__.iteritems()]
@@ -215,7 +229,7 @@ class TEventSequence:
   def __ne__(self, other):
     return not (self == other)
 
-class TTimeSeriesCounter:
+class TTimeSeriesCounter(object):
   """
   Attributes:
    - name
@@ -249,17 +263,17 @@ class TTimeSeriesCounter:
         break
       if fid == 1:
         if ftype == TType.STRING:
-          self.name = iprot.readString();
+          self.name = iprot.readString()
         else:
           iprot.skip(ftype)
       elif fid == 2:
         if ftype == TType.I32:
-          self.unit = iprot.readI32();
+          self.unit = iprot.readI32()
         else:
           iprot.skip(ftype)
       elif fid == 3:
         if ftype == TType.I32:
-          self.period_ms = iprot.readI32();
+          self.period_ms = iprot.readI32()
         else:
           iprot.skip(ftype)
       elif fid == 4:
@@ -267,7 +281,7 @@ class TTimeSeriesCounter:
           self.values = []
           (_etype17, _size14) = iprot.readListBegin()
           for _i18 in xrange(_size14):
-            _elem19 = iprot.readI64();
+            _elem19 = iprot.readI64()
             self.values.append(_elem19)
           iprot.readListEnd()
         else:
@@ -316,6 +330,14 @@ class TTimeSeriesCounter:
     return
 
 
+  def __hash__(self):
+    value = 17
+    value = (value * 31) ^ hash(self.name)
+    value = (value * 31) ^ hash(self.unit)
+    value = (value * 31) ^ hash(self.period_ms)
+    value = (value * 31) ^ hash(self.values)
+    return value
+
   def __repr__(self):
     L = ['%s=%r' % (key, value)
       for key, value in self.__dict__.iteritems()]
@@ -327,7 +349,149 @@ class TTimeSeriesCounter:
   def __ne__(self, other):
     return not (self == other)
 
-class TRuntimeProfileNode:
+class TSummaryStatsCounter(object):
+  """
+  Attributes:
+   - name
+   - unit
+   - sum
+   - total_num_values
+   - min_value
+   - max_value
+  """
+
+  thrift_spec = (
+    None, # 0
+    (1, TType.STRING, 'name', None, None, ), # 1
+    (2, TType.I32, 'unit', None, None, ), # 2
+    (3, TType.I64, 'sum', None, None, ), # 3
+    (4, TType.I64, 'total_num_values', None, None, ), # 4
+    (5, TType.I64, 'min_value', None, None, ), # 5
+    (6, TType.I64, 'max_value', None, None, ), # 6
+  )
+
+  def __init__(self, name=None, unit=None, sum=None, total_num_values=None, min_value=None, max_value=None,):
+    self.name = name
+    self.unit = unit
+    self.sum = sum
+    self.total_num_values = total_num_values
+    self.min_value = min_value
+    self.max_value = max_value
+
+  def read(self, iprot):
+    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
+      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
+      return
+    iprot.readStructBegin()
+    while True:
+      (fname, ftype, fid) = iprot.readFieldBegin()
+      if ftype == TType.STOP:
+        break
+      if fid == 1:
+        if ftype == TType.STRING:
+          self.name = iprot.readString()
+        else:
+          iprot.skip(ftype)
+      elif fid == 2:
+        if ftype == TType.I32:
+          self.unit = iprot.readI32()
+        else:
+          iprot.skip(ftype)
+      elif fid == 3:
+        if ftype == TType.I64:
+          self.sum = iprot.readI64()
+        else:
+          iprot.skip(ftype)
+      elif fid == 4:
+        if ftype == TType.I64:
+          self.total_num_values = iprot.readI64()
+        else:
+          iprot.skip(ftype)
+      elif fid == 5:
+        if ftype == TType.I64:
+          self.min_value = iprot.readI64()
+        else:
+          iprot.skip(ftype)
+      elif fid == 6:
+        if ftype == TType.I64:
+          self.max_value = iprot.readI64()
+        else:
+          iprot.skip(ftype)
+      else:
+        iprot.skip(ftype)
+      iprot.readFieldEnd()
+    iprot.readStructEnd()
+
+  def write(self, oprot):
+    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
+      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
+      return
+    oprot.writeStructBegin('TSummaryStatsCounter')
+    if self.name is not None:
+      oprot.writeFieldBegin('name', TType.STRING, 1)
+      oprot.writeString(self.name)
+      oprot.writeFieldEnd()
+    if self.unit is not None:
+      oprot.writeFieldBegin('unit', TType.I32, 2)
+      oprot.writeI32(self.unit)
+      oprot.writeFieldEnd()
+    if self.sum is not None:
+      oprot.writeFieldBegin('sum', TType.I64, 3)
+      oprot.writeI64(self.sum)
+      oprot.writeFieldEnd()
+    if self.total_num_values is not None:
+      oprot.writeFieldBegin('total_num_values', TType.I64, 4)
+      oprot.writeI64(self.total_num_values)
+      oprot.writeFieldEnd()
+    if self.min_value is not None:
+      oprot.writeFieldBegin('min_value', TType.I64, 5)
+      oprot.writeI64(self.min_value)
+      oprot.writeFieldEnd()
+    if self.max_value is not None:
+      oprot.writeFieldBegin('max_value', TType.I64, 6)
+      oprot.writeI64(self.max_value)
+      oprot.writeFieldEnd()
+    oprot.writeFieldStop()
+    oprot.writeStructEnd()
+
+  def validate(self):
+    if self.name is None:
+      raise TProtocol.TProtocolException(message='Required field name is unset!')
+    if self.unit is None:
+      raise TProtocol.TProtocolException(message='Required field unit is unset!')
+    if self.sum is None:
+      raise TProtocol.TProtocolException(message='Required field sum is unset!')
+    if self.total_num_values is None:
+      raise TProtocol.TProtocolException(message='Required field total_num_values is unset!')
+    if self.min_value is None:
+      raise TProtocol.TProtocolException(message='Required field min_value is unset!')
+    if self.max_value is None:
+      raise TProtocol.TProtocolException(message='Required field max_value is unset!')
+    return
+
+
+  def __hash__(self):
+    value = 17
+    value = (value * 31) ^ hash(self.name)
+    value = (value * 31) ^ hash(self.unit)
+    value = (value * 31) ^ hash(self.sum)
+    value = (value * 31) ^ hash(self.total_num_values)
+    value = (value * 31) ^ hash(self.min_value)
+    value = (value * 31) ^ hash(self.max_value)
+    return value
+
+  def __repr__(self):
+    L = ['%s=%r' % (key, value)
+      for key, value in self.__dict__.iteritems()]
+    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
+
+  def __eq__(self, other):
+    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+  def __ne__(self, other):
+    return not (self == other)
+
+class TRuntimeProfileNode(object):
   """
   Attributes:
    - name
@@ -340,6 +504,7 @@ class TRuntimeProfileNode:
    - child_counters_map
    - event_sequences
    - time_series_counters
+   - summary_stats_counters
   """
 
   thrift_spec = (
@@ -354,9 +519,10 @@ class TRuntimeProfileNode:
     (8, TType.MAP, 'child_counters_map', (TType.STRING,None,TType.SET,(TType.STRING,None)), None, ), # 8
     (9, TType.LIST, 'event_sequences', (TType.STRUCT,(TEventSequence, TEventSequence.thrift_spec)), None, ), # 9
     (10, TType.LIST, 'time_series_counters', (TType.STRUCT,(TTimeSeriesCounter, TTimeSeriesCounter.thrift_spec)), None, ), # 10
+    (11, TType.LIST, 'summary_stats_counters', (TType.STRUCT,(TSummaryStatsCounter, TSummaryStatsCounter.thrift_spec)), None, ), # 11
   )
 
-  def __init__(self, name=None, num_children=None, counters=None, metadata=None, indent=None, info_strings=None, info_strings_display_order=None, child_counters_map=None, event_sequences=None, time_series_counters=None,):
+  def __init__(self, name=None, num_children=None, counters=None, metadata=None, indent=None, info_strings=None, info_strings_display_order=None, child_counters_map=None, event_sequences=None, time_series_counters=None, summary_stats_counters=None,):
     self.name = name
     self.num_children = num_children
     self.counters = counters
@@ -367,6 +533,7 @@ class TRuntimeProfileNode:
     self.child_counters_map = child_counters_map
     self.event_sequences = event_sequences
     self.time_series_counters = time_series_counters
+    self.summary_stats_counters = summary_stats_counters
 
   def read(self, iprot):
     if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
@@ -379,12 +546,12 @@ class TRuntimeProfileNode:
         break
       if fid == 1:
         if ftype == TType.STRING:
-          self.name = iprot.readString();
+          self.name = iprot.readString()
         else:
           iprot.skip(ftype)
       elif fid == 2:
         if ftype == TType.I32:
-          self.num_children = iprot.readI32();
+          self.num_children = iprot.readI32()
         else:
           iprot.skip(ftype)
       elif fid == 3:
@@ -400,12 +567,12 @@ class TRuntimeProfileNode:
           iprot.skip(ftype)
       elif fid == 4:
         if ftype == TType.I64:
-          self.metadata = iprot.readI64();
+          self.metadata = iprot.readI64()
         else:
           iprot.skip(ftype)
       elif fid == 5:
         if ftype == TType.BOOL:
-          self.indent = iprot.readBool();
+          self.indent = iprot.readBool()
         else:
           iprot.skip(ftype)
       elif fid == 6:
@@ -413,8 +580,8 @@ class TRuntimeProfileNode:
           self.info_strings = {}
           (_ktype28, _vtype29, _size27 ) = iprot.readMapBegin()
           for _i31 in xrange(_size27):
-            _key32 = iprot.readString();
-            _val33 = iprot.readString();
+            _key32 = iprot.readString()
+            _val33 = iprot.readString()
             self.info_strings[_key32] = _val33
           iprot.readMapEnd()
         else:
@@ -424,7 +591,7 @@ class TRuntimeProfileNode:
           self.info_strings_display_order = []
           (_etype37, _size34) = iprot.readListBegin()
           for _i38 in xrange(_size34):
-            _elem39 = iprot.readString();
+            _elem39 = iprot.readString()
             self.info_strings_display_order.append(_elem39)
           iprot.readListEnd()
         else:
@@ -434,11 +601,11 @@ class TRuntimeProfileNode:
           self.child_counters_map = {}
           (_ktype41, _vtype42, _size40 ) = iprot.readMapBegin()
           for _i44 in xrange(_size40):
-            _key45 = iprot.readString();
+            _key45 = iprot.readString()
             _val46 = set()
             (_etype50, _size47) = iprot.readSetBegin()
             for _i51 in xrange(_size47):
-              _elem52 = iprot.readString();
+              _elem52 = iprot.readString()
               _val46.add(_elem52)
             iprot.readSetEnd()
             self.child_counters_map[_key45] = _val46
@@ -467,6 +634,17 @@ class TRuntimeProfileNode:
           iprot.readListEnd()
         else:
           iprot.skip(ftype)
+      elif fid == 11:
+        if ftype == TType.LIST:
+          self.summary_stats_counters = []
+          (_etype68, _size65) = iprot.readListBegin()
+          for _i69 in xrange(_size65):
+            _elem70 = TSummaryStatsCounter()
+            _elem70.read(iprot)
+            self.summary_stats_counters.append(_elem70)
+          iprot.readListEnd()
+        else:
+          iprot.skip(ftype)
       else:
         iprot.skip(ftype)
       iprot.readFieldEnd()
@@ -488,8 +666,8 @@ class TRuntimeProfileNode:
     if self.counters is not None:
       oprot.writeFieldBegin('counters', TType.LIST, 3)
       oprot.writeListBegin(TType.STRUCT, len(self.counters))
-      for iter65 in self.counters:
-        iter65.write(oprot)
+      for iter71 in self.counters:
+        iter71.write(oprot)
       oprot.writeListEnd()
       oprot.writeFieldEnd()
     if self.metadata is not None:
@@ -503,41 +681,48 @@ class TRuntimeProfileNode:
     if self.info_strings is not None:
       oprot.writeFieldBegin('info_strings', TType.MAP, 6)
       oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.info_strings))
-      for kiter66,viter67 in self.info_strings.items():
-        oprot.writeString(kiter66)
-        oprot.writeString(viter67)
+      for kiter72,viter73 in self.info_strings.items():
+        oprot.writeString(kiter72)
+        oprot.writeString(viter73)
       oprot.writeMapEnd()
       oprot.writeFieldEnd()
     if self.info_strings_display_order is not None:
       oprot.writeFieldBegin('info_strings_display_order', TType.LIST, 7)
       oprot.writeListBegin(TType.STRING, len(self.info_strings_display_order))
-      for iter68 in self.info_strings_display_order:
-        oprot.writeString(iter68)
+      for iter74 in self.info_strings_display_order:
+        oprot.writeString(iter74)
       oprot.writeListEnd()
       oprot.writeFieldEnd()
     if self.child_counters_map is not None:
       oprot.writeFieldBegin('child_counters_map', TType.MAP, 8)
       oprot.writeMapBegin(TType.STRING, TType.SET, len(self.child_counters_map))
-      for kiter69,viter70 in self.child_counters_map.items():
-        oprot.writeString(kiter69)
-        oprot.writeSetBegin(TType.STRING, len(viter70))
-        for iter71 in viter70:
-          oprot.writeString(iter71)
+      for kiter75,viter76 in self.child_counters_map.items():
+        oprot.writeString(kiter75)
+        oprot.writeSetBegin(TType.STRING, len(viter76))
+        for iter77 in viter76:
+          oprot.writeString(iter77)
         oprot.writeSetEnd()
       oprot.writeMapEnd()
       oprot.writeFieldEnd()
     if self.event_sequences is not None:
       oprot.writeFieldBegin('event_sequences', TType.LIST, 9)
       oprot.writeListBegin(TType.STRUCT, len(self.event_sequences))
-      for iter72 in self.event_sequences:
-        iter72.write(oprot)
+      for iter78 in self.event_sequences:
+        iter78.write(oprot)
       oprot.writeListEnd()
       oprot.writeFieldEnd()
     if self.time_series_counters is not None:
       oprot.writeFieldBegin('time_series_counters', TType.LIST, 10)
       oprot.writeListBegin(TType.STRUCT, len(self.time_series_counters))
-      for iter73 in self.time_series_counters:
-        iter73.write(oprot)
+      for iter79 in self.time_series_counters:
+        iter79.write(oprot)
+      oprot.writeListEnd()
+      oprot.writeFieldEnd()
+    if self.summary_stats_counters is not None:
+      oprot.writeFieldBegin('summary_stats_counters', TType.LIST, 11)
+      oprot.writeListBegin(TType.STRUCT, len(self.summary_stats_counters))
+      for iter80 in self.summary_stats_counters:
+        iter80.write(oprot)
       oprot.writeListEnd()
       oprot.writeFieldEnd()
     oprot.writeFieldStop()
@@ -563,6 +748,21 @@ class TRuntimeProfileNode:
     return
 
 
+  def __hash__(self):
+    value = 17
+    value = (value * 31) ^ hash(self.name)
+    value = (value * 31) ^ hash(self.num_children)
+    value = (value * 31) ^ hash(self.counters)
+    value = (value * 31) ^ hash(self.metadata)
+    value = (value * 31) ^ hash(self.indent)
+    value = (value * 31) ^ hash(self.info_strings)
+    value = (value * 31) ^ hash(self.info_strings_display_order)
+    value = (value * 31) ^ hash(self.child_counters_map)
+    value = (value * 31) ^ hash(self.event_sequences)
+    value = (value * 31) ^ hash(self.time_series_counters)
+    value = (value * 31) ^ hash(self.summary_stats_counters)
+    return value
+
   def __repr__(self):
     L = ['%s=%r' % (key, value)
       for key, value in self.__dict__.iteritems()]
@@ -574,7 +774,7 @@ class TRuntimeProfileNode:
   def __ne__(self, other):
     return not (self == other)
 
-class TRuntimeProfileTree:
+class TRuntimeProfileTree(object):
   """
   Attributes:
    - nodes
@@ -600,11 +800,11 @@ class TRuntimeProfileTree:
       if fid == 1:
         if ftype == TType.LIST:
           self.nodes = []
-          (_etype77, _size74) = iprot.readListBegin()
-          for _i78 in xrange(_size74):
-            _elem79 = TRuntimeProfileNode()
-            _elem79.read(iprot)
-            self.nodes.append(_elem79)
+          (_etype84, _size81) = iprot.readListBegin()
+          for _i85 in xrange(_size81):
+            _elem86 = TRuntimeProfileNode()
+            _elem86.read(iprot)
+            self.nodes.append(_elem86)
           iprot.readListEnd()
         else:
           iprot.skip(ftype)
@@ -621,8 +821,8 @@ class TRuntimeProfileTree:
     if self.nodes is not None:
       oprot.writeFieldBegin('nodes', TType.LIST, 1)
       oprot.writeListBegin(TType.STRUCT, len(self.nodes))
-      for iter80 in self.nodes:
-        iter80.write(oprot)
+      for iter87 in self.nodes:
+        iter87.write(oprot)
       oprot.writeListEnd()
       oprot.writeFieldEnd()
     oprot.writeFieldStop()
@@ -634,6 +834,11 @@ class TRuntimeProfileTree:
     return
 
 
+  def __hash__(self):
+    value = 17
+    value = (value * 31) ^ hash(self.nodes)
+    return value
+
   def __repr__(self):
     L = ['%s=%r' % (key, value)
       for key, value in self.__dict__.iteritems()]

+ 49 - 0
desktop/libs/libanalyze/thrift/Metrics.thrift

@@ -0,0 +1,49 @@
+// 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.
+
+namespace py Metrics
+
+// Metric and counter data types.
+enum TUnit {
+  // A dimensionless numerical quantity
+  UNIT,
+  // Rate of a dimensionless numerical quantity
+  UNIT_PER_SECOND,
+  CPU_TICKS,
+  BYTES
+  BYTES_PER_SECOND,
+  TIME_NS,
+  DOUBLE_VALUE,
+  // No units at all, may not be a numerical quantity
+  NONE,
+  TIME_MS,
+  TIME_S,
+  TIME_US
+}
+
+// The kind of value that a metric represents.
+enum TMetricKind {
+  // May go up or down over time
+  GAUGE,
+  // A strictly increasing value
+  COUNTER,
+  // Fixed; will never change
+  PROPERTY,
+  STATS,
+  SET,
+  HISTOGRAM
+}

+ 101 - 0
desktop/libs/libanalyze/thrift/RuntimeProfile.thrift

@@ -0,0 +1,101 @@
+// 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.
+
+namespace py RuntimeProfile
+
+include "Metrics.thrift"
+
+// Counter data
+struct TCounter {
+  1: required string name
+  2: required Metrics.TUnit unit
+  3: required i64 value
+}
+
+// Thrift version of RuntimeProfile::EventSequence - list of (label, timestamp) pairs
+// which represent an ordered sequence of events.
+struct TEventSequence {
+  1: required string name
+  2: required list<i64> timestamps
+  3: required list<string> labels
+}
+
+// Struct to contain data sampled at even time intervals (e.g. ram usage every
+// N seconds).
+// values[0] represents the value when the counter stated (e.g. fragment started)
+// values[1] is the value at period_ms (e.g. 500 ms later)
+// values[2] is the value at 2 * period_ms (e.g. 1sec since start)
+// This can be used to reconstruct a time line for a particular counter.
+struct TTimeSeriesCounter {
+  1: required string name
+  2: required Metrics.TUnit unit
+
+  // Period of intervals in ms
+  3: required i32 period_ms
+
+  // The sampled values.
+  4: required list<i64> values
+}
+
+// Thrift version of RuntimeProfile::SummaryStatsCounter.
+struct TSummaryStatsCounter {
+  1: required string name
+  2: required Metrics.TUnit unit
+  3: required i64 sum
+  4: required i64 total_num_values
+  5: required i64 min_value
+  6: required i64 max_value
+}
+
+// A single runtime profile
+struct TRuntimeProfileNode {
+  1: required string name
+  2: required i32 num_children
+  3: required list<TCounter> counters
+  // TODO: should we make metadata a serializable struct?  We only use it to
+  // store the node id right now so this is sufficient.
+  4: required i64 metadata
+
+  // indicates whether the child will be printed with extra indentation;
+  // corresponds to indent param of RuntimeProfile::AddChild()
+  5: required bool indent
+
+  // map of key,value info strings that capture any kind of additional information
+  // about the profiled object
+  6: required map<string, string> info_strings
+
+  // Auxilliary structure to capture the info strings display order when printed
+  7: required list<string> info_strings_display_order
+
+  // map from parent counter name to child counter name
+  8: required map<string, set<string>> child_counters_map
+
+  // List of event sequences that capture ordered events in a query's lifetime
+  9: optional list<TEventSequence> event_sequences
+
+  // List of time series counters
+  10: optional list<TTimeSeriesCounter> time_series_counters
+
+  // List of summary stats counters
+  11: optional list<TSummaryStatsCounter> summary_stats_counters
+}
+
+// A flattened tree of runtime profiles, obtained by an
+// pre-order traversal
+struct TRuntimeProfileTree {
+  1: required list<TRuntimeProfileNode> nodes
+}