summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Brede Vekterli <vekterli@oath.com>2018-02-20 13:09:47 +0100
committerGitHub <noreply@github.com>2018-02-20 13:09:47 +0100
commit47c80b0ff1976d0cf39f78bda1f5af6a7454a24b (patch)
treeedf753ec940cb40f59e7127e881d9771f7f17c63
parent988c15bdbee69b93aaad6982c8b51e8058bff2de (diff)
parent47c87fe4cb8e8eb8e52aa9afaaca0e9427e6bf50 (diff)
Merge pull request #5076 from vespa-engine/geirst/align-host-info-bucket-spaces-json-format
Align bucket spaces json format with what is expected by clustercontr…
-rw-r--r--protocols/getnodestate/distributor.json16
-rw-r--r--storage/src/tests/distributor/distributor_host_info_reporter_test.cpp10
-rw-r--r--storage/src/vespa/storage/distributor/distributor_host_info_reporter.cpp6
3 files changed, 18 insertions, 14 deletions
diff --git a/protocols/getnodestate/distributor.json b/protocols/getnodestate/distributor.json
index ceed1a1b5c3..970fd09f253 100644
--- a/protocols/getnodestate/distributor.json
+++ b/protocols/getnodestate/distributor.json
@@ -13,13 +13,17 @@
"bucket-spaces" : [
{
"name": "default",
- "total": 11,
- "pending": 3
+ "buckets": {
+ "total": 11,
+ "pending": 3
+ }
},
{
"name": "global",
- "total": 13,
- "pending": 5
+ "buckets": {
+ "total": 13,
+ "pending": 5
+ }
}
]
},
@@ -34,9 +38,7 @@
},
"bucket-spaces" : [
{
- "name": "default",
- "total": 17,
- "pending": 7
+ "name": "default"
}
]
}
diff --git a/storage/src/tests/distributor/distributor_host_info_reporter_test.cpp b/storage/src/tests/distributor/distributor_host_info_reporter_test.cpp
index 14df6ee5016..64df05acb8f 100644
--- a/storage/src/tests/distributor/distributor_host_info_reporter_test.cpp
+++ b/storage/src/tests/distributor/distributor_host_info_reporter_test.cpp
@@ -149,8 +149,9 @@ DistributorHostInfoReporterTest::verifyBucketSpaceStats(const vespalib::Slime& r
size_t bucketsPending)
{
const auto &stats = getBucketSpaceStats(root, nodeIndex, bucketSpaceName);
- CPPUNIT_ASSERT_EQUAL(bucketsTotal, static_cast<size_t>(stats["total"].asLong()));
- CPPUNIT_ASSERT_EQUAL(bucketsPending, static_cast<size_t>(stats["pending"].asLong()));
+ const auto &buckets = stats["buckets"];
+ CPPUNIT_ASSERT_EQUAL(bucketsTotal, static_cast<size_t>(buckets["total"].asLong()));
+ CPPUNIT_ASSERT_EQUAL(bucketsPending, static_cast<size_t>(buckets["pending"].asLong()));
}
void
@@ -159,8 +160,7 @@ DistributorHostInfoReporterTest::verifyBucketSpaceStats(const vespalib::Slime& r
const vespalib::string& bucketSpaceName)
{
const auto &stats = getBucketSpaceStats(root, nodeIndex, bucketSpaceName);
- CPPUNIT_ASSERT(!stats["total"].valid());
- CPPUNIT_ASSERT(!stats["pending"].valid());
+ CPPUNIT_ASSERT(!stats["buckets"].valid());
}
struct Fixture {
@@ -233,7 +233,7 @@ DistributorHostInfoReporterTest::generateExampleJson()
PerNodeBucketSpacesStats stats;
stats[0]["default"] = BucketSpaceStats(11, 3);
stats[0]["global"] = BucketSpaceStats(13, 5);
- stats[5]["default"] = BucketSpaceStats(17, 7);
+ stats[5]["default"] = BucketSpaceStats();
f.bucketSpacesStatsProvider.stats = stats;
vespalib::asciistream json;
diff --git a/storage/src/vespa/storage/distributor/distributor_host_info_reporter.cpp b/storage/src/vespa/storage/distributor/distributor_host_info_reporter.cpp
index 5929f02c04b..8d2e45655d2 100644
--- a/storage/src/vespa/storage/distributor/distributor_host_info_reporter.cpp
+++ b/storage/src/vespa/storage/distributor/distributor_host_info_reporter.cpp
@@ -49,8 +49,10 @@ writeBucketSpacesStats(vespalib::JsonStream& stream,
for (const auto& elem : stats) {
stream << Object() << "name" << elem.first;
if (elem.second.valid()) {
- stream << "total" << elem.second.bucketsTotal()
- << "pending" << elem.second.bucketsPending();
+ stream << "buckets" << Object()
+ << "total" << elem.second.bucketsTotal()
+ << "pending" << elem.second.bucketsPending()
+ << End();
}
stream << End();
}