File tree Expand file tree Collapse file tree 5 files changed +15
-27
lines changed
Expand file tree Collapse file tree 5 files changed +15
-27
lines changed Original file line number Diff line number Diff line change @@ -71,10 +71,6 @@ class Metric
7171 // / \return metric name
7272 std::string getName () const ;
7373
74- // / Name setter
75- // / \param name new name of the metric
76- void setName (std::string name);
77-
7874 // / Timestamp getter
7975 // / \return metric timestamp
8076 std::chrono::time_point<std::chrono::system_clock> getTimestamp () const ;
Original file line number Diff line number Diff line change @@ -43,13 +43,10 @@ void InfoLoggerBackend::send(std::vector<Metric>&& metrics) {
4343 }
4444}
4545
46- void InfoLoggerBackend::sendMultiple (std::string measurement , std::vector<Metric>&& metrics)
46+ void InfoLoggerBackend::sendMultiple (std::string, std::vector<Metric>&& metrics)
4747{
4848 for (auto & m : metrics) {
49- std::string tempName = m.getName ();
50- m.setName (measurement + " -" + m.getName ());
5149 send (m);
52- m.setName (tempName);
5350 }
5451}
5552
Original file line number Diff line number Diff line change @@ -46,11 +46,20 @@ void StdOut::send(std::vector<Metric>&& metrics) {
4646
4747void StdOut::sendMultiple (std::string measurement, std::vector<Metric>&& metrics)
4848{
49- for (auto & m : metrics) {
50- std::string tempName = m.getName ();
51- m.setName (measurement + " -" + m.getName ());
52- send (m);
53- m.setName (tempName);
49+ for (auto & metric : metrics) {
50+ std::string metricTags{};
51+ for (const auto & tag : metric.getTags ()) {
52+ if (!metricTags.empty ()) {
53+ metricTags += " ," ;
54+ }
55+ metricTags += tag.name + " =" + tag.value ;
56+ }
57+ if (!metricTags.empty ()) {
58+ metricTags = " ," + metricTags;
59+ }
60+ MonLogger::Get () << " [METRIC] " << measurement << " /" << metric.getName () << " ," << metric.getType () << " "
61+ << metric.getValue () << " " << convertTimestamp (metric.getTimestamp ()) << " " << tagString << metricTags
62+ << MonLogger::End ();
5463 }
5564}
5665
Original file line number Diff line number Diff line change @@ -30,11 +30,6 @@ std::string Metric::getName() const
3030 return mName ;
3131}
3232
33- void Metric::setName (std::string name)
34- {
35- mName = name;
36- }
37-
3833Metric::Metric (int value, const std::string& name, std::chrono::time_point<std::chrono::system_clock> timestamp) :
3934 mValue (value), mName (name), mTimestamp (timestamp)
4035{}
Original file line number Diff line number Diff line change @@ -94,15 +94,6 @@ BOOST_AUTO_TEST_CASE(customCopyConstructor) {
9494 }
9595}
9696
97- BOOST_AUTO_TEST_CASE (setters) {
98- o2::monitoring::Metric metric = o2::monitoring::Metric{10 , " myMetric" };
99- metric.setName (" renamed" );
100- auto timestamp = Metric::getCurrentTimestamp ();
101- metric.setTimestamp (timestamp);
102-
103- BOOST_CHECK_EQUAL (metric.getName (), " renamed" );
104- }
105-
10697} // namespace Test
10798} // namespace monitoring
10899} // namespace o2
You can’t perform that action at this time.
0 commit comments