aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/monlib/metrics/metric_value.cpp
blob: b95d7011c60d364467b412857e39bcb890b4188c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include "metric_value.h"


namespace NMonitoring {
    void TMetricTimeSeries::SortByTs() {
        SortPointsByTs(ValueType_, Points_);
    }

    void TMetricTimeSeries::Clear() noexcept {
        if (ValueType_ == EMetricValueType::HISTOGRAM) {
            for (TPoint& p: Points_) {
                SnapshotUnRef<EMetricValueType::HISTOGRAM>(p);
            }
        } else if (ValueType_ == EMetricValueType::SUMMARY) {
            for (TPoint& p: Points_) {
                SnapshotUnRef<EMetricValueType::SUMMARY>(p);
            }
        } else if (ValueType_ == EMetricValueType::LOGHISTOGRAM) {
            for (TPoint& p: Points_) {
                SnapshotUnRef<EMetricValueType::LOGHISTOGRAM>(p);
            }
        }

        Points_.clear();
        ValueType_ = EMetricValueType::UNKNOWN;
    }
}