diff options
author | robot-ydb-importer <robot-ydb-importer@yandex-team.com> | 2024-02-14 19:47:36 +0300 |
---|---|---|
committer | Innokentii Mokin <innokentii@ydb.tech> | 2024-02-16 18:35:13 +0000 |
commit | d6ee6054676c603f8afb27b5bd8ce7fe0a5bfbc0 (patch) | |
tree | 4aa69116e7818a4aae0bfedbfa29639b0f0b90e8 /library/python/monlib/metric.pxd | |
parent | 59ded8ecfcd805c109471346a0d4d1f269bdaa59 (diff) | |
download | ydb-d6ee6054676c603f8afb27b5bd8ce7fe0a5bfbc0.tar.gz |
YDB Import 566
96265cd0cc64e1b9bb31fe97b915ed2a09caf1cb
Diffstat (limited to 'library/python/monlib/metric.pxd')
-rw-r--r-- | library/python/monlib/metric.pxd | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/library/python/monlib/metric.pxd b/library/python/monlib/metric.pxd new file mode 100644 index 0000000000..afa28ea015 --- /dev/null +++ b/library/python/monlib/metric.pxd @@ -0,0 +1,103 @@ +from libcpp cimport bool + +from util.system.types cimport ui64, ui32, i64 +from util.generic.ptr cimport THolder, TIntrusivePtr +from util.generic.vector cimport TVector + + +cdef extern from "library/cpp/monlib/metrics/histogram_collector.h" namespace "NMonitoring" nogil: + ctypedef double TBucketBound + ctypedef ui64 TBucketValue + + cdef cppclass IHistogramSnapshot: + ui32 Count() const + TBucketBound UpperBound(ui32 index) const + TBucketValue Value(ui32 index) const + + ctypedef TIntrusivePtr[IHistogramSnapshot] IHistogramSnapshotPtr + + cdef cppclass IHistogramCollector: + void Collect(i64 value) + void Collect(i64 value, ui32 count) + IHistogramSnapshotPtr Snapshot() const + + ctypedef THolder[IHistogramCollector] IHistogramCollectorPtr + + IHistogramCollectorPtr ExponentialHistogram(ui32 bucketsCount, double base, double scale) except + + IHistogramCollectorPtr ExplicitHistogram(const TVector[double]& buckets) except + + IHistogramCollectorPtr LinearHistogram(ui32 bucketsCount, i64 startValue, i64 bucketWidth) except + + + +cdef extern from "library/cpp/monlib/metrics/metric.h" namespace "NMonitoring" nogil: + cdef cppclass TGauge: + TGauge(double value) except + + + void Set(double) + double Get() const + double Add(double) + + cdef cppclass TIntGauge: + TIntGauge(ui64 value) except + + + void Set(ui64) + ui64 Get() const + ui64 Add(double) + ui64 Inc() + ui64 Dec() + + cdef cppclass TCounter: + TCounter(ui64 value) except + + + void Set(ui64) + ui64 Get() const + void Inc() + void Reset() + + cdef cppclass TRate: + TRate(ui64 value) except + + + void Add(ui64) + ui64 Get() const + void Inc() + + cdef cppclass THistogram: + THistogram(IHistogramCollectorPtr collector, bool isRate) except + + + void Record(double value) + void Record(double value, ui32 count) + + +cdef class Gauge: + cdef TGauge* __wrapped + + @staticmethod + cdef Gauge from_ptr(TGauge* native) + + +cdef class Counter: + cdef TCounter* __wrapped + + @staticmethod + cdef Counter from_ptr(TCounter* native) + + +cdef class Rate: + cdef TRate* __wrapped + + @staticmethod + cdef Rate from_ptr(TRate* native) + + +cdef class IntGauge: + cdef TIntGauge* __wrapped + + @staticmethod + cdef IntGauge from_ptr(TIntGauge* native) + + +cdef class Histogram: + cdef THistogram* __wrapped + cdef bool __is_owner + + @staticmethod + cdef Histogram from_ptr(THistogram* native) |