how to access kafka metrics data using dropwizard library

119 Views Asked by At

Can somebody provide an example of how to access kafka metrics using dropwizard lib?

Below code uses yammer metrica to access the metric with the given metric Name

MetricName  metricName = new MetricName("", "", "", "", "kafka.server:type=ZooKeeperClientMetrics,name=ZooKeeperRequestLatencyMs");
Metric m = Metrics.defaultRegistry().allMetrics().get(metricName);


another example of accessing the metrics using yammer

for (Map.Entry<String, SortedMap<MetricName, Metric>> entry : getMetricsRegistry()
                .groupedMetrics(MetricPredicate.ALL)
                .entrySet()) {
                for (Map.Entry<MetricName, Metric> subEntry : entry.getValue().entrySet()) {
                    final Metric metric = subEntry.getValue();
                    metric.processWith(this, subEntry.getKey(), epoch);                   
                }
            }



Does anybody know what is the equivalent code using dropwizard? 
1

There are 1 best solutions below

0
OneCricketeer On