Source:
<code>public EventHubSystemConsumer(EventHubConfig config, String systemName, EventHubClientManagerFactory eventHubClientManagerFactory, Map<String, Interceptor> interceptors, MetricsRegistry registry) { super(registry, System::currentTimeMillis); this.config = config; this.systemName = systemName; this.interceptors = interceptors; List<String> streamIds = config.getStreams(systemName); for (String streamId : streamIds) { EventHubClientManager eventHubClientManager = eventHubClientManagerFactory.getEventHubClientManager(systemName, streamId, config); streamEventHubManagers.put(streamId, eventHubClientManager); eventHubClientManager.init(); } prefetchCount = config.getPrefetchCount(systemName); eventReadRates = streamIds.stream().collect(Collectors.toMap(Function.identity(), x -> registry.newCounter(x, EVENT_READ_RATE))); eventByteReadRates = streamIds.stream() .collect(Collectors.toMap(Function.identity(), x -> registry.newCounter(x, EVENT_BYTE_READ_RATE))); consumptionLatenciesMs = streamIds.stream() .collect(Collectors.toMap(Function.identity(), x -> new SamzaHistogram(registry, x, CONSUMPTION_LATENCY_MS))); readErrors = streamIds.stream().collect(Collectors.toMap(Function.identity(), x -> registry.newCounter(x, READ_ERRORS))); synchronized (AGGREGATE_METRICS_LOCK) { if (aggEventReadRate == null) { aggEventReadRate = registry.newCounter(AGGREGATE, EVENT_READ_RATE); aggEventByteReadRate = registry.newCounter(AGGREGATE, EVENT_BYTE_READ_RATE); <START> aggReadLatency = new SamzaHistogram(registry, AGGREGATE, CONSUMPTION_LATENCY_MS); <END> aggReadErrors = registry.newCounter(AGGREGATE, READ_ERRORS); } } }</code><technical_language>consumptionLagMs? Personally, prefer "latency"</technical_language>

Target:
public EventHubSystemConsumer(EventHubConfig config, String systemName, EventHubClientManagerFactory eventHubClientManagerFactory, Map<String, Interceptor> interceptors, MetricsRegistry registry) { super(registry, System::currentTimeMillis); this.config = config; this.systemName = systemName; this.interceptors = interceptors; List<String> streamIds = config.getStreams(systemName); for (String streamId : streamIds) { EventHubClientManager eventHubClientManager = eventHubClientManagerFactory.getEventHubClientManager(systemName, streamId, config); streamEventHubManagers.put(streamId, eventHubClientManager); eventHubClientManager.init(); } prefetchCount = config.getPrefetchCount(systemName); eventReadRates = streamIds.stream().collect(Collectors.toMap(Function.identity(), x -> registry.newCounter(x, EVENT_READ_RATE))); eventByteReadRates = streamIds.stream() .collect(Collectors.toMap(Function.identity(), x -> registry.newCounter(x, EVENT_BYTE_READ_RATE))); consumptionLagMs = streamIds.stream() .collect(Collectors.toMap(Function.identity(), x -> new SamzaHistogram(registry, x, CONSUMPTION_LAG_MS))); readErrors = streamIds.stream().collect(Collectors.toMap(Function.identity(), x -> registry.newCounter(x, READ_ERRORS))); synchronized (AGGREGATE_METRICS_LOCK) { if (aggEventReadRate == null) { aggEventReadRate = registry.newCounter(AGGREGATE, EVENT_READ_RATE); aggEventByteReadRate = registry.newCounter(AGGREGATE, EVENT_BYTE_READ_RATE); aggConsumptionLagMs = new SamzaHistogram(registry, AGGREGATE, CONSUMPTION_LAG_MS); aggReadErrors = registry.newCounter(AGGREGATE, READ_ERRORS); } } }