aboutsummaryrefslogtreecommitdiffstats
path: root/metrics/src
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-01-06 22:02:26 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2023-01-06 22:02:26 +0000
commit92845e2859655920607519ffe6c81ade2f59566c (patch)
tree91c75d3dacbee3c48d28b95291de5ccaeb68d69b /metrics/src
parent13fb1dc5139c29d0b9f7d57c1477e168e3f07bbf (diff)
Ignore copyType and make includeUnused mandatory
Diffstat (limited to 'metrics/src')
-rw-r--r--metrics/src/vespa/metrics/countmetric.h13
-rw-r--r--metrics/src/vespa/metrics/countmetric.hpp6
-rw-r--r--metrics/src/vespa/metrics/metric.h7
-rw-r--r--metrics/src/vespa/metrics/metricset.cpp2
-rw-r--r--metrics/src/vespa/metrics/valuemetric.h10
-rw-r--r--metrics/src/vespa/metrics/valuemetric.hpp4
6 files changed, 15 insertions, 27 deletions
diff --git a/metrics/src/vespa/metrics/countmetric.h b/metrics/src/vespa/metrics/countmetric.h
index b6b89f4ab15..90ad3a26c8d 100644
--- a/metrics/src/vespa/metrics/countmetric.h
+++ b/metrics/src/vespa/metrics/countmetric.h
@@ -31,13 +31,11 @@ protected:
AbstractCountMetric(const String& name, Tags dimensions,
const String& description, MetricSet* owner = 0)
: Metric(name, std::move(dimensions), description, owner)
- {
- }
+ { }
AbstractCountMetric(const AbstractCountMetric& other, MetricSet* owner)
: Metric(other, owner)
- {
- }
+ { }
void logWarning(const char* msg, const char * op) const;
};
@@ -52,7 +50,7 @@ public:
CountMetric(const String& name, Tags dimensions,
const String& description, MetricSet* owner = 0);
- CountMetric(const CountMetric<T, SumOnAdd>& other, CopyType, MetricSet* owner);
+ CountMetric(const CountMetric<T, SumOnAdd>& other, MetricSet* owner);
~CountMetric() override;
@@ -73,9 +71,8 @@ public:
- CountMetric * clone(std::vector<Metric::UP> &, CopyType type, MetricSet* owner,
- bool /*includeUnused*/) const override {
- return new CountMetric<T, SumOnAdd>(*this, type, owner);
+ CountMetric * clone(std::vector<Metric::UP> &, CopyType, MetricSet* owner, bool) const override {
+ return new CountMetric<T, SumOnAdd>(*this, owner);
}
T getValue() const { return _values.getValues()._value; }
diff --git a/metrics/src/vespa/metrics/countmetric.hpp b/metrics/src/vespa/metrics/countmetric.hpp
index 469986e797a..900c5eeb8ca 100644
--- a/metrics/src/vespa/metrics/countmetric.hpp
+++ b/metrics/src/vespa/metrics/countmetric.hpp
@@ -15,8 +15,7 @@ CountMetric<T, SumOnAdd>::CountMetric(const String& name, Tags dimensions,
{}
template <typename T, bool SumOnAdd>
-CountMetric<T, SumOnAdd>::CountMetric(const CountMetric<T, SumOnAdd>& other,
- CopyType , MetricSet* owner)
+CountMetric<T, SumOnAdd>::CountMetric(const CountMetric<T, SumOnAdd>& other, MetricSet* owner)
: AbstractCountMetric(other, owner),
_values(other._values)
{
@@ -114,8 +113,7 @@ CountMetric<T, SumOnAdd>::dec(T value)
template <typename T, bool SumOnAdd>
void
-CountMetric<T, SumOnAdd>::addToSnapshot(
- Metric& other, std::vector<Metric::UP> &) const
+CountMetric<T, SumOnAdd>::addToSnapshot(Metric& other, std::vector<Metric::UP> &) const
{
CountMetric<T, SumOnAdd>& o(reinterpret_cast<CountMetric<T, SumOnAdd>&>(other));
o.inc(_values.getValues()._value);
diff --git a/metrics/src/vespa/metrics/metric.h b/metrics/src/vespa/metrics/metric.h
index 89b772bf750..33a3d9dee23 100644
--- a/metrics/src/vespa/metrics/metric.h
+++ b/metrics/src/vespa/metrics/metric.h
@@ -148,9 +148,7 @@ public:
* unused metrics, but while generating sum metric sum in active
* metrics we want to. This has no affect if type is CLONE.
*/
- virtual Metric* clone(std::vector<Metric::UP> &ownerList,
- CopyType type, MetricSet* owner,
- bool includeUnused = false) const = 0;
+ virtual Metric* clone(std::vector<Metric::UP> &ownerList, CopyType type, MetricSet* owner, bool includeUnused) const = 0;
/**
* Utility function for assigning values from one metric of identical type
@@ -163,8 +161,7 @@ public:
/** Reset all metric values. */
virtual void reset() = 0;
- void print(std::ostream& out, bool verbose,
- const std::string& indent) const override {
+ void print(std::ostream& out, bool verbose, const std::string& indent) const override {
print(out, verbose, indent, 0);
}
virtual void print(std::ostream&, bool verbose, const std::string& indent,
diff --git a/metrics/src/vespa/metrics/metricset.cpp b/metrics/src/vespa/metrics/metricset.cpp
index 602dd9e500c..bc04674ead5 100644
--- a/metrics/src/vespa/metrics/metricset.cpp
+++ b/metrics/src/vespa/metrics/metricset.cpp
@@ -233,7 +233,7 @@ MetricSet::addTo(Metric& other, std::vector<Metric::UP> *ownerList) const
if (target == map2.end() || source->first < target->first) {
// Source missing in snapshot to add to. Lets create and add.
if (!mustAdd && source->second->used()) {
- Metric::UP copy(source->second->clone(*ownerList, INACTIVE, &o));
+ Metric::UP copy(source->second->clone(*ownerList, INACTIVE, &o, false));
newMetrics[source->first] = copy.get();
ownerList->push_back(std::move(copy));
}
diff --git a/metrics/src/vespa/metrics/valuemetric.h b/metrics/src/vespa/metrics/valuemetric.h
index 1be796ab1aa..90f09bef24c 100644
--- a/metrics/src/vespa/metrics/valuemetric.h
+++ b/metrics/src/vespa/metrics/valuemetric.h
@@ -76,13 +76,12 @@ class ValueMetric : public AbstractValueMetric {
bool checkFinite(AvgVal, std::false_type) { return true; }
public:
- ValueMetric(const ValueMetric<AvgVal, TotVal, SumOnAdd> &,
- CopyType, MetricSet *owner);
+ ValueMetric(const ValueMetric<AvgVal, TotVal, SumOnAdd> &, MetricSet *owner);
ValueMetric(const String &name, Tags dimensions,
const String &description, MetricSet *owner = 0);
- ~ValueMetric();
+ ~ValueMetric() override;
MetricValueClass::UP getValues() const override {
return std::make_unique<Values>(_values.getValues());
@@ -90,9 +89,8 @@ public:
void unsetOnZeroValue() { _values.setFlag(UNSET_ON_ZERO_VALUE); }
- ValueMetric *clone(std::vector<Metric::UP> &, CopyType type, MetricSet *owner,
- bool /*includeUnused*/) const override {
- return new ValueMetric<AvgVal,TotVal,SumOnAdd>(*this, type, owner);
+ ValueMetric *clone(std::vector<Metric::UP> &, CopyType , MetricSet *owner, bool) const override {
+ return new ValueMetric<AvgVal,TotVal,SumOnAdd>(*this, owner);
}
ValueMetric & operator+=(const ValueMetric &);
diff --git a/metrics/src/vespa/metrics/valuemetric.hpp b/metrics/src/vespa/metrics/valuemetric.hpp
index a5273307b5c..2609a39f509 100644
--- a/metrics/src/vespa/metrics/valuemetric.hpp
+++ b/metrics/src/vespa/metrics/valuemetric.hpp
@@ -18,9 +18,7 @@ ValueMetric<AvgVal, TotVal, SumOnAdd>::ValueMetric(
{}
template<typename AvgVal, typename TotVal, bool SumOnAdd>
-ValueMetric<AvgVal, TotVal, SumOnAdd>::ValueMetric(
- const ValueMetric<AvgVal, TotVal, SumOnAdd>& other,
- CopyType, MetricSet* owner)
+ValueMetric<AvgVal, TotVal, SumOnAdd>::ValueMetric(const ValueMetric<AvgVal, TotVal, SumOnAdd>& other, MetricSet* owner)
: AbstractValueMetric(other, owner),
_values(other._values)
{}