如何使用 dropwizard 库访问 kafka 指标数据

问题描述 投票:0回答:1

有人可以提供一个如何使用 dropwizard lib 访问 kafka 指标的示例吗?

下面的代码使用 yammer metrica 访问具有给定指标名称的指标

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? 
apache-kafka metrics jmx dropwizard yammer
1个回答
0
投票
© www.soinside.com 2019 - 2024. All rights reserved.