File tree Expand file tree Collapse file tree 3 files changed +4
-2
lines changed
Expand file tree Collapse file tree 3 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,8 @@ const std::string Metric::name() { return name_; }
1212const std::string Metric::type () { return type_; }
1313const std::vector<std::string> Metric::tags () { return tags_; }
1414bool Metric::common () { return common_; }
15- uint64_t Metric::value () { return value_.exchange (0 ); }
15+ uint64_t Metric::value () { return value_; }
16+ uint64_t Metric::capture_and_reset_value () { return value_.exchange (0 ); }
1617
1718CounterMetric::CounterMetric (const std::string name,
1819 const std::vector<std::string> tags, bool common)
Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ class Metric {
3434 const std::vector<std::string> tags ();
3535 bool common ();
3636 uint64_t value ();
37+ uint64_t capture_and_reset_value ();
3738};
3839
3940class CounterMetric : public Metric {
Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ void TracerTelemetry::capture_metrics() {
102102 clock_ ().wall .time_since_epoch ())
103103 .count ();
104104 for (auto & m : metrics_snapshots_) {
105- auto value = m.first .get ().value ();
105+ auto value = m.first .get ().capture_and_reset_value ();
106106 m.second .emplace_back (timepoint, value);
107107 }
108108}
You can’t perform that action at this time.
0 commit comments