From 481c5fc2c89f25365e7232adcbc88f125d95846d Mon Sep 17 00:00:00 2001 From: chenmingyu Date: Wed, 27 May 2020 22:30:03 +0800 Subject: [PATCH] [Bug][Metrics] Fix bug that some of metrics can not be got The metrics in a metric collector need have same type, but no need to have same unit. --- be/src/util/doris_metrics.cpp | 3 --- be/src/util/metrics.cpp | 3 +-- be/src/util/metrics.h | 2 -- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/be/src/util/doris_metrics.cpp b/be/src/util/doris_metrics.cpp index 2c466e9279434b..0853bd4da231af 100644 --- a/be/src/util/doris_metrics.cpp +++ b/be/src/util/doris_metrics.cpp @@ -150,9 +150,6 @@ DorisMetrics::DorisMetrics() : _name("doris_be"), _hook_name("doris_metrics"), _ _metrics.register_metric( "stream_load", MetricLabels().add("type", "load_rows"), &stream_load_rows_total); - _metrics.register_metric( - "load", MetricLabels().add("type", "receive_bytes"), - &stream_receive_bytes_total); _metrics.register_metric("load_rows", &load_rows_total); _metrics.register_metric("load_bytes", &load_bytes_total); diff --git a/be/src/util/metrics.cpp b/be/src/util/metrics.cpp index cbd5900b8d8ee4..b70248975cd718 100644 --- a/be/src/util/metrics.cpp +++ b/be/src/util/metrics.cpp @@ -79,9 +79,8 @@ void Metric::hide() { bool MetricCollector::add_metic(const MetricLabels& labels, Metric* metric) { if (empty()) { _type = metric->type(); - _unit = metric->unit(); } else { - if (metric->type() != _type || metric->unit() != _unit) { + if (metric->type() != _type) { return false; } } diff --git a/be/src/util/metrics.h b/be/src/util/metrics.h index 46450c46539fc5..4a22f2aa792a39 100644 --- a/be/src/util/metrics.h +++ b/be/src/util/metrics.h @@ -310,10 +310,8 @@ class MetricCollector { return _metrics; } MetricType type() const { return _type; } - MetricUnit unit() const { return _unit; } private: MetricType _type = MetricType::UNTYPED; - MetricUnit _unit = MetricUnit::NOUNIT; std::map _metrics; };