metric_value.cpp 819 B

123456789101112131415161718192021222324252627
  1. #include "metric_value.h"
  2. namespace NMonitoring {
  3. void TMetricTimeSeries::SortByTs() {
  4. SortPointsByTs(ValueType_, Points_);
  5. }
  6. void TMetricTimeSeries::Clear() noexcept {
  7. if (ValueType_ == EMetricValueType::HISTOGRAM) {
  8. for (TPoint& p: Points_) {
  9. SnapshotUnRef<EMetricValueType::HISTOGRAM>(p);
  10. }
  11. } else if (ValueType_ == EMetricValueType::SUMMARY) {
  12. for (TPoint& p: Points_) {
  13. SnapshotUnRef<EMetricValueType::SUMMARY>(p);
  14. }
  15. } else if (ValueType_ == EMetricValueType::LOGHISTOGRAM) {
  16. for (TPoint& p: Points_) {
  17. SnapshotUnRef<EMetricValueType::LOGHISTOGRAM>(p);
  18. }
  19. }
  20. Points_.clear();
  21. ValueType_ = EMetricValueType::UNKNOWN;
  22. }
  23. }