You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by la...@apache.org on 2020/08/15 14:59:44 UTC

[kudu] 16/23: [collector] some improvements

This is an automated email from the ASF dual-hosted git repository.

laiyingchun pushed a commit to tag kudu-1.12.0-mdh1.0.0-4c2c075-centos-release
in repository https://gitbox.apache.org/repos/asf/kudu.git

commit b7ba14f8a2b2e740c6ad65a64541c52bc4dd1790
Author: zhangyifan8 <zh...@xiaomi.com>
AuthorDate: Thu Apr 2 12:07:30 2020 +0800

    [collector] some improvements
    
    -service monitor should not return if errors occurred when insert/upsert rows.
    -add two new metrics when init metric type.
---
 src/kudu/collector/metrics_collector.cc | 2 ++
 src/kudu/collector/service_monitor.cc   | 8 +++++---
 src/kudu/scripts/falcon_screen.json     | 2 +-
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/kudu/collector/metrics_collector.cc b/src/kudu/collector/metrics_collector.cc
index b170422..6d09a0d 100644
--- a/src/kudu/collector/metrics_collector.cc
+++ b/src/kudu/collector/metrics_collector.cc
@@ -194,6 +194,8 @@ Status MetricsCollector::InitMetrics() {
       EmplaceOrDie(&metric_types, std::make_pair(metric_type.first, metric_type.second));
     }
   }
+  EmplaceIfNotPresent(&metric_types, std::make_pair("merged_entities_count_of_tablet", "GAUGE"));
+  EmplaceIfNotPresent(&metric_types, std::make_pair("live_row_count", "GAUGE"));
 
   metric_types_.swap(metric_types);
   return Status::OK();
diff --git a/src/kudu/collector/service_monitor.cc b/src/kudu/collector/service_monitor.cc
index a92d309..e97fb79 100644
--- a/src/kudu/collector/service_monitor.cc
+++ b/src/kudu/collector/service_monitor.cc
@@ -61,7 +61,7 @@ DEFINE_uint32(collector_monitor_timeout_threshold_sec, 30,
               "take more than this number of seconds, "
               "issue a warning with a trace.");
 DEFINE_uint32(collector_monitor_upsert_timeout_ms, 100,
-              "Timeout for one upsert operation");
+              "Timeout for one insert/upsert operation");
 
 DECLARE_string(collector_cluster_name);
 DECLARE_string(collector_master_addrs);
@@ -411,7 +411,7 @@ Status ServiceMonitor::UpsertAndScanRows(const shared_ptr<KuduTable>& table) {
     if (s.ok()) {
       write_success++;
     } else {
-      LOG(WARNING) << s.ToString() <<  Substitute(": unable to upsert row (id=$0).", i);
+      LOG(WARNING) << s.ToString() <<  Substitute(": unable to upsert row (key=$0).", i);
     }
   }
   int64_t write_latency_ms = (MonoTime::Now() - start).ToMilliseconds();
@@ -464,7 +464,9 @@ Status ServiceMonitor::UpsertAndScanRows(const shared_ptr<KuduTable>& table) {
   RETURN_NOT_OK(row->SetInt64("key", timestamp));
   RETURN_NOT_OK(row->SetInt32("total_count", total_count));
   RETURN_NOT_OK(row->SetInt32("success_count", success_count));
-  RETURN_NOT_OK(session->Apply(insert));
+  WARN_NOT_OK(session->Apply(insert),
+              Substitute("unable to insert row (key=$0, total_count=$1, success_count=$2)",
+                         timestamp, total_count, success_count));
   RETURN_NOT_OK(session->Close());
 
   unordered_map<string, int64_t> report_metrics;
diff --git a/src/kudu/scripts/falcon_screen.json b/src/kudu/scripts/falcon_screen.json
index a7046b1..26b7acd 100644
--- a/src/kudu/scripts/falcon_screen.json
+++ b/src/kudu/scripts/falcon_screen.json
@@ -208,7 +208,7 @@
         "metric=log_sync_latency_percentile_75 service=kudu cluster=${cluster.name} level=${level} v=4",
         "metric=log_sync_latency_percentile_95 service=kudu cluster=${cluster.name} level=${level} v=4",
         "metric=log_sync_latency_percentile_99 service=kudu cluster=${cluster.name} level=${level} v=4",
-        "metric=lth service=kudu cluster=${cluster.name} level=${level} v=4"
+        "metric=live_row_count service=kudu cluster=${cluster.name} level=${level} v=4"
       ],
       "table_mn": [
         "metric=majority_done_ops service=kudu cluster=${cluster.name} level=${level} v=4",