Rushabh Shah created HBASE-27697:
------------------------------------

             Summary: Create a dummy metric implementation in 
ConnectionImplementation.
                 Key: HBASE-27697
                 URL: https://issues.apache.org/jira/browse/HBASE-27697
             Project: HBase
          Issue Type: Bug
          Components: metrics
    Affects Versions: 2.5.0
            Reporter: Rushabh Shah


This Jira is for branch-2 only.

If CLIENT_SIDE_METRICS_ENABLED_KEY conf is set to true, then we initialize 
metrics to MetricsConnection, otherwise it is set to null.
{code:java}
      if (conf.getBoolean(CLIENT_SIDE_METRICS_ENABLED_KEY, false)) {        
          this.metricsScope = MetricsConnection.getScope(conf, clusterId, 
this);        
          this.metrics = 
MetricsConnection.getMetricsConnection(this.metricsScope, this::getBatchPool, 
this::getMetaLookupPool);
      } else {
          this.metrics = null;      
      }
{code}

Whenever we want to update metrics, we always do a null check. We can improve 
this by creating a dummy metrics object and have an empty implementation. When 
we want to populate the metrics, we can check if metrics is an instance of 
dummy metrics.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to