You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by sp...@apache.org on 2023/07/18 10:17:25 UTC

[iotdb] branch fix/metric_default_label_1.2 created (now 023f5e7a672)

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

spricoder pushed a change to branch fix/metric_default_label_1.2
in repository https://gitbox.apache.org/repos/asf/iotdb.git


      at 023f5e7a672 Fix default label when no tag (#10568)

This branch includes the following new commits:

     new 023f5e7a672 Fix default label when no tag (#10568)

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[iotdb] 01/01: Fix default label when no tag (#10568)

Posted by sp...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

spricoder pushed a commit to branch fix/metric_default_label_1.2
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 023f5e7a672774f5a71121a1594a6aaeb51e5574
Author: ZhangHongYin <46...@users.noreply.github.com>
AuthorDate: Mon Jul 17 19:24:24 2023 +0800

    Fix default label when no tag (#10568)
    
    (cherry picked from commit adea4bb3c3d15c5338e094ff64c639a378aa3698)
---
 .../reporter/prometheus/PrometheusTextWriter.java      | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/iotdb-core/metrics/interface/src/main/java/org/apache/iotdb/metrics/reporter/prometheus/PrometheusTextWriter.java b/iotdb-core/metrics/interface/src/main/java/org/apache/iotdb/metrics/reporter/prometheus/PrometheusTextWriter.java
index 2ca5076a3df..8311937dafc 100644
--- a/iotdb-core/metrics/interface/src/main/java/org/apache/iotdb/metrics/reporter/prometheus/PrometheusTextWriter.java
+++ b/iotdb-core/metrics/interface/src/main/java/org/apache/iotdb/metrics/reporter/prometheus/PrometheusTextWriter.java
@@ -68,23 +68,23 @@ class PrometheusTextWriter extends FilterWriter {
   public void writeSample(String name, Map<String, String> labels, Object value)
       throws IOException {
     write(name);
+    write('{');
+    write("cluster=\"");
+    write(METRIC_CONFIG.getClusterName());
+    write("\",nodeType=\"");
+    write(METRIC_CONFIG.getNodeType().toString());
+    write("\",nodeId=\"");
+    write(String.valueOf(METRIC_CONFIG.getNodeId()));
+    write("\",");
     if (labels.size() > 0) {
-      write('{');
-      write("cluster=\"");
-      write(METRIC_CONFIG.getClusterName());
-      write("\",nodeType=\"");
-      write(METRIC_CONFIG.getNodeType().toString());
-      write("\",nodeId=\"");
-      write(String.valueOf(METRIC_CONFIG.getNodeId()));
-      write("\",");
       for (Map.Entry<String, String> entry : labels.entrySet()) {
         write(entry.getKey());
         write("=\"");
         write(entry.getValue());
         write("\",");
       }
-      write('}');
     }
+    write('}');
     write(' ');
     write(value.toString());
     write('\n');