github-actions[bot] commented on code in PR #18115:
URL: https://github.com/apache/doris/pull/18115#discussion_r1148598809


##########
be/src/util/bvar_metrics.cpp:
##########
@@ -0,0 +1,54 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "util/bvar_metrics.h"
+
+namespace doris {
+template <typename T>
+void BvarAdderMetric<T>::increment(T value) {
+    (*adder_) << value;
+}
+
+template <typename T>
+void BvarAdderMetric<T>::set_value(T value) {
+    adder_->reset();
+    (*adder_) << value;
+}
+
+template <typename T>
+std::string BvarAdderMetric<T>::to_prometheus(bool with_tablet_metrics) const {
+    return "";
+}
+
+void BvarMetricEntity::put(std::string name, BvarMetric metric) {
+    {
+        std::lock_guard<bthread::Mutex> l(mutex_);
+        auto it = map_.find(name);

Review Comment:
   warning: use of undeclared identifier 'map_' [clang-diagnostic-error]
   ```cpp
           auto it = map_.find(name);
                     ^
   ```
   



##########
be/src/util/bvar_metrics.cpp:
##########
@@ -0,0 +1,54 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "util/bvar_metrics.h"
+
+namespace doris {
+template <typename T>
+void BvarAdderMetric<T>::increment(T value) {
+    (*adder_) << value;
+}
+
+template <typename T>
+void BvarAdderMetric<T>::set_value(T value) {
+    adder_->reset();
+    (*adder_) << value;
+}
+
+template <typename T>
+std::string BvarAdderMetric<T>::to_prometheus(bool with_tablet_metrics) const {
+    return "";
+}
+
+void BvarMetricEntity::put(std::string name, BvarMetric metric) {
+    {
+        std::lock_guard<bthread::Mutex> l(mutex_);
+        auto it = map_.find(name);
+        if (it == map_.end()) {

Review Comment:
   warning: use of undeclared identifier 'map_' [clang-diagnostic-error]
   ```cpp
           if (it == map_.end()) {
                     ^
   ```
   



##########
be/src/util/bvar_metrics.cpp:
##########
@@ -0,0 +1,54 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "util/bvar_metrics.h"
+
+namespace doris {
+template <typename T>
+void BvarAdderMetric<T>::increment(T value) {
+    (*adder_) << value;
+}
+
+template <typename T>
+void BvarAdderMetric<T>::set_value(T value) {
+    adder_->reset();
+    (*adder_) << value;
+}
+
+template <typename T>
+std::string BvarAdderMetric<T>::to_prometheus(bool with_tablet_metrics) const {
+    return "";
+}
+
+void BvarMetricEntity::put(std::string name, BvarMetric metric) {
+    {
+        std::lock_guard<bthread::Mutex> l(mutex_);
+        auto it = map_.find(name);
+        if (it == map_.end()) {
+            map_[name] = std::make_shared<BvarMetric>(metric);

Review Comment:
   warning: use of undeclared identifier 'map_' [clang-diagnostic-error]
   ```cpp
               map_[name] = std::make_shared<BvarMetric>(metric);
               ^
   ```
   



##########
be/src/util/bvar_metrics.h:
##########
@@ -0,0 +1,109 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#pragma once
+
+#include <bthread/mutex.h>
+#include <bvar/latency_recorder.h>
+#include <bvar/reducer.h>
+#include <bvar/status.h>
+
+#include <string>
+#include <unordered_map>
+
+namespace doris {
+
+enum class BvarMetricType { COUNTER, GAUGE, HISTOGRAM, SUMMARY, UNTYPED };
+enum class BvarMetricUnit {
+    NANOSECONDS,
+    MICROSECONDS,
+    MILLISECONDS,
+    SECONDS,
+    BYTES,
+    ROWS,
+    PERCENT,
+    REQUESTS,
+    OPERATIONS,
+    BLOCKS,
+    ROWSETS,
+    CONNECTIONS,
+    PACKETS,
+    NOUNIT,
+    FILESYSTEM
+};
+using Labels = std::unordered_map<std::string, std::string>;
+
+class BvarMetric {
+public:
+    BvarMetric() = default;
+    virtual ~BvarMetric() = default;
+    BvarMetric(BvarMetric&) = default;
+    BvarMetric(BvarMetricType type, BvarMetricUnit unit, std::string name, 
std::string description,
+               std::string group_name, Labels labels)
+            : type_(type),
+              unit_(unit),
+              name_(name),
+              description_(description),
+              group_name_(group_name),
+              labels_(labels) {}
+    virtual std::string to_prometheus(bool with_tablet_metrics = false) const 
{ return ""; };
+    // std::string to_json(bool with_tablet_metrics = false) const;
+    // std::string to_core_string() const;
+protected:
+    BvarMetricType type_;
+    BvarMetricUnit unit_;
+    std::string name_;
+    std::string description_;
+    std::string group_name_;
+    Labels labels_;
+};
+
+template <typename T>
+class BvarAdderMetric : public BvarMetric {
+public:
+    BvarAdderMetric(BvarMetricType type, BvarMetricUnit unit, std::string name,
+                    std::string description, std::string group_name, Labels 
labels)
+            : BvarMetric(type, unit, name, description, group_name, labels) {
+        adder_ = std::make_shared<bvar::Adder<T>>(group_name, name + '_' + 
description);

Review Comment:
   warning: no template named 'make_shared' in namespace 'std'; did you mean 
'make_signed'? [clang-diagnostic-error]
   
   ```suggestion
           adder_ = std::make_signed<bvar::Adder<T>>(group_name, name + '_' + 
description);
   ```
   **/usr/include/c++/11/type_traits:1965:** 'make_signed' declared here
   ```cpp
       struct make_signed
              ^
   ```
   



##########
be/src/util/bvar_metrics.cpp:
##########
@@ -0,0 +1,54 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "util/bvar_metrics.h"
+
+namespace doris {
+template <typename T>
+void BvarAdderMetric<T>::increment(T value) {
+    (*adder_) << value;
+}
+
+template <typename T>
+void BvarAdderMetric<T>::set_value(T value) {
+    adder_->reset();
+    (*adder_) << value;
+}
+
+template <typename T>
+std::string BvarAdderMetric<T>::to_prometheus(bool with_tablet_metrics) const {
+    return "";
+}
+
+void BvarMetricEntity::put(std::string name, BvarMetric metric) {
+    {
+        std::lock_guard<bthread::Mutex> l(mutex_);
+        auto it = map_.find(name);
+        if (it == map_.end()) {
+            map_[name] = std::make_shared<BvarMetric>(metric);

Review Comment:
   warning: no template named 'make_shared' in namespace 'std'; did you mean 
'make_signed'? [clang-diagnostic-error]
   
   ```suggestion
               map_[name] = std::make_signed<BvarMetric>(metric);
   ```
   **/usr/include/c++/11/type_traits:1965:** 'make_signed' declared here
   ```cpp
       struct make_signed
              ^
   ```
   



##########
be/src/util/bvar_metrics.h:
##########
@@ -0,0 +1,109 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#pragma once
+
+#include <bthread/mutex.h>
+#include <bvar/latency_recorder.h>
+#include <bvar/reducer.h>
+#include <bvar/status.h>
+
+#include <string>
+#include <unordered_map>
+
+namespace doris {
+
+enum class BvarMetricType { COUNTER, GAUGE, HISTOGRAM, SUMMARY, UNTYPED };
+enum class BvarMetricUnit {
+    NANOSECONDS,
+    MICROSECONDS,
+    MILLISECONDS,
+    SECONDS,
+    BYTES,
+    ROWS,
+    PERCENT,
+    REQUESTS,
+    OPERATIONS,
+    BLOCKS,
+    ROWSETS,
+    CONNECTIONS,
+    PACKETS,
+    NOUNIT,
+    FILESYSTEM
+};
+using Labels = std::unordered_map<std::string, std::string>;
+
+class BvarMetric {
+public:
+    BvarMetric() = default;
+    virtual ~BvarMetric() = default;
+    BvarMetric(BvarMetric&) = default;
+    BvarMetric(BvarMetricType type, BvarMetricUnit unit, std::string name, 
std::string description,
+               std::string group_name, Labels labels)
+            : type_(type),
+              unit_(unit),
+              name_(name),
+              description_(description),
+              group_name_(group_name),
+              labels_(labels) {}
+    virtual std::string to_prometheus(bool with_tablet_metrics = false) const 
{ return ""; };
+    // std::string to_json(bool with_tablet_metrics = false) const;
+    // std::string to_core_string() const;
+protected:
+    BvarMetricType type_;
+    BvarMetricUnit unit_;
+    std::string name_;
+    std::string description_;
+    std::string group_name_;
+    Labels labels_;
+};
+
+template <typename T>
+class BvarAdderMetric : public BvarMetric {
+public:
+    BvarAdderMetric(BvarMetricType type, BvarMetricUnit unit, std::string name,
+                    std::string description, std::string group_name, Labels 
labels)
+            : BvarMetric(type, unit, name, description, group_name, labels) {
+        adder_ = std::make_shared<bvar::Adder<T>>(group_name, name + '_' + 
description);
+    }
+    ~BvarAdderMetric() override = default;
+    void increment(T value);
+    void set_value(T value);
+    std::string to_prometheus(bool with_tablet_metrics = false) const override;
+
+private:
+    std::shared_ptr<bvar::Adder<T>> adder_;

Review Comment:
   warning: no template named 'shared_ptr' in namespace 'std' 
[clang-diagnostic-error]
   ```cpp
       std::shared_ptr<bvar::Adder<T>> adder_;
            ^
   ```
   



##########
be/src/util/bvar_metrics.h:
##########
@@ -0,0 +1,109 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#pragma once
+
+#include <bthread/mutex.h>
+#include <bvar/latency_recorder.h>
+#include <bvar/reducer.h>
+#include <bvar/status.h>
+
+#include <string>
+#include <unordered_map>
+
+namespace doris {
+
+enum class BvarMetricType { COUNTER, GAUGE, HISTOGRAM, SUMMARY, UNTYPED };
+enum class BvarMetricUnit {
+    NANOSECONDS,
+    MICROSECONDS,
+    MILLISECONDS,
+    SECONDS,
+    BYTES,
+    ROWS,
+    PERCENT,
+    REQUESTS,
+    OPERATIONS,
+    BLOCKS,
+    ROWSETS,
+    CONNECTIONS,
+    PACKETS,
+    NOUNIT,
+    FILESYSTEM
+};
+using Labels = std::unordered_map<std::string, std::string>;
+
+class BvarMetric {
+public:
+    BvarMetric() = default;
+    virtual ~BvarMetric() = default;
+    BvarMetric(BvarMetric&) = default;
+    BvarMetric(BvarMetricType type, BvarMetricUnit unit, std::string name, 
std::string description,
+               std::string group_name, Labels labels)
+            : type_(type),
+              unit_(unit),
+              name_(name),
+              description_(description),
+              group_name_(group_name),
+              labels_(labels) {}
+    virtual std::string to_prometheus(bool with_tablet_metrics = false) const 
{ return ""; };
+    // std::string to_json(bool with_tablet_metrics = false) const;
+    // std::string to_core_string() const;
+protected:
+    BvarMetricType type_;
+    BvarMetricUnit unit_;
+    std::string name_;
+    std::string description_;
+    std::string group_name_;
+    Labels labels_;
+};
+
+template <typename T>
+class BvarAdderMetric : public BvarMetric {
+public:
+    BvarAdderMetric(BvarMetricType type, BvarMetricUnit unit, std::string name,
+                    std::string description, std::string group_name, Labels 
labels)
+            : BvarMetric(type, unit, name, description, group_name, labels) {
+        adder_ = std::make_shared<bvar::Adder<T>>(group_name, name + '_' + 
description);
+    }
+    ~BvarAdderMetric() override = default;
+    void increment(T value);
+    void set_value(T value);
+    std::string to_prometheus(bool with_tablet_metrics = false) const override;
+
+private:
+    std::shared_ptr<bvar::Adder<T>> adder_;
+};
+
+class BvarMetricEntity {
+public:
+    BvarMetricEntity() = default;
+    BvarMetricEntity(std::string entity_name) { this->entity_name_ = 
entity_name; }
+    BvarMetricEntity(BvarMetricEntity& entity) {
+        this->entity_name_ = entity.entity_name_;
+        this->map_ = entity.map_;

Review Comment:
   warning: no member named 'map_' in 'doris::BvarMetricEntity' 
[clang-diagnostic-error]
   ```cpp
           this->map_ = entity.map_;
                 ^
   ```
   



##########
be/src/util/bvar_metrics.h:
##########
@@ -0,0 +1,109 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#pragma once
+
+#include <bthread/mutex.h>
+#include <bvar/latency_recorder.h>
+#include <bvar/reducer.h>
+#include <bvar/status.h>
+
+#include <string>
+#include <unordered_map>
+
+namespace doris {
+
+enum class BvarMetricType { COUNTER, GAUGE, HISTOGRAM, SUMMARY, UNTYPED };
+enum class BvarMetricUnit {
+    NANOSECONDS,
+    MICROSECONDS,
+    MILLISECONDS,
+    SECONDS,
+    BYTES,
+    ROWS,
+    PERCENT,
+    REQUESTS,
+    OPERATIONS,
+    BLOCKS,
+    ROWSETS,
+    CONNECTIONS,
+    PACKETS,
+    NOUNIT,
+    FILESYSTEM
+};
+using Labels = std::unordered_map<std::string, std::string>;
+
+class BvarMetric {
+public:
+    BvarMetric() = default;
+    virtual ~BvarMetric() = default;
+    BvarMetric(BvarMetric&) = default;
+    BvarMetric(BvarMetricType type, BvarMetricUnit unit, std::string name, 
std::string description,
+               std::string group_name, Labels labels)
+            : type_(type),
+              unit_(unit),
+              name_(name),
+              description_(description),
+              group_name_(group_name),
+              labels_(labels) {}
+    virtual std::string to_prometheus(bool with_tablet_metrics = false) const 
{ return ""; };
+    // std::string to_json(bool with_tablet_metrics = false) const;
+    // std::string to_core_string() const;
+protected:
+    BvarMetricType type_;
+    BvarMetricUnit unit_;
+    std::string name_;
+    std::string description_;
+    std::string group_name_;
+    Labels labels_;
+};
+
+template <typename T>
+class BvarAdderMetric : public BvarMetric {
+public:
+    BvarAdderMetric(BvarMetricType type, BvarMetricUnit unit, std::string name,
+                    std::string description, std::string group_name, Labels 
labels)
+            : BvarMetric(type, unit, name, description, group_name, labels) {
+        adder_ = std::make_shared<bvar::Adder<T>>(group_name, name + '_' + 
description);
+    }
+    ~BvarAdderMetric() override = default;
+    void increment(T value);
+    void set_value(T value);
+    std::string to_prometheus(bool with_tablet_metrics = false) const override;
+
+private:
+    std::shared_ptr<bvar::Adder<T>> adder_;
+};
+
+class BvarMetricEntity {
+public:
+    BvarMetricEntity() = default;
+    BvarMetricEntity(std::string entity_name) { this->entity_name_ = 
entity_name; }
+    BvarMetricEntity(BvarMetricEntity& entity) {
+        this->entity_name_ = entity.entity_name_;
+        this->map_ = entity.map_;

Review Comment:
   warning: no member named 'map_' in 'doris::BvarMetricEntity' 
[clang-diagnostic-error]
   ```cpp
           this->map_ = entity.map_;
                               ^
   ```
   



##########
be/src/util/bvar_metrics.h:
##########
@@ -0,0 +1,109 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#pragma once
+
+#include <bthread/mutex.h>
+#include <bvar/latency_recorder.h>
+#include <bvar/reducer.h>
+#include <bvar/status.h>
+
+#include <string>
+#include <unordered_map>
+
+namespace doris {
+
+enum class BvarMetricType { COUNTER, GAUGE, HISTOGRAM, SUMMARY, UNTYPED };
+enum class BvarMetricUnit {
+    NANOSECONDS,
+    MICROSECONDS,
+    MILLISECONDS,
+    SECONDS,
+    BYTES,
+    ROWS,
+    PERCENT,
+    REQUESTS,
+    OPERATIONS,
+    BLOCKS,
+    ROWSETS,
+    CONNECTIONS,
+    PACKETS,
+    NOUNIT,
+    FILESYSTEM
+};
+using Labels = std::unordered_map<std::string, std::string>;
+
+class BvarMetric {
+public:
+    BvarMetric() = default;
+    virtual ~BvarMetric() = default;
+    BvarMetric(BvarMetric&) = default;
+    BvarMetric(BvarMetricType type, BvarMetricUnit unit, std::string name, 
std::string description,
+               std::string group_name, Labels labels)
+            : type_(type),
+              unit_(unit),
+              name_(name),
+              description_(description),
+              group_name_(group_name),
+              labels_(labels) {}
+    virtual std::string to_prometheus(bool with_tablet_metrics = false) const 
{ return ""; };
+    // std::string to_json(bool with_tablet_metrics = false) const;
+    // std::string to_core_string() const;
+protected:
+    BvarMetricType type_;
+    BvarMetricUnit unit_;
+    std::string name_;
+    std::string description_;
+    std::string group_name_;
+    Labels labels_;
+};
+
+template <typename T>
+class BvarAdderMetric : public BvarMetric {
+public:
+    BvarAdderMetric(BvarMetricType type, BvarMetricUnit unit, std::string name,
+                    std::string description, std::string group_name, Labels 
labels)
+            : BvarMetric(type, unit, name, description, group_name, labels) {
+        adder_ = std::make_shared<bvar::Adder<T>>(group_name, name + '_' + 
description);
+    }
+    ~BvarAdderMetric() override = default;
+    void increment(T value);
+    void set_value(T value);
+    std::string to_prometheus(bool with_tablet_metrics = false) const override;
+
+private:
+    std::shared_ptr<bvar::Adder<T>> adder_;
+};
+
+class BvarMetricEntity {
+public:
+    BvarMetricEntity() = default;
+    BvarMetricEntity(std::string entity_name) { this->entity_name_ = 
entity_name; }
+    BvarMetricEntity(BvarMetricEntity& entity) {
+        this->entity_name_ = entity.entity_name_;
+        this->map_ = entity.map_;
+    }
+    void put(std::string name, BvarMetric metric);
+    std::string to_prometheus();
+
+private:
+    std::string entity_name_;
+    std::unordered_map<std::string, std::shared_ptr<BvarMetric>> map_;

Review Comment:
   warning: 'BvarMetric' does not refer to a value [clang-diagnostic-error]
   ```cpp
       std::unordered_map<std::string, std::shared_ptr<BvarMetric>> map_;
                                                       ^
   ```
   **be/src/util/bvar_metrics.h:49:** declared here
   ```cpp
   class BvarMetric {
         ^
   ```
   



##########
be/src/util/bvar_metrics.h:
##########
@@ -0,0 +1,109 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#pragma once
+
+#include <bthread/mutex.h>
+#include <bvar/latency_recorder.h>
+#include <bvar/reducer.h>
+#include <bvar/status.h>
+
+#include <string>
+#include <unordered_map>
+
+namespace doris {
+
+enum class BvarMetricType { COUNTER, GAUGE, HISTOGRAM, SUMMARY, UNTYPED };
+enum class BvarMetricUnit {
+    NANOSECONDS,
+    MICROSECONDS,
+    MILLISECONDS,
+    SECONDS,
+    BYTES,
+    ROWS,
+    PERCENT,
+    REQUESTS,
+    OPERATIONS,
+    BLOCKS,
+    ROWSETS,
+    CONNECTIONS,
+    PACKETS,
+    NOUNIT,
+    FILESYSTEM
+};
+using Labels = std::unordered_map<std::string, std::string>;
+
+class BvarMetric {
+public:
+    BvarMetric() = default;
+    virtual ~BvarMetric() = default;
+    BvarMetric(BvarMetric&) = default;
+    BvarMetric(BvarMetricType type, BvarMetricUnit unit, std::string name, 
std::string description,
+               std::string group_name, Labels labels)
+            : type_(type),
+              unit_(unit),
+              name_(name),
+              description_(description),
+              group_name_(group_name),
+              labels_(labels) {}
+    virtual std::string to_prometheus(bool with_tablet_metrics = false) const 
{ return ""; };
+    // std::string to_json(bool with_tablet_metrics = false) const;
+    // std::string to_core_string() const;
+protected:
+    BvarMetricType type_;
+    BvarMetricUnit unit_;
+    std::string name_;
+    std::string description_;
+    std::string group_name_;
+    Labels labels_;
+};
+
+template <typename T>
+class BvarAdderMetric : public BvarMetric {
+public:
+    BvarAdderMetric(BvarMetricType type, BvarMetricUnit unit, std::string name,
+                    std::string description, std::string group_name, Labels 
labels)
+            : BvarMetric(type, unit, name, description, group_name, labels) {
+        adder_ = std::make_shared<bvar::Adder<T>>(group_name, name + '_' + 
description);
+    }
+    ~BvarAdderMetric() override = default;
+    void increment(T value);
+    void set_value(T value);
+    std::string to_prometheus(bool with_tablet_metrics = false) const override;
+
+private:
+    std::shared_ptr<bvar::Adder<T>> adder_;
+};
+
+class BvarMetricEntity {
+public:
+    BvarMetricEntity() = default;
+    BvarMetricEntity(std::string entity_name) { this->entity_name_ = 
entity_name; }
+    BvarMetricEntity(BvarMetricEntity& entity) {
+        this->entity_name_ = entity.entity_name_;
+        this->map_ = entity.map_;
+    }
+    void put(std::string name, BvarMetric metric);
+    std::string to_prometheus();
+
+private:
+    std::string entity_name_;
+    std::unordered_map<std::string, std::shared_ptr<BvarMetric>> map_;

Review Comment:
   warning: no member named 'shared_ptr' in namespace 'std' 
[clang-diagnostic-error]
   ```cpp
       std::unordered_map<std::string, std::shared_ptr<BvarMetric>> map_;
                                            ^
   ```
   



##########
be/src/util/doris_bvar_metrics.cpp:
##########
@@ -0,0 +1,61 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "doris_bvar_metrics.h"
+
+namespace doris {
+
+void DorisBvarMetrics::initialize() {
+    server_metric_entity.put("fragment_request_total", 
g_adder_fragment_requests_total);

Review Comment:
   warning: no matching constructor for initialization of 'doris::BvarMetric' 
[clang-diagnostic-error]
   ```cpp
       server_metric_entity.put("fragment_request_total", 
g_adder_fragment_requests_total);
                                                          ^
   ```
   **be/src/util/bvar_metrics.h:53:** candidate constructor not viable: no 
known conversion from 'BvarAdderMetric<int64_t>' (aka 'BvarAdderMetric<long>') 
to 'doris::BvarMetric &' for 1st argument
   ```cpp
       BvarMetric(BvarMetric&) = default;
       ^
   ```
   **be/src/util/bvar_metrics.h:51:** candidate constructor not viable: 
requires 0 arguments, but 1 was provided
   ```cpp
       BvarMetric() = default;
       ^
   ```
   **be/src/util/bvar_metrics.h:54:** candidate constructor not viable: 
requires 6 arguments, but 1 was provided
   ```cpp
       BvarMetric(BvarMetricType type, BvarMetricUnit unit, std::string name, 
std::string description,
       ^
   ```
   **be/src/util/bvar_metrics.h:99:** passing argument to parameter 'metric' 
here
   ```cpp
       void put(std::string name, BvarMetric metric);
                                             ^
   ```
   



##########
be/src/util/bvar_metrics.h:
##########
@@ -0,0 +1,109 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#pragma once
+
+#include <bthread/mutex.h>
+#include <bvar/latency_recorder.h>
+#include <bvar/reducer.h>
+#include <bvar/status.h>
+
+#include <string>
+#include <unordered_map>
+
+namespace doris {
+
+enum class BvarMetricType { COUNTER, GAUGE, HISTOGRAM, SUMMARY, UNTYPED };
+enum class BvarMetricUnit {
+    NANOSECONDS,
+    MICROSECONDS,
+    MILLISECONDS,
+    SECONDS,
+    BYTES,
+    ROWS,
+    PERCENT,
+    REQUESTS,
+    OPERATIONS,
+    BLOCKS,
+    ROWSETS,
+    CONNECTIONS,
+    PACKETS,
+    NOUNIT,
+    FILESYSTEM
+};
+using Labels = std::unordered_map<std::string, std::string>;
+
+class BvarMetric {
+public:
+    BvarMetric() = default;
+    virtual ~BvarMetric() = default;
+    BvarMetric(BvarMetric&) = default;
+    BvarMetric(BvarMetricType type, BvarMetricUnit unit, std::string name, 
std::string description,
+               std::string group_name, Labels labels)
+            : type_(type),
+              unit_(unit),
+              name_(name),
+              description_(description),
+              group_name_(group_name),
+              labels_(labels) {}
+    virtual std::string to_prometheus(bool with_tablet_metrics = false) const 
{ return ""; };
+    // std::string to_json(bool with_tablet_metrics = false) const;
+    // std::string to_core_string() const;
+protected:
+    BvarMetricType type_;
+    BvarMetricUnit unit_;
+    std::string name_;
+    std::string description_;
+    std::string group_name_;
+    Labels labels_;
+};
+
+template <typename T>
+class BvarAdderMetric : public BvarMetric {
+public:
+    BvarAdderMetric(BvarMetricType type, BvarMetricUnit unit, std::string name,
+                    std::string description, std::string group_name, Labels 
labels)
+            : BvarMetric(type, unit, name, description, group_name, labels) {
+        adder_ = std::make_shared<bvar::Adder<T>>(group_name, name + '_' + 
description);
+    }
+    ~BvarAdderMetric() override = default;
+    void increment(T value);
+    void set_value(T value);
+    std::string to_prometheus(bool with_tablet_metrics = false) const override;
+
+private:
+    std::shared_ptr<bvar::Adder<T>> adder_;
+};
+
+class BvarMetricEntity {
+public:
+    BvarMetricEntity() = default;
+    BvarMetricEntity(std::string entity_name) { this->entity_name_ = 
entity_name; }
+    BvarMetricEntity(BvarMetricEntity& entity) {
+        this->entity_name_ = entity.entity_name_;
+        this->map_ = entity.map_;
+    }
+    void put(std::string name, BvarMetric metric);
+    std::string to_prometheus();
+
+private:
+    std::string entity_name_;
+    std::unordered_map<std::string, std::shared_ptr<BvarMetric>> map_;

Review Comment:
   warning: expected member name or ';' after declaration specifiers 
[clang-diagnostic-error]
   ```cpp
       std::unordered_map<std::string, std::shared_ptr<BvarMetric>> map_;
                                                                  ^
   ```
   



##########
be/src/util/doris_bvar_metrics.cpp:
##########
@@ -0,0 +1,61 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "doris_bvar_metrics.h"
+
+namespace doris {
+
+void DorisBvarMetrics::initialize() {
+    server_metric_entity.put("fragment_request_total", 
g_adder_fragment_requests_total);
+    server_metric_entity.put("fragment_request_duration", 
g_adder_fragment_request_duration_us);
+    server_metric_entity.put("query_scan_byte", g_adder_query_scan_bytes);
+    server_metric_entity.put("segment_read_total", g_adder_segment_read_total);

Review Comment:
   warning: no viable conversion from 'BvarAdderMetric<int64_t>' (aka 
'BvarAdderMetric<long>') to 'doris::BvarMetric' [clang-diagnostic-error]
   ```cpp
       server_metric_entity.put("segment_read_total", 
g_adder_segment_read_total);
                                                      ^
   ```
   **be/src/util/bvar_metrics.h:53:** candidate constructor not viable: no 
known conversion from 'BvarAdderMetric<int64_t>' (aka 'BvarAdderMetric<long>') 
to 'doris::BvarMetric &' for 1st argument
   ```cpp
       BvarMetric(BvarMetric&) = default;
       ^
   ```
   **be/src/util/bvar_metrics.h:99:** passing argument to parameter 'metric' 
here
   ```cpp
       void put(std::string name, BvarMetric metric);
                                             ^
   ```
   



##########
be/src/util/doris_bvar_metrics.cpp:
##########
@@ -0,0 +1,61 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "doris_bvar_metrics.h"
+
+namespace doris {
+
+void DorisBvarMetrics::initialize() {
+    server_metric_entity.put("fragment_request_total", 
g_adder_fragment_requests_total);
+    server_metric_entity.put("fragment_request_duration", 
g_adder_fragment_request_duration_us);
+    server_metric_entity.put("query_scan_byte", g_adder_query_scan_bytes);

Review Comment:
   warning: no viable conversion from 'BvarAdderMetric<int64_t>' (aka 
'BvarAdderMetric<long>') to 'doris::BvarMetric' [clang-diagnostic-error]
   ```cpp
       server_metric_entity.put("query_scan_byte", g_adder_query_scan_bytes);
                                                   ^
   ```
   **be/src/util/bvar_metrics.h:53:** candidate constructor not viable: no 
known conversion from 'BvarAdderMetric<int64_t>' (aka 'BvarAdderMetric<long>') 
to 'doris::BvarMetric &' for 1st argument
   ```cpp
       BvarMetric(BvarMetric&) = default;
       ^
   ```
   **be/src/util/bvar_metrics.h:99:** passing argument to parameter 'metric' 
here
   ```cpp
       void put(std::string name, BvarMetric metric);
                                             ^
   ```
   



##########
be/src/util/doris_bvar_metrics.cpp:
##########
@@ -0,0 +1,61 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "doris_bvar_metrics.h"
+
+namespace doris {
+
+void DorisBvarMetrics::initialize() {
+    server_metric_entity.put("fragment_request_total", 
g_adder_fragment_requests_total);
+    server_metric_entity.put("fragment_request_duration", 
g_adder_fragment_request_duration_us);
+    server_metric_entity.put("query_scan_byte", g_adder_query_scan_bytes);
+    server_metric_entity.put("segment_read_total", g_adder_segment_read_total);
+}
+
+void DorisBvarMetrics::put(BvarMetricEntity entity) {
+    {
+        std::lock_guard<bthread::Mutex> l(mutex_);
+        std::shared_ptr<BvarMetricEntity> entity_ptr(new 
BvarMetricEntity(entity));

Review Comment:
   warning: no member named 'shared_ptr' in namespace 'std' 
[clang-diagnostic-error]
   ```cpp
           std::shared_ptr<BvarMetricEntity> entity_ptr(new 
BvarMetricEntity(entity));
                ^
   ```
   



##########
be/src/util/doris_bvar_metrics.cpp:
##########
@@ -0,0 +1,61 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "doris_bvar_metrics.h"
+
+namespace doris {
+
+void DorisBvarMetrics::initialize() {
+    server_metric_entity.put("fragment_request_total", 
g_adder_fragment_requests_total);
+    server_metric_entity.put("fragment_request_duration", 
g_adder_fragment_request_duration_us);

Review Comment:
   warning: no viable conversion from 'BvarAdderMetric<int64_t>' (aka 
'BvarAdderMetric<long>') to 'doris::BvarMetric' [clang-diagnostic-error]
   ```cpp
       server_metric_entity.put("fragment_request_duration", 
g_adder_fragment_request_duration_us);
                                                             ^
   ```
   **be/src/util/bvar_metrics.h:53:** candidate constructor not viable: no 
known conversion from 'BvarAdderMetric<int64_t>' (aka 'BvarAdderMetric<long>') 
to 'doris::BvarMetric &' for 1st argument
   ```cpp
       BvarMetric(BvarMetric&) = default;
       ^
   ```
   **be/src/util/bvar_metrics.h:99:** passing argument to parameter 'metric' 
here
   ```cpp
       void put(std::string name, BvarMetric metric);
                                             ^
   ```
   



##########
be/src/util/doris_bvar_metrics.cpp:
##########
@@ -0,0 +1,61 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "doris_bvar_metrics.h"
+
+namespace doris {
+
+void DorisBvarMetrics::initialize() {
+    server_metric_entity.put("fragment_request_total", 
g_adder_fragment_requests_total);
+    server_metric_entity.put("fragment_request_duration", 
g_adder_fragment_request_duration_us);
+    server_metric_entity.put("query_scan_byte", g_adder_query_scan_bytes);
+    server_metric_entity.put("segment_read_total", g_adder_segment_read_total);
+}
+
+void DorisBvarMetrics::put(BvarMetricEntity entity) {
+    {
+        std::lock_guard<bthread::Mutex> l(mutex_);
+        std::shared_ptr<BvarMetricEntity> entity_ptr(new 
BvarMetricEntity(entity));

Review Comment:
   warning: use of undeclared identifier 'entity_ptr' [clang-diagnostic-error]
   ```cpp
           std::shared_ptr<BvarMetricEntity> entity_ptr(new 
BvarMetricEntity(entity));
                                             ^
   ```
   



##########
be/src/util/doris_bvar_metrics.cpp:
##########
@@ -0,0 +1,61 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "doris_bvar_metrics.h"
+
+namespace doris {
+
+void DorisBvarMetrics::initialize() {
+    server_metric_entity.put("fragment_request_total", 
g_adder_fragment_requests_total);
+    server_metric_entity.put("fragment_request_duration", 
g_adder_fragment_request_duration_us);
+    server_metric_entity.put("query_scan_byte", g_adder_query_scan_bytes);
+    server_metric_entity.put("segment_read_total", g_adder_segment_read_total);
+}
+
+void DorisBvarMetrics::put(BvarMetricEntity entity) {
+    {
+        std::lock_guard<bthread::Mutex> l(mutex_);
+        std::shared_ptr<BvarMetricEntity> entity_ptr(new 
BvarMetricEntity(entity));
+        if (std::find(vec_.begin(), vec_.end(), entity_ptr) == vec_.end()) {

Review Comment:
   warning: use of undeclared identifier 'vec_' [clang-diagnostic-error]
   ```cpp
           if (std::find(vec_.begin(), vec_.end(), entity_ptr) == vec_.end()) {
                         ^
   ```
   



##########
be/src/util/doris_bvar_metrics.cpp:
##########
@@ -0,0 +1,61 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "doris_bvar_metrics.h"
+
+namespace doris {
+
+void DorisBvarMetrics::initialize() {
+    server_metric_entity.put("fragment_request_total", 
g_adder_fragment_requests_total);
+    server_metric_entity.put("fragment_request_duration", 
g_adder_fragment_request_duration_us);
+    server_metric_entity.put("query_scan_byte", g_adder_query_scan_bytes);
+    server_metric_entity.put("segment_read_total", g_adder_segment_read_total);
+}
+
+void DorisBvarMetrics::put(BvarMetricEntity entity) {
+    {
+        std::lock_guard<bthread::Mutex> l(mutex_);
+        std::shared_ptr<BvarMetricEntity> entity_ptr(new 
BvarMetricEntity(entity));

Review Comment:
   warning: 'BvarMetricEntity' does not refer to a value 
[clang-diagnostic-error]
   ```cpp
           std::shared_ptr<BvarMetricEntity> entity_ptr(new 
BvarMetricEntity(entity));
                           ^
   ```
   **be/src/util/bvar_metrics.h:91:** declared here
   ```cpp
   class BvarMetricEntity {
         ^
   ```
   



##########
be/src/util/doris_bvar_metrics.h:
##########
@@ -0,0 +1,47 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#pragma once
+
+#include "util/bvar_metrics.h"
+
+namespace doris {
+
+class DorisBvarMetrics {
+public:
+    static DorisBvarMetrics* instance() {
+        static DorisBvarMetrics metrics;
+        return &metrics;
+    }
+    void initialize();
+    void put(BvarMetricEntity entity);
+    std::string to_prometheus();
+
+private:
+    DorisBvarMetrics() = default;
+    std::string name_;
+    std::vector<std::shared_ptr<BvarMetricEntity>> vec_;

Review Comment:
   warning: no member named 'shared_ptr' in namespace 'std' 
[clang-diagnostic-error]
   ```cpp
       std::vector<std::shared_ptr<BvarMetricEntity>> vec_;
                        ^
   ```
   



##########
be/src/util/doris_bvar_metrics.cpp:
##########
@@ -0,0 +1,61 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "doris_bvar_metrics.h"
+
+namespace doris {
+
+void DorisBvarMetrics::initialize() {
+    server_metric_entity.put("fragment_request_total", 
g_adder_fragment_requests_total);
+    server_metric_entity.put("fragment_request_duration", 
g_adder_fragment_request_duration_us);
+    server_metric_entity.put("query_scan_byte", g_adder_query_scan_bytes);
+    server_metric_entity.put("segment_read_total", g_adder_segment_read_total);
+}
+
+void DorisBvarMetrics::put(BvarMetricEntity entity) {
+    {
+        std::lock_guard<bthread::Mutex> l(mutex_);
+        std::shared_ptr<BvarMetricEntity> entity_ptr(new 
BvarMetricEntity(entity));
+        if (std::find(vec_.begin(), vec_.end(), entity_ptr) == vec_.end()) {

Review Comment:
   warning: use of undeclared identifier 'vec_' [clang-diagnostic-error]
   ```cpp
           if (std::find(vec_.begin(), vec_.end(), entity_ptr) == vec_.end()) {
                                       ^
   ```
   



##########
be/src/util/doris_bvar_metrics.h:
##########
@@ -0,0 +1,47 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#pragma once
+
+#include "util/bvar_metrics.h"
+
+namespace doris {
+
+class DorisBvarMetrics {
+public:
+    static DorisBvarMetrics* instance() {
+        static DorisBvarMetrics metrics;
+        return &metrics;
+    }
+    void initialize();
+    void put(BvarMetricEntity entity);
+    std::string to_prometheus();
+
+private:
+    DorisBvarMetrics() = default;
+    std::string name_;
+    std::vector<std::shared_ptr<BvarMetricEntity>> vec_;

Review Comment:
   warning: 'BvarMetricEntity' does not refer to a value 
[clang-diagnostic-error]
   ```cpp
       std::vector<std::shared_ptr<BvarMetricEntity>> vec_;
                                   ^
   ```
   **be/src/util/bvar_metrics.h:91:** declared here
   ```cpp
   class BvarMetricEntity {
         ^
   ```
   



##########
be/src/util/doris_bvar_metrics.h:
##########
@@ -0,0 +1,47 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#pragma once
+
+#include "util/bvar_metrics.h"
+
+namespace doris {
+
+class DorisBvarMetrics {
+public:
+    static DorisBvarMetrics* instance() {
+        static DorisBvarMetrics metrics;
+        return &metrics;
+    }
+    void initialize();
+    void put(BvarMetricEntity entity);
+    std::string to_prometheus();
+
+private:
+    DorisBvarMetrics() = default;
+    std::string name_;
+    std::vector<std::shared_ptr<BvarMetricEntity>> vec_;

Review Comment:
   warning: expected member name or ';' after declaration specifiers 
[clang-diagnostic-error]
   ```cpp
       std::vector<std::shared_ptr<BvarMetricEntity>> vec_;
                                                    ^
   ```
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to