metric.pxd 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. from libcpp cimport bool
  2. from util.system.types cimport ui64, ui32, i64
  3. from util.generic.ptr cimport THolder, TIntrusivePtr
  4. from util.generic.vector cimport TVector
  5. cdef extern from "library/cpp/monlib/metrics/histogram_collector.h" namespace "NMonitoring" nogil:
  6. ctypedef double TBucketBound
  7. ctypedef ui64 TBucketValue
  8. cdef cppclass IHistogramSnapshot:
  9. ui32 Count() const
  10. TBucketBound UpperBound(ui32 index) const
  11. TBucketValue Value(ui32 index) const
  12. ctypedef TIntrusivePtr[IHistogramSnapshot] IHistogramSnapshotPtr
  13. cdef cppclass IHistogramCollector:
  14. void Collect(i64 value)
  15. void Collect(i64 value, ui32 count)
  16. IHistogramSnapshotPtr Snapshot() const
  17. ctypedef THolder[IHistogramCollector] IHistogramCollectorPtr
  18. IHistogramCollectorPtr ExponentialHistogram(ui32 bucketsCount, double base, double scale) except +
  19. IHistogramCollectorPtr ExplicitHistogram(const TVector[double]& buckets) except +
  20. IHistogramCollectorPtr LinearHistogram(ui32 bucketsCount, i64 startValue, i64 bucketWidth) except +
  21. cdef extern from "library/cpp/monlib/metrics/metric.h" namespace "NMonitoring" nogil:
  22. cdef cppclass TGauge:
  23. TGauge(double value) except +
  24. void Set(double)
  25. double Get() const
  26. double Add(double)
  27. cdef cppclass TIntGauge:
  28. TIntGauge(ui64 value) except +
  29. void Set(ui64)
  30. ui64 Get() const
  31. ui64 Add(double)
  32. ui64 Inc()
  33. ui64 Dec()
  34. cdef cppclass TCounter:
  35. TCounter(ui64 value) except +
  36. void Set(ui64)
  37. ui64 Get() const
  38. void Inc()
  39. void Reset()
  40. cdef cppclass TRate:
  41. TRate(ui64 value) except +
  42. void Add(ui64)
  43. ui64 Get() const
  44. void Inc()
  45. cdef cppclass THistogram:
  46. THistogram(IHistogramCollectorPtr collector, bool isRate) except +
  47. void Record(double value)
  48. void Record(double value, ui32 count)
  49. cdef class Gauge:
  50. cdef TGauge* __wrapped
  51. @staticmethod
  52. cdef Gauge from_ptr(TGauge* native)
  53. cdef class Counter:
  54. cdef TCounter* __wrapped
  55. @staticmethod
  56. cdef Counter from_ptr(TCounter* native)
  57. cdef class Rate:
  58. cdef TRate* __wrapped
  59. @staticmethod
  60. cdef Rate from_ptr(TRate* native)
  61. cdef class IntGauge:
  62. cdef TIntGauge* __wrapped
  63. @staticmethod
  64. cdef IntGauge from_ptr(TIntGauge* native)
  65. cdef class Histogram:
  66. cdef THistogram* __wrapped
  67. cdef bool __is_owner
  68. @staticmethod
  69. cdef Histogram from_ptr(THistogram* native)