Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Federated Clients: implement LiKafkaFederatedProducerImpl#Metrics() #117

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.linkedin.kafka.clients.metadataservice.MetadataServiceClientException;
import com.linkedin.kafka.clients.utils.LiKafkaClientsUtils;

import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -211,7 +212,19 @@ public Map<String, List<PartitionInfo>> partitionsFor(Set<String> topics) {

@Override
public Map<MetricName, ? extends Metric> metrics() {
throw new UnsupportedOperationException("Not implemented yet");
// Get an immutable copy of the current set of producers.
Map<ClusterDescriptor, LiKafkaProducer<K, V>> producers = _producers;

// Aggregate metric from clusters in the group. Since a different client id
// is used for each cluster, there should be no metric name collision.
Map<MetricName, Metric> aggregate = new HashMap<>();
for (LiKafkaProducer<K, V> producer : producers.values()) {
Map<MetricName, ? extends Metric> metrics = producer.metrics();
if (metrics != null) {
aggregate.putAll(producer.metrics());
}
}
return aggregate;
}

@Override
Expand Down