aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/monlib/metrics/metric_value.cpp
blob: 1ea2ed41422d87a143a286c4e990cc7a1ec2423e (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; 
    } 
}