Skip to content

Commit 5ec1769

Browse files
committed
Unconstification
1 parent 95c5d0b commit 5ec1769

File tree

2 files changed

+19
-21
lines changed

2 files changed

+19
-21
lines changed

src/datadog/metrics.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,24 @@
55
namespace datadog {
66
namespace tracing {
77

8-
Metric::Metric(const std::string name, std::string type,
9-
const std::vector<std::string> tags, bool common)
8+
Metric::Metric(std::string name, std::string type,
9+
std::vector<std::string> tags, bool common)
1010
: name_(name), type_(type), tags_(tags), common_(common) {}
11-
const std::string Metric::name() { return name_; }
12-
const std::string Metric::type() { return type_; }
13-
const std::vector<std::string> Metric::tags() { return tags_; }
11+
std::string Metric::name() { return name_; }
12+
std::string Metric::type() { return type_; }
13+
std::vector<std::string> Metric::tags() { return tags_; }
1414
bool Metric::common() { return common_; }
1515
uint64_t Metric::value() { return value_; }
1616
uint64_t Metric::capture_and_reset_value() { return value_.exchange(0); }
1717

18-
CounterMetric::CounterMetric(const std::string name,
19-
const std::vector<std::string> tags, bool common)
18+
CounterMetric::CounterMetric(std::string name, std::vector<std::string> tags,
19+
bool common)
2020
: Metric(name, "count", tags, common) {}
2121
void CounterMetric::inc() { add(1); }
2222
void CounterMetric::add(uint64_t amount) { value_ += amount; }
2323

24-
GaugeMetric::GaugeMetric(const std::string name,
25-
const std::vector<std::string> tags, bool common)
24+
GaugeMetric::GaugeMetric(std::string name, std::vector<std::string> tags,
25+
bool common)
2626
: Metric(name, "gauge", tags, common) {}
2727
void GaugeMetric::set(uint64_t value) { value_ = value; }
2828
void GaugeMetric::inc() { add(1); }

src/datadog/metrics.h

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,27 @@ class Metric {
1717
// The name of the metric that will be published. A transformation occurs
1818
// based on the name and whether it is "common" or "language-specific" when it
1919
// is recorded.
20-
const std::string name_;
20+
std::string name_;
2121
// The type of the metric. This will currently be count or gauge.
22-
const std::string type_;
22+
std::string type_;
2323
// Tags associated with this specific instance of the metric.
24-
const std::vector<std::string> tags_;
24+
std::vector<std::string> tags_;
2525
// This affects the transformation of the metric name, where it can be a
2626
// common telemetry metric, or a language-specific metric that is prefixed
2727
// with the language name.
2828
bool common_;
2929

3030
protected:
3131
std::atomic<uint64_t> value_ = 0;
32-
Metric(const std::string name, std::string type,
33-
const std::vector<std::string> tags, bool common);
32+
Metric(std::string name, std::string type, std::vector<std::string> tags,
33+
bool common);
3434

3535
public:
3636
// Accessors for name, type, tags, common and capture_and_reset_value are used
3737
// when producing the JSON message for reporting metrics.
38-
const std::string name();
39-
const std::string type();
40-
const std::vector<std::string> tags();
38+
std::string name();
39+
std::string type();
40+
std::vector<std::string> tags();
4141
bool common();
4242
uint64_t value();
4343
uint64_t capture_and_reset_value();
@@ -47,8 +47,7 @@ class Metric {
4747
// number of actions, or incrementing the current number of actions by 1.
4848
class CounterMetric : public Metric {
4949
public:
50-
CounterMetric(const std::string name, const std::vector<std::string> tags,
51-
bool common);
50+
CounterMetric(std::string name, std::vector<std::string> tags, bool common);
5251
void inc();
5352
void add(uint64_t amount);
5453
};
@@ -58,8 +57,7 @@ class CounterMetric : public Metric {
5857
// state by 1.
5958
class GaugeMetric : public Metric {
6059
public:
61-
GaugeMetric(const std::string name, const std::vector<std::string> tags,
62-
bool common);
60+
GaugeMetric(std::string name, std::vector<std::string> tags, bool common);
6361
void set(uint64_t value);
6462
void inc();
6563
void add(uint64_t amount);

0 commit comments

Comments
 (0)