You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2022/02/15 15:05:28 UTC

[GitHub] [hive] vcsomor opened a new pull request #3032: HIVE-25959: Expose Compaction Observability delta metrics using the JsonFileMetricsReporter

vcsomor opened a new pull request #3032:
URL: https://github.com/apache/hive/pull/3032


   Expose Compaction Observability delta metrics using the JsonFileMetricsReporter
   - Custom MapMetrics has been included into the MetricsRegistry.
   - The MetricsRegistry will call the listeners for the built-in metrics. Since the MapMetrics is not a built-in one it causing an IllegalArgument Exception. To avoid this exception to happen the HiveMetricsRegistry has been implemented.
   - A new Jackson JSON module has been added (MapCapableJsonMetricsModule) to add serialization of the `mbeans`
   - MapCapableJsonMetricsModule has been registered to the JsonFileMetricsReporter
   - AcidMetricsService now leveraging the on the nbew metrics instead of the MetricsMBeanImpl and JMX


-- 
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: gitbox-unsubscribe@hive.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] vcsomor commented on a change in pull request #3032: HIVE-25959: Expose Compaction Observability delta metrics using the JsonReporter

Posted by GitBox <gi...@apache.org>.
vcsomor commented on a change in pull request #3032:
URL: https://github.com/apache/hive/pull/3032#discussion_r808928144



##########
File path: standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/metrics/Metrics.java
##########
@@ -160,6 +159,47 @@ public Integer getValue() {
     }
   }
 
