Skip to content

Commit 9f32019

Browse files
authored
Do not return Metric name as a string (#102)
1 parent a5c482d commit 9f32019

File tree

4 files changed

+5
-13
lines changed

4 files changed

+5
-13
lines changed

include/Monitoring/Metric.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,7 @@ class Metric
5454

5555
/// Name getter
5656
/// \return metric name
57-
std::string getName() const;
58-
59-
/// Const name getter
60-
const std::string& getConstName() const;
57+
const std::string& getName() const;
6158

6259
/// Timestamp getter
6360
/// \return metric timestamp

src/Backends/InfluxDB.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ void InfluxDB::send(const Metric& metric)
9393

9494
std::string InfluxDB::toInfluxLineProtocol(const Metric& metric) {
9595
std::stringstream convert;
96-
std::string name = metric.getConstName();
96+
std::string name = metric.getName();
9797
escape(name);
9898
convert << name << "," << tagSet;
9999

src/Backends/StdOut.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@ void StdOut::sendMultiple(std::string measurement, std::vector<Metric>&& metrics
5454
metricTags += tags::TAG_ARRAY[tagIndex].second;
5555
}
5656
for (auto& metric : metrics) {
57-
mStream << "[METRIC] " << measurement << '/' << metric.getConstName() << ',' << metric.getType() << ' '
57+
mStream << "[METRIC] " << measurement << '/' << metric.getName() << ',' << metric.getType() << ' '
5858
<< metric.getValue() << ' ' << convertTimestamp(metric.getTimestamp()) << ' ' << tagString
5959
<< metricTags << '\n';
6060
}
6161
}
6262

6363
void StdOut::send(const Metric& metric)
6464
{
65-
mStream << "[METRIC] " << metric.getConstName() << ',' << metric.getType() << " " << metric.getValue()
65+
mStream << "[METRIC] " << metric.getName() << ',' << metric.getType() << " " << metric.getValue()
6666
<< ' ' << convertTimestamp(metric.getTimestamp()) << ' ' << tagString;
6767

6868
for (const auto& tagIndex : metric.getTags()) {

src/Metric.cxx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,7 @@ int Metric::getType() const
2525
return mValue.which();
2626
}
2727

28-
std::string Metric::getName() const
29-
{
30-
return mName;
31-
}
32-
33-
const std::string& Metric::getConstName() const
28+
const std::string& Metric::getName() const
3429
{
3530
return mName;
3631
}

0 commit comments

Comments
 (0)