Merge pull request #3793 from Ved-vampir/master

common: change default value for perfcounter description ("NO_INFO_FIX">...

Reviewed-by: John Spray <john.spray@redhat.com>
This commit is contained in:
John Spray 2015-02-25 14:04:28 +00:00
commit 8f18fd9cce
3 changed files with 11 additions and 8 deletions

View File

@ -292,7 +292,10 @@ void PerfCounters::dump_formatted(Formatter *f, bool schema,
if (schema) {
f->open_object_section(d->name);
f->dump_int("type", d->type);
f->dump_string("description", d->description);
if (d->description)
f->dump_string("description", d->description);
else
f->dump_string("description", "");
f->close_section();
} else {
if (d->type & PERFCOUNTER_LONGRUNAVG) {

View File

@ -239,11 +239,11 @@ public:
PerfCountersBuilder(CephContext *cct, const std::string &name,
int first, int last);
~PerfCountersBuilder();
void add_u64(int key, const char *name, const char *description = "NO_INFO_FIX");
void add_u64_counter(int key, const char *name, const char *description = "NO_INFO_FIX");
void add_u64_avg(int key, const char *name, const char *description = "NO_INFO_FIX");
void add_time(int key, const char *name, const char *description = "NO_INFO_FIX");
void add_time_avg(int key, const char *name, const char *description = "NO_INFO_FIX");
void add_u64(int key, const char *name, const char *description = NULL);
void add_u64_counter(int key, const char *name, const char *description = NULL);
void add_u64_avg(int key, const char *name, const char *description = NULL);
void add_time(int key, const char *name, const char *description = NULL);
void add_time_avg(int key, const char *name, const char *description = NULL);
PerfCounters* create_perf_counters();
private:
PerfCountersBuilder(const PerfCountersBuilder &rhs);

View File

@ -182,8 +182,8 @@ TEST(PerfCounters, MultiplePerfCounters) {
"\"element3\":{\"avgcount\":0,\"sum\":0.000000000}}}"), msg);
ASSERT_EQ("", client.do_request("{ \"prefix\": \"perf schema\", \"format\": \"json\" }", &msg));
ASSERT_EQ(sd("{\"test_perfcounter_1\":{\"element1\":{\"type\":2,\"description\":\"NO_INFO_FIX\"},"
"\"element2\":{\"type\":1,\"description\":\"NO_INFO_FIX\"},\"element3\":{\"type\":5,\"description\":\"NO_INFO_FIX\"}}}"), msg);
ASSERT_EQ(sd("{\"test_perfcounter_1\":{\"element1\":{\"type\":2,\"description\":\"\"},"
"\"element2\":{\"type\":1,\"description\":\"\"},\"element3\":{\"type\":5,\"description\":\"\"}}}"), msg);
coll->clear();
ASSERT_EQ("", client.do_request("{ \"prefix\": \"perf dump\", \"format\": \"json\" }", &msg));