encoder.pxd 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. from util.generic.string cimport TStringBuf, TString
  2. from util.generic.ptr cimport THolder
  3. from util.stream.output cimport IOutputStream
  4. from library.python.monlib.metric_consumer cimport IMetricConsumer
  5. cdef extern from "util/stream/input.h" nogil:
  6. cdef cppclass IInputStream:
  7. pass
  8. cdef extern from "util/system/file.h" nogil:
  9. cdef cppclass TFile:
  10. TFile()
  11. TFile(TFile)
  12. pass
  13. cdef TFile Duplicate(int)
  14. cdef extern from "library/cpp/monlib/encode/encoder.h" namespace "NMonitoring" nogil:
  15. cdef cppclass IMetricEncoder:
  16. void Close()
  17. cdef cppclass ECompression:
  18. pass
  19. ctypedef THolder[IMetricEncoder] IMetricEncoderPtr
  20. cdef extern from "library/cpp/monlib/encode/unistat/unistat.h" namespace "NMonitoring" nogil:
  21. cdef void DecodeUnistat(TStringBuf data, IMetricConsumer* c)
  22. cdef extern from "library/cpp/monlib/encode/json/json.h" namespace "NMonitoring" nogil:
  23. cdef IMetricEncoderPtr EncoderJson(IOutputStream* out, int indentation)
  24. cdef IMetricEncoderPtr BufferedEncoderJson(IOutputStream* out, int indentation)
  25. cdef void DecodeJson(TStringBuf data, IMetricConsumer* c)
  26. cdef extern from "library/cpp/monlib/encode/prometheus/prometheus.h" namespace "NMonitoring" nogil:
  27. cdef IMetricEncoderPtr EncoderPrometheus(IOutputStream* out, TStringBuf metricNameLabel)
  28. cdef extern from "library/cpp/monlib/encode/spack/spack_v1.h" namespace "NMonitoring" nogil:
  29. cdef IMetricEncoderPtr EncoderSpackV1(IOutputStream* out, ETimePrecision, ECompression)
  30. cdef void DecodeSpackV1(IInputStream* input, IMetricConsumer* c) except +
  31. cdef cppclass ETimePrecision:
  32. pass
  33. cdef cppclass EValueType:
  34. pass
  35. cdef extern from "library/cpp/monlib/encode/spack/spack_v1.h" namespace "NMonitoring::ETimePrecision" nogil:
  36. cdef ETimePrecision SECONDS "NMonitoring::ETimePrecision::SECONDS"
  37. cdef ETimePrecision MILLIS "NMonitoring::ETimePrecision::MILLIS"
  38. cdef extern from "library/cpp/monlib/encode/encoder.h" namespace "NMonitoring::ECompression" nogil:
  39. cdef ECompression UNKNOWN "NMonitoring::ECompression::UNKNOWN"
  40. cdef ECompression IDENTITY "NMonitoring::ECompression::IDENTITY"
  41. cdef ECompression ZLIB "NMonitoring::ECompression::ZLIB"
  42. cdef ECompression LZ4 "NMonitoring::ECompression::LZ4"
  43. cdef ECompression ZSTD "NMonitoring::ECompression::ZSTD"
  44. cdef class Encoder:
  45. cdef IMetricEncoderPtr __wrapped
  46. cdef THolder[TFile] __file
  47. cdef THolder[IOutputStream] __stream
  48. cdef IMetricEncoder* native(self)
  49. cdef _make_stream(self, py_stream)
  50. @staticmethod
  51. cdef Encoder create_spack(object stream, ETimePrecision timePrecision, ECompression compression)
  52. @staticmethod
  53. cdef Encoder create_json(object stream, int indent)
  54. @staticmethod
  55. cdef Encoder create_prometheus(object stream, bytes metricNameLabel)