summaryrefslogtreecommitdiffstats
path: root/storage
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2016-12-19 03:38:19 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2016-12-19 14:15:54 +0000
commit2e0bc6c08d1735240c7991a91cbe45ba9ef8badd (patch)
tree12cd5597d274b7b7c82527b5e3d9e390510dbb4a /storage
parentd02f3514af433dcbddc739421549e3f527b5af4c (diff)
GC unused code and only include the stuff needed.
Diffstat (limited to 'storage')
-rw-r--r--storage/src/vespa/storage/bucketdb/bucketmanagermetrics.cpp55
1 files changed, 55 insertions, 0 deletions
diff --git a/storage/src/vespa/storage/bucketdb/bucketmanagermetrics.cpp b/storage/src/vespa/storage/bucketdb/bucketmanagermetrics.cpp
new file mode 100644
index 00000000000..e0dc96c8153
--- /dev/null
+++ b/storage/src/vespa/storage/bucketdb/bucketmanagermetrics.cpp
@@ -0,0 +1,55 @@
+// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+#include "bucketmanagermetrics.h"
+#include <vespa/vespalib/util/exceptions.h>
+
+namespace storage {
+
+using vespalib::IllegalStateException;
+using vespalib::make_string;
+
+DataStoredMetrics::DataStoredMetrics(const std::string& name, metrics::MetricSet* owner)
+ : metrics::MetricSet(name, "partofsum yamasdefault", "", owner, "disk"),
+ buckets("buckets", "", "buckets managed", this),
+ docs("docs", "", "documents stored", this),
+ bytes("bytes", "", "bytes stored", this),
+ active("activebuckets", "", "Number of active buckets on the node", this),
+ ready("readybuckets", "", "Number of ready buckets on the node", this)
+{
+ docs.logOnlyIfSet();
+ bytes.logOnlyIfSet();
+ active.logOnlyIfSet();
+ ready.logOnlyIfSet();
+}
+
+DataStoredMetrics::~DataStoredMetrics() { }
+
+BucketManagerMetrics::BucketManagerMetrics()
+ : metrics::MetricSet("datastored", "", ""),
+ disks(),
+ total("alldisks", "sum", "Sum of data stored metrics for all disks", this),
+ simpleBucketInfoRequestSize("simplebucketinforeqsize", "",
+ "Amount of buckets returned in simple bucket info requests",
+ this),
+ fullBucketInfoRequestSize("fullbucketinforeqsize", "",
+ "Amount of distributors answered at once in full bucket info requests.", this),
+ fullBucketInfoLatency("fullbucketinfolatency", "",
+ "Amount of time spent to process a full bucket info request", this)
+{ }
+
+BucketManagerMetrics::~BucketManagerMetrics() { }
+
+void
+BucketManagerMetrics::setDisks(uint16_t numDisks) {
+ assert(numDisks > 0);
+ if (!disks.empty()) {
+ throw IllegalStateException("Cannot initialize disks twice", VESPA_STRLOC);
+ }
+ for (uint16_t i = 0; i<numDisks; i++) {
+ disks.push_back(DataStoredMetrics::SP(
+ new DataStoredMetrics(make_string("disk%d", i), this)));
+ total.addMetricToSum(*disks.back());
+ }
+}
+
+}