Source:
<code>public Map<String, SystemStreamMetadata> getSystemStreamMetadata(Set<String> streamNames) { Map<String, SystemStreamMetadata> requestedMetadata = new HashMap<>(); try { for (String streamName : streamNames) { if (!streamPartitions.containsKey(streamName)) { LOG.debug(String.format("Partition ids for Stream=%s not found", streamName)); EventHubClientManager eventHubClientManager = getOrCreateStreamEventHubClient(streamName); CompletableFuture<EventHubRuntimeInformation> runtimeInfo = eventHubClientManager.getEventHubClient().getRuntimeInformation(); long timeoutMs = eventHubConfig.getRuntimeInfoWaitTimeMS(systemName); EventHubRuntimeInformation ehInfo = runtimeInfo.get(timeoutMs, TimeUnit.MILLISECONDS); LOG.info(String.format("Adding partition ids=%s for stream=%s. EHRuntimetInfo=%s", <START> Arrays.toString(ehInfo.getPartitionIds()), streamName, printEventHubRuntimeInfo(ehInfo))); <END> streamPartitions.put(streamName, ehInfo.getPartitionIds()); } String[] partitionIds = streamPartitions.get(streamName); Map<Partition, SystemStreamPartitionMetadata> sspMetadataMap = getPartitionMetadata(streamName, partitionIds); SystemStreamMetadata systemStreamMetadata = new SystemStreamMetadata(streamName, sspMetadataMap); requestedMetadata.put(streamName, systemStreamMetadata); } } catch (Exception e) { String msg = String.format("Error while fetching EventHubRuntimeInfo for System:%s", systemName); LOG.error(msg, e); throw new SamzaException(msg, e); } finally { eventHubClients.forEach((streamName, client) -> client.close(DEFAULT_SHUTDOWN_TIMEOUT_MILLIS)); eventHubClients.clear(); } return requestedMetadata; }</code><technical_language>log partition level metadata returning including number of messages in partition (endSequenceNumber-startSequenceNumber)</technical_language>

Target:
public Map<String, SystemStreamMetadata> getSystemStreamMetadata(Set<String> streamNames) { Map<String, SystemStreamMetadata> requestedMetadata = new HashMap<>(); try { for (String streamName : streamNames) { if (!streamPartitions.containsKey(streamName)) { LOG.debug(String.format("Partition ids for Stream=%s not found", streamName)); EventHubClientManager eventHubClientManager = getOrCreateStreamEventHubClient(streamName); EventHubClient ehClient = eventHubClientManager.getEventHubClient(); CompletableFuture<EventHubRuntimeInformation> runtimeInfo = ehClient.getRuntimeInformation(); long timeoutMs = eventHubConfig.getRuntimeInfoWaitTimeMS(systemName); EventHubRuntimeInformation ehInfo = runtimeInfo.get(timeoutMs, TimeUnit.MILLISECONDS); LOG.info(String.format("Adding partition ids=%s for stream=%s. EHRuntimetInfo=%s", Arrays.toString(ehInfo.getPartitionIds()), streamName, printEventHubRuntimeInfo(ehInfo))); try { for (String partitionId : ehInfo.getPartitionIds()) { LOG.info(printPartitionRuntimeInfo( ehClient.getPartitionRuntimeInformation(partitionId).get(timeoutMs, TimeUnit.MILLISECONDS))); } } catch (Exception e) { LOG.warn("Failed to fetch and print partition runtime info from EventHubs.", e); } streamPartitions.put(streamName, ehInfo.getPartitionIds()); } String[] partitionIds = streamPartitions.get(streamName); Map<Partition, SystemStreamPartitionMetadata> sspMetadataMap = getPartitionMetadata(streamName, partitionIds); SystemStreamMetadata systemStreamMetadata = new SystemStreamMetadata(streamName, sspMetadataMap); requestedMetadata.put(streamName, systemStreamMetadata); } } catch (Exception e) { String msg = String.format("Error while fetching EventHubRuntimeInfo for System:%s", systemName); LOG.error(msg, e); throw new SamzaException(msg, e); } finally { eventHubClients.forEach((streamName, client) -> client.close(DEFAULT_SHUTDOWN_TIMEOUT_MILLIS)); eventHubClients.clear(); } return requestedMetadata; }