You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@kafka.apache.org by tao xiao <xi...@gmail.com> on 2015/02/04 12:15:12 UTC
Got IOException when writing metrics to csv file
Hi team,
I was running the mirror maker off the trunk code and got IOException when
configuring the mirror maker to use KafkaCSVMetricsReporter as the metric
reporter
Here is the exception I got
java.io.IOException: Unable to create /tmp/csv1/BytesPerSec.csv
at
com.yammer.metrics.reporting.CsvReporter.createStreamForMetric(CsvReporter.java:141)
at
com.yammer.metrics.reporting.CsvReporter.getPrintStream(CsvReporter.java:257)
at com.yammer.metrics.reporting.CsvReporter.access$000(CsvReporter.java:22)
at
com.yammer.metrics.reporting.CsvReporter$1.getStream(CsvReporter.java:156)
at
com.yammer.metrics.reporting.CsvReporter.processTimer(CsvReporter.java:212)
at
com.yammer.metrics.reporting.CsvReporter.processTimer(CsvReporter.java:22)
at com.yammer.metrics.core.Timer.processWith(Timer.java:214)
at com.yammer.metrics.reporting.CsvReporter.run(CsvReporter.java:163)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Here is the configuration I put in the consumer.properties
zookeeper.connect=127.0.0.1:2181
# timeout in ms for connecting to zookeeper
zookeeper.connection.timeout.ms=1000000
#consumer group id
group.id=kafka-topic
auto.offset.reset=smallest
#consumer timeout
#consumer.timeout.ms=5000
# Metrics
kafka.metrics.polling.interval.secs=5
kafka.metrics.reporters=kafka.metrics.KafkaCSVMetricsReporter
kafka.csv.metrics.dir=/tmp/csv1
kafka.csv.metrics.reporter.enabled=true
I debug the code and discovered that the issue was caused different metrics
sharing the same metric name. I diff the trunk code with 0.8.1
on ConsumerTopicStats.scala
from 0.8.1
val byteRate = newMeter(metricId + "BytesPerSec", "bytes",
TimeUnit.SECONDS)
from trunk
val byteRate = newMeter("BytesPerSec", "bytes", TimeUnit.SECONDS, tags)
trunk removes the metricId from the name which results in same metric name
BytesPerSec used by multiple metrics.
Is this a bug or by intention?
--
Regards,
Tao