+  /**
+   * Get a Map that represents a multi-field metric,
+   * or create a new one if it does not already exist.
+   * @param name Name of map metric.  This should come from MetricConstants
+   * @return MapMetric .
+   */
+  public static MapMetrics getOrCreateMapMetrics(String name) {
+    if (self == null) {
+      return dummyMapMetrics;
+    }
+
+    Map<String, Metric> metrics = self.registry.getMetrics();
+    Metric map = metrics.get(name);
+    if (map instanceof MapMetrics) {
+      return (MapMetrics) map;
+    }
+
+    // Looks like it doesn't exist.  Lock so that two threads don't create it at once.
+    synchronized (Metrics.class) {
+      // Recheck to make sure someone didn't create it while we waited.

Review comment:
       ```java
       Object val = null;
       if (val instanceof String) {
         LOG.info("Not null safe");
       } else {
         LOG.info("Null safe");
       }
   ```
   output
   ```log
   [INFO ] OMITTED - Null safe
   ```




-- 
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: gitbox-unsubscribe@hive.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] vcsomor commented on a change in pull request #3032: HIVE-25959: Expose Compaction Observability delta metrics using the JsonReporter

Posted by GitBox <gi...@apache.org>.
vcsomor commented on a change in pull request #3032:
URL: https://github.com/apache/hive/pull/3032#discussion_r808925697



##########
File path: standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/metrics/JsonReporter.java
##########
@@ -160,7 +158,7 @@ public void report(SortedMap<String, Gauge> sortedMap, SortedMap<String, Counter
       try (BufferedWriter bw = Files.newBufferedWriter(tmpFile, StandardCharsets.UTF_8)) {
         bw.write(json);
       } catch (IOException e) {
-        LOG.error("Unable to write to temp file {}" + tmpFile, e);
+        LOG.error("Unable to write to temp file {}", tmpFile, e);

Review comment:
       This is not required because, the if the last element is a `Throwable` then it will be handled outside of the string-extrapolation.
   ```java
       String tmpFileX = "myfile";
       try {
         throw new RuntimeException("Casued by me");
       } catch (RuntimeException e) {
         LOG.error("Unable to write to temp file {}", tmpFileX, e);
       }
   ```
   output:
   ```log
   [ERROR] 2022-02-17 11:59:03.456 [metrics-json-reporter-4-thread-1] JsonReporter - Unable to write to temp file myfile
   java.lang.RuntimeException: Casued by me
   	at org.apache.hadoop.hive.metastore.metrics.JsonReporter.report(JsonReporter.java:140) [classes/:?]
   	at com.codahale.metrics.ScheduledReporter.report(ScheduledReporter.java:162) [metrics-core-3.1.0.jar:3.1.0]
   	at com.codahale.metrics.ScheduledReporter$1.run(ScheduledReporter.java:117) [metrics-core-3.1.0.jar:3.1.0]
   	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_301]
   	at java.util.concurrent.FutureTask.runAndReset$$$capture(FutureTask.java:308) [?:1.8.0_301]
   	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java) [?:1.8.0_301]
   	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_301]
   	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:1.8.0_301]
   	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_301]
   	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_301]
   	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_301]
   [ERROR] 2022-02-17 11:59:08.048 [metrics-json-reporter-4-thread-1] JsonReporter - Unable to write to temp file myfile
   ```
   




-- 
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: gitbox-unsubscribe@hive.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] vcsomor commented on a change in pull request #3032: HIVE-25959: Expose Compaction Observability delta metrics using the JsonReporter

Posted by GitBox <gi...@apache.org>.
vcsomor commented on a change in pull request #3032:
URL: https://github.com/apache/hive/pull/3032#discussion_r808916354



##########
File path: standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/metrics/AcidMetricService.java
##########
@@ -93,12 +93,9 @@
 public class AcidMetricService implements MetastoreTaskThread {
 
   private static final Logger LOG = LoggerFactory.getLogger(AcidMetricService.class);
-  public static final String OBJECT_NAME_PREFIX = "metrics:type=compaction,name=";

Review comment:
       The `OBJECT_NAME_PREFIX` was only required for JMX exposure. Not needed at all for the json format. All the metrics following this pattern (see the below json).
   ```json
   {
       "version" : "1.0",
       "gauges" : {
         "compaction_num_workers" : {
           "value" : 0
         },
         "compaction_num_working" : {
           "value" : 0
         }
       },
       "mbeans" : {
         "compaction_num_active_deltas" : {
           "db.table1/partition2" : 1000,
           "db.table1/partition1" : 100
         },
         "compaction_num_obsolete_deltas" : {
           "db.table3/partition" : 300
         },
         "compaction_num_small_deltas" : {
           "db.table2/partition" : 200
         }
       }
   ```




-- 
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: gitbox-unsubscribe@hive.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] vcsomor commented on a change in pull request #3032: HIVE-25959: Expose Compaction Observability delta metrics using the JsonReporter

Posted by GitBox <gi...@apache.org>.
vcsomor commented on a change in pull request #3032:
URL: https://github.com/apache/hive/pull/3032#discussion_r808916354



##########
File path: standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/metrics/AcidMetricService.java
##########
@@ -93,12 +93,9 @@
 public class AcidMetricService implements MetastoreTaskThread {
 
   private static final Logger LOG = LoggerFactory.getLogger(AcidMetricService.class);
-  public static final String OBJECT_NAME_PREFIX = "metrics:type=compaction,name=";

Review comment:
       The `OBJECT_NAME_PREFIX` was only required for JMX exposure. Not needed at all for the json format. All the metrics following this pattern (see the below json).
   ```json
   {
       "version" : "1.0",
       "gauges" : {
         "compaction_num_workers" : {
           "value" : 0
         },
         "compaction_num_working" : {
           "value" : 0
         }
       },
       "mbeans" : {
         "compaction_num_active_deltas" : {
           "db.table1/partition2" : 1000,
           "db.table1/partition1" : 100
         },
         "compaction_num_obsolete_deltas" : {
           "db.table3/partition" : 300
         },
         "compaction_num_small_deltas" : {
           "db.table2/partition" : 200
         }
       }
   ```
   
   As you can see the type and all the name not required at all because it i defined by the object_key (e.g.: compaction_num_active_deltas).




-- 
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: gitbox-unsubscribe@hive.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] vcsomor commented on a change in pull request #3032: HIVE-25959: Expose Compaction Observability delta metrics using the JsonReporter

Posted by GitBox <gi...@apache.org>.
vcsomor commented on a change in pull request #3032:
URL: https://github.com/apache/hive/pull/3032#discussion_r809442897



##########
File path: standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/metrics/Metrics.java
##########
@@ -160,6 +159,47 @@ public Integer getValue() {
     }
   }
 
+  /**
+   * Get a Map that represents a multi-field metric,
+   * or create a new one if it does not already exist.
+   * @param name Name of map metric.  This should come from MetricConstants
+   * @return MapMetric .
+   */
+  public static MapMetrics getOrCreateMapMetrics(String name) {
+    if (self == null) {
+      return dummyMapMetrics;
+    }
+
+    Map<String, Metric> metrics = self.registry.getMetrics();
+    Metric map = metrics.get(name);
+    if (map instanceof MapMetrics) {
+      return (MapMetrics) map;
+    }
+
+    // Looks like it doesn't exist.  Lock so that two threads don't create it at once.
+    synchronized (Metrics.class) {
+      // Recheck to make sure someone didn't create it while we waited.

Review comment:
       Fixed and thanks




-- 
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: gitbox-unsubscribe@hive.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] klcopp commented on a change in pull request #3032: HIVE-25959: Expose Compaction Observability delta metrics using the JsonReporter

Posted by GitBox <gi...@apache.org>.
klcopp commented on a change in pull request #3032:
URL: https://github.com/apache/hive/pull/3032#discussion_r808886769



##########
File path: standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/metrics/Metrics.java
##########
@@ -160,6 +159,47 @@ public Integer getValue() {
     }
   }
 
+  /**
+   * Get a Map that represents a multi-field metric,
+   * or create a new one if it does not already exist.
+   * @param name Name of map metric.  This should come from MetricConstants
+   * @return MapMetric .
+   */
+  public static MapMetrics getOrCreateMapMetrics(String name) {
+    if (self == null) {
+      return dummyMapMetrics;
+    }
+
+    Map<String, Metric> metrics = self.registry.getMetrics();
+    Metric map = metrics.get(name);
+    if (map instanceof MapMetrics) {

Review comment:
       Might need a null check here as well

##########
File path: standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/metrics/Metrics.java
##########
@@ -160,6 +159,47 @@ public Integer getValue() {
     }
   }
 
+  /**
+   * Get a Map that represents a multi-field metric,
+   * or create a new one if it does not already exist.
+   * @param name Name of map metric.  This should come from MetricConstants
+   * @return MapMetric .
+   */
+  public static MapMetrics getOrCreateMapMetrics(String name) {
+    if (self == null) {
+      return dummyMapMetrics;
+    }
+
+    Map<String, Metric> metrics = self.registry.getMetrics();
+    Metric map = metrics.get(name);
+    if (map instanceof MapMetrics) {
+      return (MapMetrics) map;
+    }
+
+    // Looks like it doesn't exist.  Lock so that two threads don't create it at once.
+    synchronized (Metrics.class) {
+      // Recheck to make sure someone didn't create it while we waited.

Review comment:
       The recheck is missing. To follow the pattern of the other metrics, this block should look like:
   
   ```
   metrics = self.registry.getMetrics();
         map = metrics.get(name);
         if (map != null && map instanceof MapMetrics) {
           return (MapMetrics) map;
         }
   // then register the metric and return it
   ```

##########
File path: standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/metrics/AcidMetricService.java
##########
@@ -93,12 +93,9 @@
 public class AcidMetricService implements MetastoreTaskThread {
 
   private static final Logger LOG = LoggerFactory.getLogger(AcidMetricService.class);
-  public static final String OBJECT_NAME_PREFIX = "metrics:type=compaction,name=";

Review comment:
       Is this prefix omitted completely? If left out, it might introduce some backwards incompatibility

##########
File path: standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/metrics/JsonReporter.java
##########
@@ -160,7 +158,7 @@ public void report(SortedMap<String, Gauge> sortedMap, SortedMap<String, Counter
       try (BufferedWriter bw = Files.newBufferedWriter(tmpFile, StandardCharsets.UTF_8)) {
         bw.write(json);
       } catch (IOException e) {
-        LOG.error("Unable to write to temp file {}" + tmpFile, e);
+        LOG.error("Unable to write to temp file {}", tmpFile, e);

Review comment:
       Nit: if you want to do a good deed:  `e` needs its own `{}`




-- 
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: gitbox-unsubscribe@hive.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] vcsomor commented on a change in pull request #3032: HIVE-25959: Expose Compaction Observability delta metrics using the JsonReporter

Posted by GitBox <gi...@apache.org>.
vcsomor commented on a change in pull request #3032:
URL: https://github.com/apache/hive/pull/3032#discussion_r808912719



##########
File path: standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/metrics/Metrics.java
##########
@@ -160,6 +159,47 @@ public Integer getValue() {
     }
   }
 
+  /**
+   * Get a Map that represents a multi-field metric,
+   * or create a new one if it does not already exist.
+   * @param name Name of map metric.  This should come from MetricConstants
+   * @return MapMetric .
+   */
+  public static MapMetrics getOrCreateMapMetrics(String name) {
+    if (self == null) {
+      return dummyMapMetrics;
+    }
+
+    Map<String, Metric> metrics = self.registry.getMetrics();
+    Metric map = metrics.get(name);
+    if (map instanceof MapMetrics) {
+      return (MapMetrics) map;
+    }
+
+    // Looks like it doesn't exist.  Lock so that two threads don't create it at once.
+    synchronized (Metrics.class) {
+      // Recheck to make sure someone didn't create it while we waited.

Review comment:
       The `instanceof` is nullsafe




-- 
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: gitbox-unsubscribe@hive.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] vcsomor commented on a change in pull request #3032: HIVE-25959: Expose Compaction Observability delta metrics using the JsonReporter

Posted by GitBox <gi...@apache.org>.
vcsomor commented on a change in pull request #3032:
URL: https://github.com/apache/hive/pull/3032#discussion_r808912041



##########
File path: standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/metrics/Metrics.java
##########
@@ -160,6 +159,47 @@ public Integer getValue() {
     }
   }
 
+  /**
+   * Get a Map that represents a multi-field metric,
+   * or create a new one if it does not already exist.
+   * @param name Name of map metric.  This should come from MetricConstants
+   * @return MapMetric .
+   */
+  public static MapMetrics getOrCreateMapMetrics(String name) {
+    if (self == null) {
+      return dummyMapMetrics;
+    }
+
+    Map<String, Metric> metrics = self.registry.getMetrics();
+    Metric map = metrics.get(name);
+    if (map instanceof MapMetrics) {

Review comment:
       The `instanceof` is nullsafe. if `map` is `null` the the `if` becomes `false`




-- 
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: gitbox-unsubscribe@hive.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] klcopp commented on a change in pull request #3032: HIVE-25959: Expose Compaction Observability delta metrics using the JsonReporter

Posted by GitBox <gi...@apache.org>.
klcopp commented on a change in pull request #3032:
URL: https://github.com/apache/hive/pull/3032#discussion_r809164718



##########
File path: standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/metrics/Metrics.java
##########
@@ -160,6 +159,47 @@ public Integer getValue() {
     }
   }
 
+  /**
+   * Get a Map that represents a multi-field metric,
+   * or create a new one if it does not already exist.
+   * @param name Name of map metric.  This should come from MetricConstants
+   * @return MapMetric .
+   */
+  public static MapMetrics getOrCreateMapMetrics(String name) {
+    if (self == null) {
+      return dummyMapMetrics;
+    }
+
+    Map<String, Metric> metrics = self.registry.getMetrics();
+    Metric map = metrics.get(name);
+    if (map instanceof MapMetrics) {
+      return (MapMetrics) map;
+    }
+
+    // Looks like it doesn't exist.  Lock so that two threads don't create it at once.
+    synchronized (Metrics.class) {
+      // Recheck to make sure someone didn't create it while we waited.

Review comment:
       Okay, the "Recheck to make sure someone didn't create it while we waited" is still not the case




-- 
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: gitbox-unsubscribe@hive.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] vcsomor commented on a change in pull request #3032: HIVE-25959: Expose Compaction Observability delta metrics using the JsonReporter

Posted by GitBox <gi...@apache.org>.
vcsomor commented on a change in pull request #3032:
URL: https://github.com/apache/hive/pull/3032#discussion_r809413256



##########
File path: standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/metrics/Metrics.java
##########
@@ -160,6 +159,47 @@ public Integer getValue() {
     }
   }
 
+  /**
+   * Get a Map that represents a multi-field metric,
+   * or create a new one if it does not already exist.
+   * @param name Name of map metric.  This should come from MetricConstants
+   * @return MapMetric .
+   */
+  public static MapMetrics getOrCreateMapMetrics(String name) {
+    if (self == null) {
+      return dummyMapMetrics;
+    }
+
+    Map<String, Metric> metrics = self.registry.getMetrics();
+    Metric map = metrics.get(name);
+    if (map instanceof MapMetrics) {
+      return (MapMetrics) map;
+    }
+
+    // Looks like it doesn't exist.  Lock so that two threads don't create it at once.
+    synchronized (Metrics.class) {
+      // Recheck to make sure someone didn't create it while we waited.

Review comment:
       ohh sorry I've missed that
   




-- 
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: gitbox-unsubscribe@hive.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] vcsomor commented on a change in pull request #3032: HIVE-25959: Expose Compaction Observability delta metrics using the JsonReporter

Posted by GitBox <gi...@apache.org>.
vcsomor commented on a change in pull request #3032:
URL: https://github.com/apache/hive/pull/3032#discussion_r808925697



##########
File path: standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/metrics/JsonReporter.java
##########
@@ -160,7 +158,7 @@ public void report(SortedMap<String, Gauge> sortedMap, SortedMap<String, Counter
       try (BufferedWriter bw = Files.newBufferedWriter(tmpFile, StandardCharsets.UTF_8)) {
         bw.write(json);
       } catch (IOException e) {
-        LOG.error("Unable to write to temp file {}" + tmpFile, e);
+        LOG.error("Unable to write to temp file {}", tmpFile, e);

Review comment:
       This is not required because, the if the last element is a `Throwable` then it will be handled outside of the string-extrapolation.
   ```json
       String tmpFileX = "myfile";
       try {
         throw new RuntimeException("Casued by me");
       } catch (RuntimeException e) {
         LOG.error("Unable to write to temp file {}", tmpFileX, e);
       }
   ```
   output:
   ```log
   [ERROR] 2022-02-17 11:59:03.456 [metrics-json-reporter-4-thread-1] JsonReporter - Unable to write to temp file myfile
   java.lang.RuntimeException: Casued by me
   	at org.apache.hadoop.hive.metastore.metrics.JsonReporter.report(JsonReporter.java:140) [classes/:?]
   	at com.codahale.metrics.ScheduledReporter.report(ScheduledReporter.java:162) [metrics-core-3.1.0.jar:3.1.0]
   	at com.codahale.metrics.ScheduledReporter$1.run(ScheduledReporter.java:117) [metrics-core-3.1.0.jar:3.1.0]
   	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_301]
   	at java.util.concurrent.FutureTask.runAndReset$$$capture(FutureTask.java:308) [?:1.8.0_301]
   	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java) [?:1.8.0_301]
   	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_301]
   	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:1.8.0_301]
   	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_301]
   	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_301]
   	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_301]
   [ERROR] 2022-02-17 11:59:08.048 [metrics-json-reporter-4-thread-1] JsonReporter - Unable to write to temp file myfile
   ```
   




-- 
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: gitbox-unsubscribe@hive.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] vcsomor commented on a change in pull request #3032: HIVE-25959: Expose Compaction Observability delta metrics using the JsonReporter

Posted by GitBox <gi...@apache.org>.
vcsomor commented on a change in pull request #3032:
URL: https://github.com/apache/hive/pull/3032#discussion_r808925697



##########
File path: standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/metrics/JsonReporter.java
##########
@@ -160,7 +158,7 @@ public void report(SortedMap<String, Gauge> sortedMap, SortedMap<String, Counter
       try (BufferedWriter bw = Files.newBufferedWriter(tmpFile, StandardCharsets.UTF_8)) {
         bw.write(json);
       } catch (IOException e) {
-        LOG.error("Unable to write to temp file {}" + tmpFile, e);
+        LOG.error("Unable to write to temp file {}", tmpFile, e);

Review comment:
       This is not required because, the if the last element is a `Throwable` then it will be handled outside of the string-extrapolation.
   ```java
       String tmpFileX = "myfile";
       try {
         throw new RuntimeException("Casued by me");
       } catch (RuntimeException e) {
         LOG.error("Unable to write to temp file {}", tmpFileX, e);
       }
   ```
   output:
   ```log
   [ERROR] 2022-02-17 11:59:03.456 [metrics-json-reporter-4-thread-1] JsonReporter - Unable to write to temp file myfile
   java.lang.RuntimeException: Casued by me
   	at org.apache.hadoop.hive.metastore.metrics.JsonReporter.report(JsonReporter.java:140) [classes/:?]
   	at com.codahale.metrics.ScheduledReporter.report(ScheduledReporter.java:162) [metrics-core-3.1.0.jar:3.1.0]
   	at com.codahale.metrics.ScheduledReporter$1.run(ScheduledReporter.java:117) [metrics-core-3.1.0.jar:3.1.0]
   	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_301]
   	at java.util.concurrent.FutureTask.runAndReset$$$capture(FutureTask.java:308) [?:1.8.0_301]
   	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java) [?:1.8.0_301]
   	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_301]
   	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:1.8.0_301]
   	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_301]
   	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_301]
   	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_301]
   
   ```
   




-- 
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: gitbox-unsubscribe@hive.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] klcopp merged pull request #3032: HIVE-25959: Expose Compaction Observability delta metrics using the JsonReporter

Posted by GitBox <gi...@apache.org>.
klcopp merged pull request #3032:
URL: https://github.com/apache/hive/pull/3032


   


-- 
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: gitbox-unsubscribe@hive.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org