Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
2.5.0
-
None
-
None
Description
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.
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; }
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.