metric_consumer.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #pragma once
  2. #include "metric_type.h"
  3. #include "histogram_collector.h"
  4. #include "summary_collector.h"
  5. #include "log_histogram_snapshot.h"
  6. class TInstant;
  7. namespace NMonitoring {
  8. class IMetricConsumer {
  9. public:
  10. virtual ~IMetricConsumer() = default;
  11. virtual void OnStreamBegin() = 0;
  12. virtual void OnStreamEnd() = 0;
  13. virtual void OnCommonTime(TInstant time) = 0;
  14. virtual void OnMetricBegin(EMetricType type) = 0;
  15. virtual void OnMetricEnd() = 0;
  16. virtual void OnLabelsBegin() = 0;
  17. virtual void OnLabelsEnd() = 0;
  18. virtual void OnLabel(TStringBuf name, TStringBuf value) = 0;
  19. virtual void OnLabel(ui32 name, ui32 value);
  20. virtual std::pair<ui32, ui32> PrepareLabel(TStringBuf name, TStringBuf value);
  21. virtual void OnDouble(TInstant time, double value) = 0;
  22. virtual void OnInt64(TInstant time, i64 value) = 0;
  23. virtual void OnUint64(TInstant time, ui64 value) = 0;
  24. virtual void OnHistogram(TInstant time, IHistogramSnapshotPtr snapshot) = 0;
  25. virtual void OnLogHistogram(TInstant time, TLogHistogramSnapshotPtr snapshot) = 0;
  26. virtual void OnSummaryDouble(TInstant time, ISummaryDoubleSnapshotPtr snapshot) = 0;
  27. };
  28. using IMetricConsumerPtr = THolder<IMetricConsumer>;
  29. }