jackye1995 commented on a change in pull request #4254:
URL: https://github.com/apache/iceberg/pull/4254#discussion_r821184017



##########
File path: api/src/main/java/org/apache/iceberg/metrics/MetricsContext.java
##########
@@ -29,6 +29,21 @@
  * like thread safety and serialization.
  */
 public interface MetricsContext extends Serializable {
+  MetricsContext NULL_METRICS = new MetricsContext() {

Review comment:
       Don't really have a good place to put this... what about this?
   
   ```java
     /**
      * Utility method for producing no metrics.
      *
      * @return a non-recording metrics context
      */
     static MetricsContext nullMetrics() {
       return NullMetricsContext.INSTANCE;
     }
   
     class NullMetricsContext implements MetricsContext {
   
       private static final MetricsContext INSTANCE = new NullMetricsContext();
   
       @Override
       public <T extends Number> Counter<T> counter(String name, Class<T> type, 
Unit unit) {
         return new Counter<T>() {
           @Override
           public void increment() {
           }
   
           @Override
           public void increment(T amount) {
           }
         };
       }
     }
   ```




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