You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by to...@apache.org on 2018/02/06 08:08:56 UTC

[5/7] kudu git commit: KUDU-2279 (part 5): don't include entity attributes in log

KUDU-2279 (part 5): don't include entity attributes in log

Entity attributes like table names and partition descriptions aren't
very useful in the context of the metrics log. They can always be
grabbed from other places like 'kudu remote_replica list', etc, and are
rarely relevant for tserver-scope debugging.

Additionally, these might be considered somewhat sensitive for users to
share publically in bug reports, etc, so may as well "redact" them.

This shaves a few more bytes off the entries in the metrics log.

Change-Id: Ic995f6a3b8430b73a041de8e5bcbc53a5d8e7f1b
Reviewed-on: http://gerrit.cloudera.org:8080/9180
Tested-by: Kudu Jenkins
Reviewed-by: Todd Lipcon <to...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/7579da22
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/7579da22
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/7579da22

Branch: refs/heads/master
Commit: 7579da22adb758a680b2ab09d94a86a92b4e18c5
Parents: 2572c4f
Author: Todd Lipcon <to...@apache.org>
Authored: Wed Jan 31 19:49:10 2018 -0800
Committer: Todd Lipcon <to...@apache.org>
Committed: Tue Feb 6 07:59:14 2018 +0000

----------------------------------------------------------------------
 src/kudu/server/server_base.cc |  4 ++++
 src/kudu/util/metrics.cc       | 14 ++++++++------
 src/kudu/util/metrics.h        |  3 +++
 3 files changed, 15 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/7579da22/src/kudu/server/server_base.cc
----------------------------------------------------------------------
diff --git a/src/kudu/server/server_base.cc b/src/kudu/server/server_base.cc
index e5a5a9a..95d3e65 100644
--- a/src/kudu/server/server_base.cc
+++ b/src/kudu/server/server_base.cc
@@ -621,6 +621,10 @@ void ServerBase::MetricsLoggingThread() {
   // also ensures that we don't dump a bunch of zero data on startup.
   opts.include_untouched_metrics = false;
 
+  // Entity attributes aren't that useful in the context of this log. We can
+  // always grab the entity attributes separately if necessary.
+  opts.include_entity_attributes = false;
+
   MonoTime next_log = MonoTime::Now();
   while (!stop_background_threads_latch_.WaitUntil(next_log)) {
     next_log = MonoTime::Now() +

http://git-wip-us.apache.org/repos/asf/kudu/blob/7579da22/src/kudu/util/metrics.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/metrics.cc b/src/kudu/util/metrics.cc
index 911cab6..218b08e 100644
--- a/src/kudu/util/metrics.cc
+++ b/src/kudu/util/metrics.cc
@@ -238,13 +238,15 @@ Status MetricEntity::WriteAsJson(JsonWriter* writer,
   writer->String("id");
   writer->String(id_);
 
-  writer->String("attributes");
-  writer->StartObject();
-  for (const AttributeMap::value_type& val : attrs) {
-    writer->String(val.first);
-    writer->String(val.second);
+  if (opts.include_entity_attributes) {
+    writer->String("attributes");
+    writer->StartObject();
+    for (const AttributeMap::value_type& val : attrs) {
+      writer->String(val.first);
+      writer->String(val.second);
+    }
+    writer->EndObject();
   }
-  writer->EndObject();
 
   writer->String("metrics");
   writer->StartArray();

http://git-wip-us.apache.org/repos/asf/kudu/blob/7579da22/src/kudu/util/metrics.h
----------------------------------------------------------------------
diff --git a/src/kudu/util/metrics.h b/src/kudu/util/metrics.h
index 3876405..65ad030 100644
--- a/src/kudu/util/metrics.h
+++ b/src/kudu/util/metrics.h
@@ -435,6 +435,9 @@ struct MetricJsonOptions {
   // notably, gauges may be non-zero and then reset to zero, so seeing that
   // they are currently zero does not indicate they are "untouched".
   bool include_untouched_metrics = true;
+
+  // Whether to include the attributes of each entity.
+  bool include_entity_attributes = true;
 };
 
 class MetricEntityPrototype {