chaoyli commented on a change in pull request #3635:
URL: https://github.com/apache/incubator-doris/pull/3635#discussion_r430137045



##########
File path: fe/src/main/java/org/apache/doris/service/FrontendServiceImpl.java
##########
@@ -757,10 +759,15 @@ private boolean loadTxnCommitImpl(TLoadTxnCommitRequest 
request) throws UserExce
             throw new UserException("unknown database, database=" + dbName);
         }
 
-        return 
Catalog.getCurrentGlobalTransactionMgr().commitAndPublishTransaction(
-                db, request.getTxnId(),
-                TabletCommitInfo.fromThrift(request.getCommitInfos()),
-                5000, 
TxnCommitAttachment.fromThrift(request.txnCommitAttachment));
+        boolean ret = 
Catalog.getCurrentGlobalTransactionMgr().commitAndPublishTransaction(
+                        db, request.getTxnId(),
+                        TabletCommitInfo.fromThrift(request.getCommitInfos()),
+                        5000, 
TxnCommitAttachment.fromThrift(request.txnCommitAttachment));
+        if (ret) {
+            // if commit and publish is success, load can be regarded as 
success
+            MetricRepo.COUNTER_LOAD_FINISHED.increase(1L);

Review comment:
       I thins COUNTER_TXN_SUCCESS will use for another logic like schema 
change/rollup/clone in the future. It may be confused.

##########
File path: be/src/http/action/metrics_action.cpp
##########
@@ -143,15 +143,74 @@ void SimpleCoreMetricsVisitor::visit(const std::string& 
prefix,
     }
 }
 
+class JsonMetricsVisitor : public MetricsVisitor {
+public:
+    JsonMetricsVisitor() {
+        _ss << "[\n";
+    }
+    virtual ~JsonMetricsVisitor() {}
+    void visit(const std::string& prefix, const std::string& name,
+               MetricCollector* collector) override;
+    std::string to_string() { 
+        std::string json = _ss.str();
+        json = json.substr(0, json.length() - 2);
+        json += "\n]\n";
+        return json;
+    }
+
+private:
+    std::stringstream _ss;
+};
+
+void JsonMetricsVisitor::visit(const std::string& prefix,
+                               const std::string& name,
+                               MetricCollector* collector) {
+    if (collector->empty() || name.empty()) {
+        return;
+    }
+    switch (collector->type()) {
+    case MetricType::COUNTER:
+    case MetricType::GAUGE:
+        for (auto& it : collector->metrics()) {
+            const MetricLabels& labels = it.first;
+            SimpleMetric* metric = reinterpret_cast<SimpleMetric*>(it.second);
+            _ss << "{\n\t\"tags\":\n\t{\n";

Review comment:
       I change it to rapidjson




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to