aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/monlib/metrics/summary_snapshot.cpp
blob: 24ab9a951effb276e626a764a889d8808afee141 (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
28
29
30
31
32
33
34
#include "summary_snapshot.h"

#include <util/stream/output.h>

#include <iostream> 

 
namespace { 
 
template <typename TStream> 
auto& Output(TStream& o, const NMonitoring::ISummaryDoubleSnapshot& s) { 
    o << TStringBuf("{");
 
    o << TStringBuf("sum: ") << s.GetSum() << TStringBuf(", ");
    o << TStringBuf("min: ") << s.GetMin() << TStringBuf(", ");
    o << TStringBuf("max: ") << s.GetMax() << TStringBuf(", ");
    o << TStringBuf("last: ") << s.GetLast() << TStringBuf(", ");
    o << TStringBuf("count: ") << s.GetCount();

    o << TStringBuf("}");
 
    return o; 
}
 
} // namespace 
 
std::ostream& operator<<(std::ostream& o, const NMonitoring::ISummaryDoubleSnapshot& s) { 
    return Output(o, s); 
} 
 
template <> 
void Out<NMonitoring::ISummaryDoubleSnapshot>(IOutputStream& o, const NMonitoring::ISummaryDoubleSnapshot& s) { 
    Output(o, s); 
}