diff options
-rw-r--r-- | metrics/src/tests/metricmanagertest.cpp | 2 | ||||
-rw-r--r-- | metrics/src/vespa/metrics/jsonwriter.cpp | 18 | ||||
-rw-r--r-- | metrics/src/vespa/metrics/jsonwriter.h | 2 | ||||
-rw-r--r-- | metrics/src/vespa/metrics/metric.cpp | 1 | ||||
-rw-r--r-- | metrics/src/vespa/metrics/metric.h | 7 | ||||
-rw-r--r-- | metrics/src/vespa/metrics/metricset.cpp | 16 | ||||
-rw-r--r-- | metrics/src/vespa/metrics/metricset.h | 11 | ||||
-rw-r--r-- | storage/src/vespa/storage/bucketdb/bucketmanagermetrics.cpp | 2 | ||||
-rw-r--r-- | storage/src/vespa/storage/distributor/persistence_operation_metric_set.cpp | 2 | ||||
-rw-r--r-- | storage/src/vespa/storage/persistence/filestorage/filestormetrics.cpp | 8 |
10 files changed, 20 insertions, 49 deletions
diff --git a/metrics/src/tests/metricmanagertest.cpp b/metrics/src/tests/metricmanagertest.cpp index e9934b6dbbb..f5d3a77d671 100644 --- a/metrics/src/tests/metricmanagertest.cpp +++ b/metrics/src/tests/metricmanagertest.cpp @@ -68,7 +68,7 @@ struct SubMetricSet : public MetricSet SubMetricSet::SubMetricSet(const Metric::String & name, MetricSet* owner) - : MetricSet(name, "sub", "sub desc", owner, "sub"), + : MetricSet(name, "sub", "sub desc", owner), val1("val1", "tag4 snaptest", "val1 desc", this), val2("val2", "tag5", "val2 desc", this), valsum("valsum", "tag4 snaptest", "valsum desc", this) diff --git a/metrics/src/vespa/metrics/jsonwriter.cpp b/metrics/src/vespa/metrics/jsonwriter.cpp index 8dd5e8fdbcb..6ea585f0635 100644 --- a/metrics/src/vespa/metrics/jsonwriter.cpp +++ b/metrics/src/vespa/metrics/jsonwriter.cpp @@ -41,26 +41,10 @@ JsonWriter::doneVisitingSnapshot(const MetricSnapshot&) _period = 0; } -void -JsonWriter::pushLegacyDimensionFromSet(const MetricSet& ms) -{ - _dimensionStack.push_back({{ms.getDimensionKey(), ms.getName()}}); -} - -void -JsonWriter::pushAllDimensionsFromSet(const MetricSet& ms) -{ - _dimensionStack.push_back(ms.getTags()); -} - bool JsonWriter::visitMetricSet(const MetricSet& set, bool) { - if (!set.getDimensionKey().empty()) { - pushLegacyDimensionFromSet(set); - } else { - pushAllDimensionsFromSet(set); - } + _dimensionStack.push_back(set.getTags()); return true; } diff --git a/metrics/src/vespa/metrics/jsonwriter.h b/metrics/src/vespa/metrics/jsonwriter.h index 07fdc9c22c2..300f0cbb0ec 100644 --- a/metrics/src/vespa/metrics/jsonwriter.h +++ b/metrics/src/vespa/metrics/jsonwriter.h @@ -33,8 +33,6 @@ private: void writeCommonPrefix(const Metric& m); void writeCommonPostfix(const Metric& m); - void pushLegacyDimensionFromSet(const MetricSet&); - void pushAllDimensionsFromSet(const MetricSet&); void writeDimensions(const DimensionSet&); void writeInheritedDimensions(); void writeMetricSpecificDimensions(const Metric&); diff --git a/metrics/src/vespa/metrics/metric.cpp b/metrics/src/vespa/metrics/metric.cpp index f6be5f79357..e67398e4626 100644 --- a/metrics/src/vespa/metrics/metric.cpp +++ b/metrics/src/vespa/metrics/metric.cpp @@ -116,6 +116,7 @@ void Metric::assignMangledNameWithDimensions() { if (!tagsSpecifyAtLeastOneDimension(_tags)) { + _mangledName = _name; return; } sortTagsInDeterministicOrder(); diff --git a/metrics/src/vespa/metrics/metric.h b/metrics/src/vespa/metrics/metric.h index 5b617e68a7f..91ad88fecf7 100644 --- a/metrics/src/vespa/metrics/metric.h +++ b/metrics/src/vespa/metrics/metric.h @@ -215,12 +215,17 @@ public: virtual bool visit(MetricVisitor& visitor, bool tagAsAutoGenerated = false) const = 0; /** Used by sum metric to alter name of cloned metric for sum. */ - void setName(const String& name) { _name = name; } + void setName(const String& name) { + _name = name; + assignMangledNameWithDimensions(); + } + /** Used by sum metric to alter description of cloned metric for sum. */ void setDescription(const String& d) { _description = d; } /** Used by sum metric to alter tag of cloned metric for sum. */ void setTags(Tags tags) { _tags = std::move(tags); + assignMangledNameWithDimensions(); } /** Set whether metrics have ever been set. */ diff --git a/metrics/src/vespa/metrics/metricset.cpp b/metrics/src/vespa/metrics/metricset.cpp index 2e708e17504..cfaeb8b6f02 100644 --- a/metrics/src/vespa/metrics/metricset.cpp +++ b/metrics/src/vespa/metrics/metricset.cpp @@ -15,12 +15,10 @@ LOG_SETUP(".metrics.metricsset"); namespace metrics { MetricSet::MetricSet(const String& name, const String& tags, - const String& description, MetricSet* owner, - const std::string& dimensionKey) + const String& description, MetricSet* owner) : Metric(name, tags, description, owner), _metricOrder(), - _registrationAltered(false), - _dimensionKey(dimensionKey) + _registrationAltered(false) { } @@ -28,8 +26,7 @@ MetricSet::MetricSet(const String& name, Tags dimensions, const String& description, MetricSet* owner) : Metric(name, std::move(dimensions), description, owner), _metricOrder(), - _registrationAltered(false), - _dimensionKey() + _registrationAltered(false) { } @@ -40,13 +37,8 @@ MetricSet::MetricSet(const MetricSet& other, bool includeUnused) : Metric(other, owner), _metricOrder(), - _registrationAltered(false), - _dimensionKey(other._dimensionKey) + _registrationAltered(false) { - if (copyType == INACTIVE && owner == NULL && includeUnused) { - _dimensionKey = ""; - } - for (const Metric* metric : other._metricOrder) { if (copyType != INACTIVE || includeUnused || metric->used()) { Metric* m = metric->clone(ownerList, copyType, this, includeUnused); diff --git a/metrics/src/vespa/metrics/metricset.h b/metrics/src/vespa/metrics/metricset.h index 9671aaffbfc..48027db374a 100644 --- a/metrics/src/vespa/metrics/metricset.h +++ b/metrics/src/vespa/metrics/metricset.h @@ -20,14 +20,10 @@ class MetricSet : public Metric bool _registrationAltered; // Set to true if metrics have been // registered/unregistered since last time // it was reset - std::string _dimensionKey; // If this metric is part of a monitoring dimension, - // the key of the dimension should be set here. - // If so, the name of the metric is used as dimension value. public: MetricSet(const String& name, const String& tags, - const String& description, MetricSet* owner = 0, - const std::string& dimensionKey = ""); + const String& description, MetricSet* owner = 0); MetricSet(const String& name, Tags dimensions, const String& description, MetricSet* owner = 0); @@ -85,11 +81,6 @@ public: bool isMetricSet() const override { return true; } void addToPart(Metric& m) const override { addTo(m, 0); } - /** - * Returns the key of the dimension this metric is part of (if any). - */ - const std::string& getDimensionKey() const { return _dimensionKey; } - private: // Do not generate default copy constructor or assignment operator // These would screw up metric registering diff --git a/storage/src/vespa/storage/bucketdb/bucketmanagermetrics.cpp b/storage/src/vespa/storage/bucketdb/bucketmanagermetrics.cpp index 84b90ceedec..b95fb6b814c 100644 --- a/storage/src/vespa/storage/bucketdb/bucketmanagermetrics.cpp +++ b/storage/src/vespa/storage/bucketdb/bucketmanagermetrics.cpp @@ -10,7 +10,7 @@ using vespalib::IllegalStateException; using vespalib::make_string; DataStoredMetrics::DataStoredMetrics(const std::string& name, metrics::MetricSet* owner) - : metrics::MetricSet(name, "partofsum yamasdefault", "", owner, "disk"), + : metrics::MetricSet(name, "partofsum yamasdefault", "", owner), buckets("buckets", "", "buckets managed", this), docs("docs", "", "documents stored", this), bytes("bytes", "", "bytes stored", this), diff --git a/storage/src/vespa/storage/distributor/persistence_operation_metric_set.cpp b/storage/src/vespa/storage/distributor/persistence_operation_metric_set.cpp index d5f73a9e916..30fa2797ef4 100644 --- a/storage/src/vespa/storage/distributor/persistence_operation_metric_set.cpp +++ b/storage/src/vespa/storage/distributor/persistence_operation_metric_set.cpp @@ -55,7 +55,7 @@ PersistenceFailuresMetricSet::clone(std::vector<Metric::UP>& ownerList, CopyType } PersistenceOperationMetricSet::PersistenceOperationMetricSet(const std::string& name, MetricSet* owner) - : MetricSet(name, "", vespalib::make_string("Statistics for the %s command", name.c_str()), owner, "operationtype"), + : MetricSet(name, "", vespalib::make_string("Statistics for the %s command", name.c_str()), owner), latency("latency", "yamasdefault", vespalib::make_string("The average latency of %s operations", name.c_str()), this), ok("ok", "logdefault yamasdefault", vespalib::make_string("The number of successful %s operations performed", name.c_str()), this), failures(this) diff --git a/storage/src/vespa/storage/persistence/filestorage/filestormetrics.cpp b/storage/src/vespa/storage/persistence/filestorage/filestormetrics.cpp index 1293b5d1808..52d95e9a3ed 100644 --- a/storage/src/vespa/storage/persistence/filestorage/filestormetrics.cpp +++ b/storage/src/vespa/storage/persistence/filestorage/filestormetrics.cpp @@ -10,7 +10,7 @@ using metrics::MetricSet; using metrics::LoadTypeSet; FileStorThreadMetrics::Op::Op(const std::string& id, const std::string& name, MetricSet* owner) - : MetricSet(id, id, name + " load in filestor thread", owner, "operationtype"), + : MetricSet(id, "", name + " load in filestor thread", owner), _name(name), count("count", "yamasdefault", "Number of requests processed.", this), latency("latency", "yamasdefault", "Latency of successful requests.", this), @@ -118,7 +118,7 @@ FileStorThreadMetrics::Visitor::clone(std::vector<Metric::UP>& ownerList, } FileStorThreadMetrics::FileStorThreadMetrics(const std::string& name, const std::string& desc, const LoadTypeSet& lt) - : MetricSet(name, "filestor partofsum thread", desc, nullptr, "thread"), + : MetricSet(name, "filestor partofsum", desc), operations("operations", "", "Number of operations processed.", this), failedOperations("failedoperations", "", "Number of operations throwing exceptions.", this), put(lt, OpWithRequestSize<Op>("put", "Put"), this), @@ -176,7 +176,7 @@ FileStorThreadMetrics::~FileStorThreadMetrics() = default; FileStorStripeMetrics::FileStorStripeMetrics(const std::string& name, const std::string& description, const LoadTypeSet& loadTypes) - : MetricSet(name, "partofsum stripe", description, nullptr, "stripe"), + : MetricSet(name, "partofsum", description), averageQueueWaitingTime(loadTypes, metrics::DoubleAverageMetric("averagequeuewait", "", "Average time an operation spends in input queue."), @@ -188,7 +188,7 @@ FileStorStripeMetrics::~FileStorStripeMetrics() = default; FileStorDiskMetrics::FileStorDiskMetrics(const std::string& name, const std::string& description, const metrics::LoadTypeSet& loadTypes, MetricSet* owner) - : MetricSet(name, "partofsum disk", description, owner, "disk"), + : MetricSet(name, "partofsum", description, owner), sumThreads("allthreads", "sum", "", this), sumStripes("allstripes", "sum", "", this), averageQueueWaitingTime(loadTypes, |